|
I used
hhook = SetWindowsHookEx(WH_MOUSE,MyHookProc,MyDLL,NULL);
but It's response only mouse over my app and nothing when outside
hhook,MyHookProc,MyDLL != NULL
Something wrong in my dll ?
Please Help me
Thank you so much
|
|
|
|
|
Window messages are forwarded to the window which contains the mouse hotspot, even though your application has focus. To partially override this behaviour, use the SetCapture() function. That way, if the left mouse button is down, mouse messages are forwarded to the windows that asked for the capture.
|
|
|
|
|
Hi,
Make sure you have the hook in a DLL.
Regards
Sameer
|
|
|
|
|
Yes. My dll have MouseProc (Named MyHookProc)
that I mention it above (hhook,MyHookProc,MyDLL != NULL)
and MyHookProc receive message when mouse over my app only instead of receive mouse message everywhere that it's gone.
Please help me
thank a lot
|
|
|
|
|
The problem is probably in your hookproc. The following hookproc code will emit a beep anytime the right mouse button is clicked.
if (nCode != HC_NOREMOVE
&& (wParam == WM_RBUTTONDOWN || wParam == WM_NCRBUTTONDOWN))
{
MessageBeep(1);
return (1);
}
return CallNextHookEx(ghKeyHook, nCode, wParam, lParam);
Cheers,
Tom Archer
Author, Inside C#
A total abstainer is one who abstains from everything but abstention, and especially from inactivity in the affairs of others.
|
|
|
|
|
No. Code in my MouseProc just increase count number only.
so when MouseProc receive mouse message it will increase it.
when my app run I use keyboard for control it only.
if my mouse over my app . my count is increase (MouseProc receive mouse message) but outside is not.
why ?
Please help me
thank you so much
|
|
|
|
|
I tested the code I posted so it should work for you. However, without seeing your code I (or anyone else) can't do anything but guess. Post the code for the mouseproc, the function that calls SetWindowHookEx and any global/shared variables so that we can see what's going on.
Cheers,
Tom Archer
Author, Inside C#
A total abstainer is one who abstains from everything but abstention, and especially from inactivity in the affairs of others.
|
|
|
|
|
My guess is that your variables are local to the dll, so each dll has a copy of counter and is incrementing it's own. You need to have a shared data segment. You also need this to share the global HHOOK value since every copy of the dll that is loaded needs to use the same value. I don't remember off the top of my head how to do this. I do remember it has to be in a section that all variables are initialized.
Joel Lucsy (jjlucsy@ameritech.net)
|
|
|
|
|
Hi I try to compile my project and it says this?
I dont know what it means. i guess the windows.h file or something, but i dont get it?
Can someone please help me
Thanksompiling...
DeltaGlider.cpp
c:\windows\desktop\orbiternew\orbitersdk\include\orbitersdk.h(12) : fatal error C1083: Cannot open include file: 'windows.h': No such file or directory
Error executing cl.exe.
DeltaGlider.obj - 1 error(s), 0 warning(s)
thats what i get.
Kevin
Im just learning! What can I say?
|
|
|
|
|
My guess is that instead of <windows.h> you have used "windows.h".
Replace the "s with the angle brackets
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
I trying to make my app run idle in the taskbar. When I look at the Task Manager my program always has 99% of the CPU. Yet other programs (like Windows Messanger or my virus scanner) sit at 0%. Do I need to mess with the priority? Can I some how cut out the message loop? Any information would be appriciated.
Thanks,
Chris
|
|
|
|
|
Your app is obviously working. Figure out what it is doing, stop it, and it will be idle.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
Well, all Im running is the message pump. (PeekMessage then TranslateMessage & DispatchMessage). Is there a safe way to stop the message pump ?
|
|
|
|
|
PeekMessage Does not block if the message queue is empty, use GetMessage instead.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Are you using GetMessage you in your message loop or PeekMessage?
Do you have more than one thread?
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
is there a way to send a variable in a function that is a table
i declare it x[10][10]
and send it in function(x[][]) like this or an other way
|
|
|
|
|
|
ok... hi all
ive bean kindof relient on Kilowatt. "sorry kilowatt"
now my question...
i want to random a number betwean 1-10.
i looked up rand()... automatically i thought that you could just put the number that you want to be randomized in the ().... like for example
rand(10)... that didnt work.
there is srand also...
why wont the rand(10) work... and, how do i work rand()?
Thanks all!
~SilverShalkin
|
|
|
|
|
Do a rand()%10 to generate a number between 0 and 9
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
i tried that....
cout << rand()%10 << endl;
this repeats 1..
Thanks
~SilverShalkin
|
|
|
|
|
Yes it will, because you havent srand'd first :-
srand((unsigned)time(null));
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
ok...
give me an example from head to toe, about required headers... srand, RAND_MAX, and rand().
because ive tried everything, and its still doesnt work.
~SilverShalkin
ps... #include <cstdlib> i think thats the header
|
|
|
|
|
#include "stdafx.h"
#include <stdlib.h>
#include <time.h>
int _tmain(int argc, _TCHAR* argv[])
{
srand((unsigned)time(NULL));
for(int i=0;i<10;i++)
printf("%d\n",rand()%10);
return 0;
}
My output :-
D:\Projects\test\Debug>test.exe
6
5
2
0
8
0
3
1
5
0
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
I am looking how to add agent support to my MFC app and i want the merlin character to load automatilcy without a Open Dialog.
CF
Buy ChrisBrand!
|
|
|
|
|