I know only one window can have the Keyboard focus at any one time.

Say you have a parent window that has Popup windows, e.g. a Floating Toolbar.

How do you keep the appearance of the parent window
in the active state (Title Bar, Menu) when you click
on the Popup window.

I know it can be done, because I've seen it on other applications.

I've tried putting the Popup window in it's own class,
in it's own thread, and in it's own process, but I still
lose the active state of the parent window when I click
on the Popup window.


Posted on 2001-10-04 15:30:20 by Ewayne
I dont know these things that well, but i remember reading a thread a while ago, where you would use the toolbar window style or'd with the popup style.

This way you get a Toolbar sytle window that doesnt take focus away from your parent application..

However, I could be completely wrong in your context...

Posted on 2001-10-04 16:53:13 by NaN
Thanks NaN,

Been there done that and it doesn't seen to make any difference.

The Popup window has the extended style
which is the Toolbars parent.

Posted on 2001-10-04 17:32:29 by Ewayne
You could try to send a WM_NCACTIVATE message to the window. I believe that's how captioned child windows can also be highlighted. Normally, when you select a control or window, the "parent-most" window gets activated and highlighted.

invoke SendMessage,hWnd,WM_NCACTIVATE,TRUE,NULL

Changing TRUE to FALSE unhighlights the title bar.
Posted on 2001-10-04 19:20:00 by tank
I had the same question about a year ago. I remember asking around but no one seemed to know. After a heavy research, I found out how to do that. It centers around WM_NCACITVATE and WM_ACTIVATEAPP. You have to respond to those messages "appropriately". Furthermore, you have to deal with them a bit differently in case the window is a dialog.

.elseif uMsg==WM_ACTIVATEAPP
invoke DefWindowProc,hWnd,WM_NCACTIVATE,wParam,0
.elseif uMsg==WM_NCACTIVATE
mov eax,TRUE
Posted on 2001-10-04 19:38:45 by Iczelion

I think Iczelion's approach is the authodox one to get the effect you are after but I have recently prototyped a different approach in PowerBASIC that can do the same thing but with a few more options like being able to place the title bar on the left side for very low profile windows.

It starts off as a window with no title bar at all, uses the WM_MOUSEMOVE/WM_LBUTTONDOWN/WM_LBUTTONUP messages to control the mouse co-ordinates, draws to title bar in the same area that you set the mouse co-ordinates and SetWindowPos to move the window from the title bar. It uses SetCapture while the window is being moved.

Main gain is that it allows you to set the title bar height you want and with the orientation you want.


Posted on 2001-10-04 19:52:58 by hutch--
Thanks Iczelion and Hutch,

Iczelion's approach works for my application,
because my Popup window does not have a Title bar.

I was on the right path, but I sent:

.elseif wMsg == WM_ACTIVATEAPP
INVOKE SendMessage, hWnd, WM_NCACTIVATE, 1, 0
mov eax, TRUE
.elseif wMsg == WM_NCACTIVATE
mov eax, TRUE

instead of:

.elseif wMsg == WM_ACTIVATEAPP
INVOKE DefWindowProc, hWnd, WM_NCACTIVATE, wParam, 0
.elseif wMsg == WM_NCACTIVATE
mov eax, TRUE

I will use your idea for future reference.


Thanks again.

Posted on 2001-10-04 20:20:17 by Ewayne