ACTIVE WINDOW - How to prevent title bar blue/grey change
I embedded a mode less property sheet in a dialog. I did not use a new window class for the control but did make the property sheet a child of a container in the dialog. Everything works fine except for one thing. When the user clicks on property sheet, the title bar of the dialog changes from blue (ACTIVE) to grey (INACTIVE); I'd like to keep the title bar of the dialog blue when the property sheet is active since the property sheet appears to be part of the dialog to the user. The property sheet does not have a title bar.
c++ win32api no mfc
开发者_开发百科Questions:
1) Is there some way to keep the dialog title bar blue when the property sheet is active?
2) Would it work differently if I used a new window class for the property sheet and added a control using that class to the dialog?
Many thanks to Sertac Akyus for his suggestion.
It looks like one of the property sheet's pages is active whenever the sheet is active, I.e. I have been unable to cause the property sheet's main dialog to be active. Thus you can use the WM_ACTIVATE message handlers in the dialogs for the pages to set the main dialog's title bar blue using WM_NCACTIVATE TRUE whenever a page becomes active. It's also necessary to set the main dialog's title bar grey using WMNCACTIVATE FALSE when the page deactivates UNLESS the window being activated in the main dialog.
Here's the code I used.
case WM_ACTIVATE:
switch LOWORD(wParam)
{
case WA_ACTIVE: // 1
case WA_CLICKACTIVE: // 2
SendMessage (hwndContainer,WM_NCACTIVATE,TRUE,NULL);
return true;
case WA_INACTIVE:
if ((HWND) lParam != hwndContainer)
{
SendMessage (hwndContainer,WM_NCACTIVATE,FALSE,NULL);
return true;
};
}
break;
hwndContainer is HWND of the dialog containing the property sheet.
Send me an email if you'd like a copy of my little property sheet in a dialog demo. mike.z.dorl@gmail.com
精彩评论