Another problem swith my wide system MouseProc

This is a discussion on Another problem swith my wide system MouseProc within the Windows Programming forums, part of the Platform Specific Boards category; I have a great problem...... I made my DLL with the MouseProc, but it function "sometimes"...... In the main program ...

  1. #1
    Registered User
    Join Date
    Jun 2002
    Posts
    35

    Another problem swith my wide system MouseProc

    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:
    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;
    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.

    Why??

    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
    Attached Files Attached Files

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A sytem wide MouseProc
    By darcome in forum Windows Programming
    Replies: 5
    Last Post: 09-29-2002, 03:09 AM
  2. Number system base M, print numbers N digits wide...
    By biterman in forum C Programming
    Replies: 12
    Last Post: 11-19-2001, 04:31 AM
  3. problem with output
    By Garfield in forum C Programming
    Replies: 2
    Last Post: 11-18-2001, 08:34 PM
  4. System Hook Problem.
    By DutchStud in forum Windows Programming
    Replies: 0
    Last Post: 11-17-2001, 05:43 PM
  5. Big Code, Little Problem
    By CodeMonkey in forum Windows Programming
    Replies: 4
    Last Post: 10-03-2001, 06:14 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21