2024年6月7日发(作者:)

怎样使窗口总是浮现在最上面

1.在CWnd::ModifyStyleEx()函数中加入WS_EX_TOPMOST状态参数;

2.这是个老问题,下面的代码将会对你有所启示

#include "Windows.h"

#pragma data_seg("shared")

HHOOK g_hHook = NULL;

HINSTANCE g_DllInst = NULL;

#pragma data_seg()

BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID

lpReserved)

{

g_DllInst = hInst;

return TRUE;

}

LRESULT CALLBACK GetMsgProc( int code,WPARAM wParam,LPARAM

lParam)

{

UINT nMsg = RegisterWindowMessage("Set foreground window");

MSG * pMsg;

HWND hWnd;

pMsg = (MSG *)lParam;

if(pMsg->message==nMsg)

{

hWnd = (HWND)pMsg->wParam;

OpenIcon(hWnd);

if(IsIconic(hWnd))

OpenIcon(hWnd);

else