- Getting incorrect window focus
- Posted by Tina on October 11th, 2005
I was wondering where my problem of getting incorrect focus could be
stemming from. Right now, I have two Windows. Window A is in the
foreground and Window B is directly behind it. I bring Window B to the
foreground by making a call to ::SetWindowPos( . . . ) and setting it
as the top most window and also making it non-windowed (i.e. full
screen). Unfortunately, when I attempt to click on something on Window
B, Window B APPEARS to lose focus and focus is transfered to Window A
behind it. For example, I click on a text field and the carat appears,
but when I try to type something in it, nothing comes out. I have tried
using ::SetForegroundWindow( . . . ) and ::SetFocus( . . . ) on Window
B before bringing it to the foregorund, but nothing seems to work.
Anyone have any idea what this problem could be? Thanks.
- Posted by Kellie Fitton on October 11th, 2005
Hi,
What happens when you try someThing like this:
SetWindowPos()
SetForegroundWindow()
OR,
SetWindowPos()
SetFocus()
Kellie.
- Posted by Tina on October 11th, 2005
Calls to
SetWindowPos
SetForegroundWindow
did the trick! Thanks again.
- Posted by Tina on October 12th, 2005
Recently, I decided to use the HtmlHelp API function to launch my Help
application instead of CreateProcess like I originally did and
SetWindowPos()/SetForegroundWindow() ceased to work anymore. The Help
application would get focus when it was behind my other window. Maybe
I'll just switch back to using CreateProcess.. Who knows.. Weird.
- Posted by Kellie Fitton on October 12th, 2005
Hi,
Are you handling the htmlHelp API properly?
pszFile = "MySample.chm";
HtmlHelp(NULL, pszFile, HH_DISPLAY_TOPIC, (DWORD) "MyFirst.htm");
HtmlHelp(NULL, NULL, HH_CLOSE_ALL, NULL);
You should pass the hwndCaller as a NULL argument so that HTML Help
displays the Help topic in the sibling mode, which causes the HTML
Help to display the Help topics in a separate top-level overLapped
help window, that is displayed alongSide the calling application,
which is the parent window.
Kellie.