|
|
I think you asked these questions and you get answers.
|
|
|
|
|
I want to hook the WM_MOUSEWHEEL msg in globel and identify whether it is scroll in or scroll out by 'zDelta', but the 'zDelta'(below) always seem to be zero. Can any one help me.
Thanks!
extern "C" _declspec(dllexport) LRESULT WINAPI MouseProc(int nCode,WPARAM wParam,LPARAM lParam)
{
if(nCode < 0)
return CallNextHookEx(g_hHook,nCode,wParam,lParam);
if(nCode == HC_ACTION)
{
switch(wParam)
{
case WM_MOUSEWHEEL:
short zDelta = (short)HIWORD(wParam);
break;
...........
default:
return CallNextHookEx(g_hHook,nCode,wParam,lParam);
}
}
}
|
|
|
|
|
Michael ZY wrote: extern "C" _declspec(dllexport) LRESULT WINAPI MouseProc(int nCode,WPARAM wParam,LPARAM lParam)
I'm not sure why zdelta would be zero all the time.
Is "extern "C" the same linkage as __stdcall?
The hook func needs to be __stdcall.
try
extern _declspec(dllexport) LRESULT CALLBACK WINAPI MouseProc(int nCode,WPARAM wParam,LPARAM lParam)
Mark
|
|
|
|
|
Thanks for reply, but still not Work.
i hooked other mouse msg like WM_LBUTTONDOWN are all fine.
Is that use the WH_MOUSE can not identify wheel scroll direction (need WH_MOUSE_LL?)
what i use now is:
g_hHook=SetWindowsHookEx(WH_MOUSE,MouseProc,g_hInstance,0);
|
|
|
|
|
I see it.
short zDelta = (short)HIWORD(wParam);
won't work. wParam is WM_MOUSEWHEEL, not the wheel delta
extern "C" _declspec(dllexport) LRESULT WINAPI MouseProc(int nCode,WPARAM wParam,LPARAM lParam){
if(nCode < 0)
return CallNextHookEx(g_hHook,nCode,wParam,lParam);
if(nCode == HC_ACTION)
{
switch(wParam)
{
case WM_MOUSEWHEEL:
short zDelta = (short)HIWORD(wParam);
break;
default:
return CallNextHookEx(g_hHook,nCode,wParam,lParam);
}
}
return CallNextHookEx(g_hHook,nCode,wParam,lParam);
}
I can't find how to get the wheel delta in a hook proc LOL I'll let you know when/if I do!
Mark
|
|
|
|
|
|
Got it!
Thanks a lot Mark!
Use the code like this:
case WM_MOUSEWHEEL:
{
typedef struct
{
MOUSEHOOKSTRUCT MOUSEHOOKSTRUCT;
DWORD mouseData;
}MOUSEHOOKSTRUCTEX,*PMOUSEHOOKSTRUCTEX;
MOUSEHOOKSTRUCTEX *MHSEX;
MHSEX=(MOUSEHOOKSTRUCTEX*)lParam;
if(MHSEX->mouseData==(WHEEL_DELTA<<16))
AfxMessageBox("up");
if(MHSEX->mouseData==(-WHEEL_DELTA<<16))
AfxMessageBox("down");
}
break;
|
|
|
|
|
I need to catch every keyboard event before operation system ( windows xp ) does.
What i mean is in case user click on key 'enter' ( or every other key ) my application need to check if the key is 'X' key - and in any case this key event need to continue as key event to the operation system.
I'm sure there is some win32 API function to do it - but i don't remember it.
Someone can help me ?
Thanks.
|
|
|
|
|
Yanshof wrote: I need to catch every keyboard event before operation system ( windows xp ) does.
Yanshof wrote: I'm sure there is some win32 API function to do it - but i don't remember it.
Do you see a contradiction between those 2 sentences??
|
|
|
|
|
Sorry ... but i don't see any contradiction.
I need some way to catch keyboard event - something like keyboard logger.
I did not found something useful in Google until now.
Thanks for any help.
|
|
|
|
|
Hi! Will this [^]help?
--------------------------------------------------------------------
If you need a hammer get C and shut up. If you need a nail gun get C++ and shut up. If you don't need *those* things (and good design should tell you) then by all means get a factory, factory, factory.
--code-frog@codeproject
|
|
|
|
|
Why do not use the Hook in the code and beside this - why thay use in this example DLL ?
|
|
|
|
|
Hi All,
I need to use the class wincrypt.h with some of my application that i writing.
I try to compile the application but all the object and function of this class is are not recognize by my compiler.
I even try to get demo application from here :
http://www.codeproject.com/cpp/cryptest.asp[^]
but my compiler repeat the message "undeclared identifier".
Some one can help me ?
Thanks.
|
|
|
|
|
What is the error you are getting?
|
|
|
|
|
Unidentified of the function and variables of this library.
cryptest\md5capi.cpp(47) : error C2065: 'HCRYPTPROV' : undeclared identifier
cryptest\md5capi.cpp(47) : error C2146: syntax error : missing ';' before identifier 'hCryptProv'
cryptest\md5capi.cpp(47) : error C2065: 'hCryptProv' : undeclared identifier
cryptest\md5capi.cpp(48) : error C2065: 'HCRYPTHASH' : undeclared identifier
cryptest\md5capi.cpp(48) : error C2146: syntax error : missing ';' before identifier 'hHash'
cryptest\md5capi.cpp(48) : error C2065: 'hHash' : undeclared identifier
cryptest\md5capi.cpp(55) : error C2065: 'CryptAcquireContext' : undeclared identifier
cryptest\md5capi.cpp(56) : error C2065: 'PROV_RSA_FULL' : undeclared identifier
cryptest\md5capi.cpp(56) : error C2065: 'CRYPT_VERIFYCONTEXT' : undeclared identifier
cryptest\md5capi.cpp(56) : error C2065: 'CRYPT_MACHINE_KEYSET' : undeclared identifier
cryptest\md5capi.cpp(59) : error C2065: 'CryptCreateHash' : undeclared identifier
cryptest\md5capi.cpp(60) : error C2065: 'CALG_MD5' : undeclared identifier
cryptest\md5capi.cpp(63) : error C2065: 'CryptHashData' : undeclared identifier
cryptest\md5capi.cpp(66) : error C2065: 'CryptGetHashParam' : undeclared identifier
cryptest\md5capi.cpp(66) : error C2065: 'HP_HASHVAL' : undeclared identifier
cryptest\md5capi.cpp(89) : error C2065: 'CryptDestroyHash' : undeclared identifier
cryptest\md5capi.cpp(90) : error C2065: 'CryptReleaseContext' : undeclared identifier
|
|
|
|
|
Looks like you have forgot to include a header file in your project. Search the header files for the definition of HCRYPTPROV, than add the #include statement to the top of your md5capi.cpp file.
|
|
|
|
|
I did not forgat include this file.
This is the first thing that i check - and its not it.
|
|
|
|
|
Did you include Wincrypt.h?
|
|
|
|
|
|
I see this program and compile it,it doesnt show any error to me Im using Vs2003
|
|
|
|
|
But i using Vs6....
Someone can help me here ?
I dont have any clue how to fix this problem.
|
|
|
|
|
See this[^] site I think its helpful for you
|
|
|
|
|
Yanshof wrote: but my compiler repeat the message "undeclared identifier".
Have you read through the message board on that article? You will need to install the latest SDK from Microsoft, Windows® Server 2003 R2 Platform SDK Full Download[^] the referenced header was not shipped with VS 6.0.
I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:
|
|
|
|
|
It's hard to tell if my code is at fault or my graphics card just isn't fast enough, but I'm having some serious flickering issues. I have skinned a window (again), but this time I have enabled resizing. The skin has rounded corners, so as we all know we have to call SetWindowRgn() to create a rounded window.
Problem is, when calling this from WM_SIZE and when the size is being expanded, for a split second it appears as if the window region is moved but not expanded causing a flicker across the bottom and/or left border. This only happens when the top or left borders are being dragged.
I have noticed the same problem with the explorer windows, which are also rounded. But the window appears to rectify itself much faster than my bitmap heavy window.
Has anybody else come across a similar problem and/or managed to resolve it or reduce the flickering? Also, please try doing the same with an explorer window and let me know if you also notice a flicker.
|
|
|
|