Sign in to follow this  
Followers 0
Holger

where comes "hWndParent" in Init() from

4 posts in this topic

Here is a part of the GUI-init:

void CGuiBox::Init(HINSTANCE hInstance, HWND hWndParent)
{
    // Store the instance (rather than using a global)
    m_hInstance     = hInstance;
    m_hWndParent    = hWndParent;

Now my question:

Where does the parameter hWndParent come from?

Yeah, you know, I'm asking myself so long why the gui starts not set active in the taskbar!?

So I tested changing the line in CreateGUI:

A = CreateWindowEx(Exstyle,AUT_GUICLASS,Caption,Style,X,Y,rect.right-rect.left,rect.bottom-rect.top,m_hWndParent,NULL,m_hInstance,NULL);

to

A = CreateWindowEx(Exstyle,AUT_GUICLASS,Caption,Style,X,Y,rect.right-rect.left,rect.bottom-rect.top,NULL,NULL,m_hInstance,NULL);

and the result was that the focus now works right.

Can anybody tell me for what the hWndParent is and why it is not defined?

I think at the moment it is undefined.

Or is there something again that I don't understand?

Thanks and regards

Holger :ph34r:

Share this post


Link to post
Share on other sites



The parent is AutoIt's window, I think (The hidden one). If a window doesn't have a parent, it can NEVER be removed from the taskbar (Except when the window is hidden via SW_HIDE). There are times where it is useful to have a visible window, but not one with a taskbar entry, thus, it's necessary that the GUI have a parent.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Yeah, it could maybe the hidden main-autoit-window cause I saw a call to this with the parameter "g_hWnd".

That is confusing...without this there is no problem and with the focus is not working. :(

I know there was a problem in the past with this hidden window but I can't find/ don't know anything more about this.

Maybe it could be possible to give the focus from the parent-window to the child window automatically...I don't know...really confusing :ph34r:

Thanks for your answer valik :lol:

Edit: I read that if the parent window is set to "NULL" then the desktop window becomes the new parent window!

I think thatswhy it works with NULL and interacts normally with the "desktop"-taskbar :lol:

Hmmm....

Or what if we use in CreateGUI():

if (Exstyle & WS_EX_APPWINDOW)
   A = CreateWindowEx(Exstyle,AUT_GUICLASS,Caption,Style,X,Y,rect.right-rect.left,rect.bottom-rect.top,NULL,NULL,m_hInstance,NULL);
else
   A = CreateWindowEx(Exstyle,AUT_GUICLASS,Caption,Style,X,Y,rect.right-rect.left,rect.bottom-rect.top,m_hWndParent,NULL,m_hInstance,NULL);

What interesting is (in the current unstable version too):

cause the mainwindow is normally hidden, if you minimize all desktop windows then sometimes the GUI will disappear when you click on the free desktop - I think it will 'move' to the hidden mainwindow :D (with "GUITaskbarEntry" set to "0")...

Edited by Holger

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

It's important for the cleanup code that the gui is a child of g_hWnd so that when DestroyWindow is called on AutoIt it's children are destroyed first.

The hidden main window causes loads of problems. I used to have it minimized but then it pops up at odd times. Currently it is simply hidden. Try disabling it too so that it can't have focus (even hidden windows can have focus...)

Edited by Jon

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