找回密码
 加入
搜索
查看: 5374|回复: 1

[GUI管理] 帮忙看看代码:实现 记事本激活时我自定义窗口显示,记事本非激活时自定义窗口隐藏

[复制链接]
发表于 2014-7-3 20:16:10 | 显示全部楼层 |阅读模式
帮忙看看代码错在哪里? 目的:实现 记事本激活时我自定义窗口显示,记事本非激活时自定义窗口隐藏
我写的如下代码,但是不能实现功能:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate(" ", @DesktopWidth / 3 -100, @DesktopHeight / 7 - 45, 14, 216,$DS_MODALFRAME);$WS_BORDER)
$Input1 = GUICtrlCreateInput("", 8, 8, 241, 24)
GUICtrlSetFont(-1, 12, 400, 0, "宋体")
$Button1 = GUICtrlCreateButton("确定", 256, 8, 81, 25)
GUISetState(@SW_HIDE)
#EndRegion ### END Koda GUI section ###
While 1>0
if WinWaitActive("[CLASS:Notepad]") Then 
        GUISetState(@SW_SHOW)
 $msg = 0
    While $msg <> $GUI_EVENT_CLOSE 
        $msg = GUIGetMsg()
        Select
;~                         Case $msg =$Input1
;~                                 ;MsgBox(4096, "drag drop file", GUICtrlRead($Input1))
                        Case $msg =$Button1
                                ;MsgBox(4096, "drag drop file", "ok")
                                If GUICtrlRead($Input1)<>"" Then
                                        If StringIsDigit (GUICtrlRead($Input1))  Then
                                                MsgBox(4096, "drag drop file", "数字")
                                        Else
                                                MsgBox(4096, "drag drop file", "汉子")
                                        EndIf
                                EndIf               
                        
        EndSelect
                If WinWaitActive("[CLASS:Notepad]")=0 Then GUISetState(@SW_HIDE)
                
        WEnd
        
        If  $msg <> $GUI_EVENT_CLOSE Then   ExitLoop
        
Else
  MsgBox(4096, "drag drop file", "4545")
        GUISetState(@SW_HIDE)
EndIf
WEnd

 ; MsgBox(4096, "drag drop file", "ex")
         Exit
目前状况是  首次激活能后显示自定义窗口,再次激活自定义窗口不能显示。
发表于 2014-7-3 22:27:11 | 显示全部楼层
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Global $Form1,$Input1,$Button1
;MsgBox(0,"",@DesktopHeight / 7 - 45)
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate(" ", @DesktopWidth / 3 -100, @DesktopHeight / 7 - 45, 14, 216,$DS_MODALFRAME);$WS_BORDER)
$Input1 = GUICtrlCreateInput("", 8, 8, 241, 24)
GUICtrlSetFont(-1, 12, 400, 0, "宋体")
$Button1 = GUICtrlCreateButton("确定", 256, 8, 81, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1>0
if WinWaitActive("[CLASS:Notepad]") Then 
        GUISetState(@SW_SHOW)
$msg = 0
    While $msg <> $GUI_EVENT_CLOSE 
        $msg = GUIGetMsg()
        Select
;~                         Case $msg =$Input1
;~                                 ;MsgBox(4096, "drag drop file", GUICtrlRead($Input1))
                        Case $msg =$Button1
                                ;MsgBox(4096, "drag drop file", "ok")
                                If GUICtrlRead($Input1)<>"" Then
                                        If StringIsDigit (GUICtrlRead($Input1))  Then
                                                MsgBox(4096, "drag drop file", "数字")
                                        Else
                                                MsgBox(4096, "drag drop file", "汉子")
                                        EndIf
                                EndIf                                       
        EndSelect
                If WinWaitActive("[CLASS:Notepad]")=0 Then GUISetState(@SW_HIDE)                
        WEnd
        If  $msg <> $GUI_EVENT_CLOSE Then   ExitLoop        
Else
  MsgBox(4096, "drag drop file", "4545")
        GUISetState(@SW_HIDE)
EndIf
WEnd

; MsgBox(4096, "drag drop file", "ex")
         Exit
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-4 21:43 , Processed in 0.075240 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表