mouse pos 
Author Message
 mouse pos

i wan't to get the mouse position when i receive a WM_RBUTTONDOWN message in
VB. To do that in C++ i can use the LOWORD and HIWORD functions to retrieve
the low-order/high-order word from the lparam value. Is there any equivalent
function to LOWORD/HIWORD in Visual Basic.
Tony,

ICQ: 21264948
http://www.*-*-*.com/


Fri, 31 Aug 2001 03:00:00 GMT  
 mouse pos
Tony...

Quote:
>Is there any equivalent
>function to LOWORD/HIWORD in Visual Basic.

There are essentially two ways to do this -- with pure VB code, and with API
calls. I'll show both methods:

Pure VB:

Public Function LOWORD(lValue As Long) As Integer
If (lValue And &HFFFF&) > &H7FFF Then
   LOWORD = (lValue And &HFFFF&) - &H10000
Else
   LOWORD = lValue And &HFFFF&
End If
End Function

Public Function HIWORD(lValue As Long) As Integer
HIWORD = (lValue And &HFFFF0000) \ &H10000
End Function

With API:

Private Declare Sub CopyMemory Lib _
 "kernel32" Alias "RtlMoveMemory" _
 (Destination As Any, Source As Any, _
 ByVal Length As Long)

Public Function LOWORD(ByVal LongIn As Long) As Integer
Call CopyMemory(LOWORD, LongIn, 2)
End Function

Public Function HIWORD(ByVal LongIn As Long) As Integer
Call CopyMemory(HIWORD, ByVal (VarPtr(LongIn) + 2), 2)
End Function

--
Ben Baird, MVP
Visual Basic Thunder
http://www.{*filter*}highway.com/~psy/vbthunder/
Common Controls Replacement Project
http://www.*-*-*.com/
Please direct your programming questions to the newsgroups.



Fri, 31 Aug 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Determining Mouse pos over scrollbar?

2. Detecting Mouse Pos on other apps

3. Determining Mouse pos over scrollbar?

4. Determining Mouse pos over scrollbar?

5. Getting mouse pos

6. Can u read the mouse pos any time u want?

7. printing on POS printers

8. Generating next P.O. number

9. POS in Access??

10. Changing the start pos of the curser?

11. Get Caret Pos From TextBox

12. pos driver font problem with .Net graphics object

 

 
Powered by phpBB® Forum Software