Jump to content

problem with focus on GUI

Recommended Posts

So I don't know if anybody read this, so here are some deatils:


The Problem is that the GUI doesn't get the focus 'right'.

So I tested it with the changing of the lines in the Show()-function of the GUI-part to this:

// we need to show the GUI
ShowWindow(m_hWndGUI, SW_SHOW);

What I found in the guibox.cpp was confusing me:

// we need to show the GUI
ShowWindow(m_hWndGUI, SW_SHOW);
ShowWindow(m_hWndGUI, SW_SHOW);

So maybe there was overwritten a command!?

But I tested it with the changed lines and the GUI now also has the focus on the taskbar...

What do you think? :D

Link to post
Share on other sites
  • Administrators

The main autoit window is minimized and hidden and this seems to be causing some strangeness (the GUI is a child window).

I've just tried this and it seems to work:

SetForegroundWindow(m_hWndGUI);      // Seems to make the taskbar entry for the GUI active
  ShowWindow(m_hWndGUI, SW_SHOW);    // Show the window
  g_oSetForeWinEx.Activate(m_hWndGUI);  // After showing the GUI WinActive() to make sure it is active

SetForegroundWindow() is unreliable under 2000/XP so the WinActivate() version is used.

The double ShowWindow() lines were just a previous attempt to fix the problem based on some notes in the ShowWindow docs (the first call may be ignored) - but it didn't work.

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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...