Help me with Sendmessage() and ScreenToClient api calls from VB 
Author Message
 Help me with Sendmessage() and ScreenToClient api calls from VB

I know it's bad...  but I have been whackin at this off and on for two or
three months with no luck.

I am trying to send a double click via SendMessage() API call.  I am using
ScreenToClient() to translate the screen coordinates into coordinates
relative to desired window.

The problem with the below code is that ScreenToClient and SendMessage are
returning values signifying that they have failed to execute.   Mpos (my x/y
pointapi) is not being changed by ScreenToClient.  SendMessage simply does


       X As Long
       Y As Long
End Type
Type ConvertPOINTAPI
    xy As Long
End Type

Declare Function ScreenToClient Lib "User32" (HWND As Long, LPPOINT As
POINTAPI) As Boolean
Declare Function GetCursorPos Lib "User32" (LPPOINT As POINTAPI) As Long
Declare Function FindWindow Lib "User32" Alias "FindWindowA" (ByVal
lpClassName As Long, ByVal lpWindowName As String) As Long
Declare Function SendMessage Lib "User32" Alias "SendMessageA" (ByVal HWND
As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Any) As

    Dim mpos As POINTAPI
    Dim R As Integer
    Dim DirHwnd As Long
    Dim p As ConvertPOINTAPI

    Call GetCursorPos(mpos)
    Debug.Print mpos.X
    Debug.Print mpos.Y

    DirHwnd = FindWindow(0, "MouseClick Simulator")
    Debug.Print DirHwnd
    Debug.Print ScreenToClient(DirHwnd, mpos)
    LSet p = mpos
    Debug.Print mpos.X
    Debug.Print mpos.Y

    R = SendMessage(DirHwnd, WM_LBUTTONDBLCLK, 0, p.xy)
    Debug.Print R

Sat, 13 Jan 2001 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Help with SendMessage API call

2. Need help with API Call for SendMessage.

3. Help with Sendmessage API Call in VB5

4. Help with Sendmessage API Call in VB5

5. SendMessage API Call in .NET

6. How to call the SendMessage API

7. SendMessage/CopyMessage API Calls

8. VB5-PRO: SendMessage API Call not Working...Why?

9. SendMessage Win API call fails in 4.0

10. SendMessage API call

11. SendMessage API-call

12. Other Uses for SendMessage API call???


Powered by phpBB® Forum Software