jeudi 4 septembre 2014

How can a window eta my subclass's message?


Vote count:

0




I am developing a program which work in Microsoft Word, I have subclass a Office Windows and catch the WM_LBUTTONDOWN & WM_LBUTTONUP message, while I catch a WM_LBUTTONDOWN message, I eat it , but while I catch a WM_LBUTTONUP message, I post a couple of WM_LBUTTONDOWN & WM_LBUTTONUP message to myselft, but what make me surprised is that I only catch a WM_LBUTTONDOWN message. (no WM_LBUTTONUP message anymore).so I Try:


1.check the message by peekMessage() when i recieve a WM_LBUTTONDOWN message.



PeekMessage(&msg, hWnd, WM_LBUTTONUP, WM_LBUTTONUP, PM_NOREMOVE);
if (msg.message == WM_LBUTTONUP && msg.hwnd == hWnd)
OutputDebugString(L"peek msg has button up\n");

LRESULT res = CallWindowProc((WNDPROC)oldProc, hWnd, message, wParam, lParam);
MSG msg2;
PeekMessage(&msg2, hWnd, WM_LBUTTONUP, WM_LBUTTONUP, PM_NOREMOVE);

if (msg2.message == WM_LBUTTONUP && msg2.hwnd == hWnd)
OutputDebugString(L"after callWndProc peek msg has button up\n");
else
OutputDebugString(L"after callWndProc peek msg no button up\n");


the result prove that the WM_LBUTTONUP message is still in the message queue before and after the CallWindowProc().


2.Ensure the default winProc point to my proc function. so when i receive a WM_LBUTTONDOWN message, after the CallWindowProc(). I have following codes:



LONG proc = GetWindowLong(hWnd, GWL_WNDPROC);
if (proc != (LONG)&NewWndProc)
OutputDebugString(L"proc has been changed!\n");
else
OutputDebugString(L"proc has not been changed!\n");


the result show that the "proc has not been changed!".


Wow.I really don't know why the message WM_LBUTTONUP didn't post to myself, Is that any way to find out what has been done to the message WM_LBUTTONUP?



asked 1 min ago

Chen

56






How can a window eta my subclass's message?

Aucun commentaire:

Enregistrer un commentaire