Sign in to follow this  
Followers 0
baoquocphan

Create an inactive GUI

3 posts in this topic

I want to create a GUI, and set timer to show it. But when it show, the current window is this GUI, so tasks which I'm working (typing, surfing web, ...) is corrupted, I have to click back on the window which I'm working to active it, this take time and inconvenient. Therefore, I want to create a GUI, when it show, the current window won't change, this GUI is inactive, but I don't how to do, I have look up in Help file and don't find any style or exStyle which I need. Here is my code:

Func timer($left,$top)
Local $hTimerGUI, $time, $time2, $hTimerSpeakButton, $hTimerGUIMsg, $hTimerGUILabel
    $time=TimerInit()
    $hTimerGUI=GUICreate("",210,100,$left,$top,$WS_POPUP,-1,$hMainGUI) ; !PROBLEM HERE! 
    GUISetBkColor($BkColor,$hTimerGUI)
    If $Method="Random" Then
        $hTimerGUILabel=GUICtrlCreateLabel(FileReadLine(@ScriptDir&"\dic\"&$dicpath,Random(1,_FileCountLines(@ScriptDir&"\dic\"&$dicpath),1)),0,0,210,80,$SS_CENTER)
    Else
        $hTimerGUILabel=GUICtrlCreateLabel(FileReadLine(@ScriptDir&"\dic\"&$dicpath,$Method),0,0,210,80,$SS_CENTER)
    EndIf
    GUICtrlSetFont(-1,13,400)
    GUICtrlSetColor(-1,$TextColor)
    $hTimerSpeakButton=GUICtrlCreateButton("Phát âm",0,80,60,20)
    GUICtrlSetImage(-1,"C:\Windows\System32\shell32.dll",-222,0)
    GUICtrlSetTip(-1,"Yêu cầu kết nối Internet")

    While True
        ...
    WEnd
EndFunc

Thanks a lot! :)

Share this post


Link to post
Share on other sites



Hi baoquocphan. You could use @SW_SHOWNOACTIVATE as the flag of GUISetState.

#include <WindowsConstants.au3>
GUICreate('test', Default, Default, Default, Default, $WS_POPUP)
GUISetState(@SW_SHOWNOACTIVATE)
Sleep(1000)
ConsoleWrite(WinGetTitle('') & @CRLF)
Sleep(3000)

Seems inactive initially and the active title returned by consolewrite is the editor I test the script with. :)

Share this post


Link to post
Share on other sites

Hi baoquocphan. You could use @SW_SHOWNOACTIVATE as the flag of GUISetState.

#include <WindowsConstants.au3>
GUICreate('test', Default, Default, Default, Default, $WS_POPUP)
GUISetState(@SW_SHOWNOACTIVATE)
Sleep(1000)
ConsoleWrite(WinGetTitle('') & @CRLF)
Sleep(3000)

Seems inactive initially and the active title returned by consolewrite is the editor I test the script with. :)

It work very well and exactly what I want. Thank you very much, MHz! :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0