|
为了能捕捉到有程序启动、关闭、激活等消息,我用了以下代码。但这样会存在一个问题,就是打开文件夹时,文件夹里面的内容无法显示。请问是什么原因,或是能用别的什么办法捕捉到程序启动、关闭等消息吗?
HWND hWndTaskbarOld = FindWindow(L"HHTaskBar",NULL);
if(hWndTaskbarOld)
{
// 关闭系统自带的Taskbar(因为同一个时刻最多只能注册一个Taskbar)
SendMessage(hWndTaskbarOld,WM_DESTROY,NULL,NULL);
}
WNDCLASS wc;
wc.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
wc.lpfnWndProc = (WNDPROC)TaskbarWndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = g_hInst;
wc.hIcon = NULL;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = GetStockBrush(LTGRAY_BRUSH);
wc.lpszMenuName = NULL;
wc.lpszClassName = L"HHTaskBar";
// Register the window class and return success/failure code.
RegisterClass(&wc);
g_pTaskbar = CreateWindow(L"HHTaskBar", TEXT("HHTaskBar"), WS_POPUP,0, 0, 800, 26, NULL, NULL, g_hInst, NULL);
// 注册以便能捕捉到有程序启动、关闭、激活等消息
RegisterTaskBar(g_pTaskbar);
|
|