I have a great problem......
I made my DLL with the MouseProc, but it function "sometimes"......
In the main program there are two long (x and y) which will contain the coordinates of the mouse when the Lbutton is being pressed. Since the mouse hook is ystem wide, the two coordinates are in the DLL, I pass to the DLL the addresses of x and y, (&x and &y) so I can save the coordinates in x and y.
I set the pointers with the function SetPoint, which copy the addresses of x and y in two long pointers in the DLL (*x and *y).
in the function GetCoord, called inside the MouseProc, I save the coordinates of the mouse with these instructions:
Well this code work if I press the mouse button inside the Dialog Box that my application creates, but if I press the mouse buton outside the Dialog Box, the coordinates "returned" are 0 and 0.Code:punto = (MOUSEHOOKSTRUCT *)lParam; h = punto -> pt.x; k = punto -> pt.y; ltoa (h, a, 10); ltoa (k, b, 10); MessageBox (NULL, a, b, MB_OK); *x = h; *y = k;
In the dialog box there are two buttons. The first button (-->) load the DLL in memory and load the Mouse hook. The second button (ESEGUI) shows a MessageBox whick shows me if the coordinates are in the main program, since it prints the values of x and y.
Someone can help me? I have attached the files of my program, so you can test it.
Thank you for your help and sorry about my english