Results 1 to 6 of 6

Thread: keybd_event

Hybrid View

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2001
    Posts
    52
    i want to simulate any key on the keyboard by pressing
    ie..i want to type the command on the text box and it should execute it.

    actually i need it to type command on another pc on a lan!!!


    Any ideas????
    Last edited by lxs; Feb 24th, 2001 at 06:22 AM.
    lxs

  2. #2
    Fanatic Member
    Join Date
    Sep 1999
    Location
    Bethel, North Carolina, USA
    Posts
    987
    Do you mean that when you press the command button you want EVERY single key pressed at the same time?
    {Insert random techno-babble here}

    {Insert quote from some long gone mofo here}

  3. #3
    Fanatic Member Mad Compie's Avatar
    Join Date
    Aug 2000
    Location
    Kuurne (Belgium)
    Posts
    553
    First, take a look to the code on your own pc! This recent thread gives you a solution by Lord Orwell.
    http://forums.vb-world.net/showthrea...threadid=56117

  4. #4
    Guest
    Here's how to press it on your PC (I'm not sure if it works over a LAN)
    Code:
    Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
    Private Const WM_KEYDOWN = &H100
    
    Private Sub Command1_Click()
        'Press the 'A' key
        PostMessage hwnd_of_window, WM_KEYDOWN, vbKeyA, 0
    End Sub

  5. #5

    Thread Starter
    Member
    Join Date
    Feb 2001
    Posts
    52

    keybd_event

    thanks...the code of virtual keyboard is great!
    i hav tried using the keybd_event fr passing commands to ms-dos command prompt but i am not able to do it...sendkeys also doesnt work!

    Also if i hav to do the code fr every key on the keyboard then it will take a long time as i hav to again simulate it on the other pc(i will type on 1 pc and it has to execute on other pc)! but will try! Pleas tell me if there is an easier option as i hav to work in limited hours of my college lab!
    thanks again,
    lxs

  6. #6
    Fanatic Member Mad Compie's Avatar
    Join Date
    Aug 2000
    Location
    Kuurne (Belgium)
    Posts
    553
    You'll have to use a remote session if you want to simulate keypresses on another machine.
    But don't ask me how, I never did it before.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width