Sign in to follow this  
Followers 0
Toppoint

Question for GUICreate

4 posts in this topic

Hello everybody.

I hope you can help me. Its only a small problem.

I would like to create a special GUI.

The window, that i will create should be not active.

Example: The script is starting and creates a GUI. Normally the focus is on it and the current window is out of the focus. The label on the bar is grey and not active, because the created GUI of the autoit script (compiled) is on focus after starting. Thats normal. Each program is normally active.

But i want to open a window without that focus. You know what i mean ? The old window should be active and not the new opened one from the autoit script (compiled or not compiled is not important)

For example: I working with the notepad. I type something ...

The script is starting after some time and is opening a window as topmost. (THATS not a problem)

But this window is then active and the notepad window is inactive until i click on it. I want the new window of the autoit script as topmost and inactive but visible.

I hope you can help me with this small problem. I dont find a solution. I have tried it like that:

$hGUI2 = GUICreate("Test", 250, 250, $pos[0], $pos[1], 1, $WS_EX_TOPMOST + $WS_DISABLED + $WS_EX_TOOLWINDOW , $hGUI1)

It shows the window as topmost but active.

Maybe you can help me. Thank you. (Excuse my english.)

Best regards,

Toppoint

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

This is a possible solution (The created GUI get focus for a couple of ms though)

$title=WinGetTitle("")
GUICreate("Hello")
GUISetState()
WinActivate($title)

Edit: Fixed syntax error

Edited by monoceres

Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

When your script runs, the GUI is "built" behind the curtain, so to speak, and is not visible until you do GuiSetState(), which will make it active, as you say.

But, GuiSetState() will take parameters for other states, i.e. @SW_SHOWNA

$hGUI = GUICreate("Test", 200, 200)
$ctrlButton = GUICtrlCreateButton("Close", 50, 150, 100, 30)
GUISetState(@SW_SHOWNA)

While 1
    If GUIGetMsg() = $ctrlButton Then Exit
WEnd

:D

Edit: Typo in state macro name.

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Hello.

Thank you very much for your fast reply.

I have tested your examples and i think the best way is the winactivate solution.

For example: The notepad window will be activated while the autoit script starts. Its the topmost window and the focus is not on it. Perfect.

It works very fine.

You are great.

:D

regards,

Toppoint

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