How can I make my program can be displayed on other windows?
Let the user choose "Always on the top" It is best to join an option in the system menu. You can send the user's selection by modifying the WM_SYSCOMMAND message. The command ID (ID) of the menu is passed as a parameter to OnsysCommand (). Define the ID (ID), add the following code to CMAINFRAME.CPP:
#define WM_ALWAYSONTOP WM_USER 1
Add the "Total Top" menu item to the system menu, add the following code to the function cmainframe :: onCreate ():
CMenu * psysmenu = getSystemMenu (false);
Psysmenu-> appendmenu (mf_separator);
Psysmenu-> appendmenu (mf_string, wm_alwaysontop,
"& Alway on top");
With ClassWizard, add the processing of the WM_SYSCOMMAND message, you should change the message filter and use the system to handle this message.
Void CMAINFRAME :: OnSysCommand (uint nid, lparam lparam)
{
Switch (NID)
{
Case WM_ALWAYSONTOP:
IF (getExStyle () & WS_EX_TOPMOST)
{
SetwindowPos (& Wndnotopmost, 0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE);
GetSystemMenu (false) -> CheckMenuItem (WM_ALWAYSONTOP,
MF_unchecked);
}
Else
{
SetWindowPos (& Wndtopmost, 0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE);
GetSystemMenu (false) -> CheckMenuItem (WM_ALWAYSONTOP, MF_CHECKED);
}
Break;
DEFAULT:
CframeWnd :: OnSysCommand (NID, LPARAM);
}
}