We help IT Professionals succeed at work.

error vb6 postmessage usage

jack niekerk
jack niekerk asked
on
listing in vb6 with errorTrying to get some calls running in VB6 to use Postmessage  Function
This is a call to the functions in a program wich now i can now only use bij shelling to commandline ,
like   Shell "J:\VIRT_KEYBORD\MOVETOPKB  ", vbHide
Utillity from  https://hot-virtual-keyboard.com/

According their on-site manal  should be possible to do like this


Const WM_CSKEYBOARD = &H400 + 192
Const WM_CSKEYBOARDMOVE = &H400 + 193
Const WM_CSKEYBOARDRESIZE = &H400 + 197
 
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hWnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, _
         ByVal lParam As Integer) As Integer



    'Move Hot Virtual Keyboard in Visual Basic; Move it first then show itresponse helpdesk    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) ' Handles Button3.Click
        Dim hWnd As Integer
        hWnd = FindWindow("TFirstForm", "hvkFirstForm")
        PostMessage(hWnd, WM_CSKEYBOARDMOVE, 200, 200)
        PostMessage(hWnd, WM_CSKEYBOARD, 1, 0)
    End Sub

But calls to postmessga gives in Editor red syntax status
Support desk from supplier could not help me out on this

please see the attachd file from program listing and response helpdesk wich does not sove my problem

Thanks for help
Comment
Watch Question

Software Team Lead
Commented:
try put "Call" in front of the PostMessage?

like:

Call PostMessage(hWnd, WM_CSKEYBOARD, 2, 0)

Open in new window


or call it like this way instead:

PostMessage hWnd, WM_CSKEYBOARD, 2, 0

Open in new window

Author

Commented:
Thanks!
this did it  
 try put "Call" in front of the PostMessage?

regards Jack

Author

Commented:
i forgot a part of the error see new posted reqeust pleaase
thanks

Author

Commented:
to set it all to registry

Author

Commented:
hello ,  i run in a other problem
all above runs perfect on windows 7 (tested on that one)

now running on the destenation station  Windows-10 pro

all these routines  give no error  but also no effect

Case 1
        'Open/show Hot Virtual Keyboard
        hWndvirt = FindWindowb("TFirstForm", "hvkFirstForm")
        Call PostMessage(hWndvirt, WM_CSKEYBOARD, 1, 0)
       
  Case 2
        'Move Hot Virtual Keyboard ; Move it first then show it
        hWndvirt = FindWindowb("TFirstForm", "hvkFirstForm")
        Call PostMessageb(hWndvirt, WM_CSKEYBOARDMOVE, 200, 650)
        Call PostMessageb(hWndvirt, WM_CSKEYBOARD, 1, 0)
 
Looks like VB^on a Windows-10 situation
thus sofar al work for nothing

any idea???
regards jack
Ryan ChongSoftware Team Lead

Commented:
hWndvirt = FindWindowb("TFirstForm", "hvkFirstForm")

sorry as I can't replicate and test it at my local. perhaps you should open a new question so other experts could assist?

Author

Commented:
Thanks , best regards