Results 1 to 23 of 23

Thread: Fixed code, still need help tho... SIMULATE REAL KEYBOARD COMMANDS

Hybrid View

  1. #1
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Fixed code, still need help tho... SIMULATE REAL KEYBOARD COMMANDS

    Is this what you need, thegreatone?
    VB Code:
    1. Private Sub Command1_Click()
    2. Dim i%
    3.  
    4.     Shell "notepad", vbNormalFocus
    5.     Clipboard.Clear
    6.     With Text1
    7.         For i = 0 To Len(.Text) - 1
    8.             SendKeys Mid(.Text, i + 1, 1)
    9.         Next i
    10.     End With
    11.     SendKeys "^{c}"
    12.     SendKeys "^{v}"
    13.  
    14. End Sub

  2. #2
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Fixed code, still need help tho... SIMULATE REAL KEYBOARD COMMANDS

    i don't think he is talking about notepad. not sure what it is, though

  3. #3
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Fixed code, still need help tho... SIMULATE REAL KEYBOARD COMMANDS

    Quote Originally Posted by dglienna
    i don't think he is talking about notepad. not sure what it is, though
    ... then what would this mean? ...
    VB Code:
    1. Private Appnum As Long
    2. Private Sub Command1_Click()
    3.     Appnum = Shell("C:\WINDOWS\notepad.exe")
    4.     Timer2.Enabled = True
    5. End Sub

  4. #4
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Fixed code, still need help tho... SIMULATE REAL KEYBOARD COMMANDS

    BUT, when modified to open another app it DOES send the keys, BUT as the other app ONLY responds to real keyboard shortcuts how do i make it act as if it came from the keyboard ?

    AND

    ...same signal as the one runnin down the ps/2 port
    I wasn't sure what he meant, either.

  5. #5
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Fixed code, still need help tho... SIMULATE REAL KEYBOARD COMMANDS

    I guess we just have to wait until he responds ...

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Fixed code, still need help tho... SIMULATE REAL KEYBOARD COMMANDS

    You can use the keybd_event API to send keypreses or mouseclicks to
    a window that you can make active and focused.

    VB Code:
    1. Private Declare Sub keybd_event Lib "user32.dll" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, _
    2. ByVal dwExtraInfo As Long)
    An example at allapi.net

    HTH
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  7. #7

    Thread Starter
    Frenzied Member thegreatone's Avatar
    Join Date
    Aug 2003
    Location
    Oslo, Norway. Mhz:4800 x12
    Posts
    1,333

    Re: Fixed code, still need help tho... SIMULATE REAL KEYBOARD COMMANDS

    Sorry i took so long to reply, so far the closest thing to what i am trying to do is posted by robdog, BUT i am still far from acheiving what i am wanting to do.

    Ok, i am really trying to make this understandable, so here goes :

    When you press a key on your keyboard a signal is sent through the wire to the computer, i want a Visual Basic program to be able to simulate that exact thing. This program MUST be able to make the computer think a key is bieng pressed somehow, and the API and sendkeys features do not do this. Am i aiming far too high for a VB program ?
    Zeegnahtuer?

  8. #8
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Fixed code, still need help tho... SIMULATE REAL KEYBOARD COMMANDS

    Checkout the example (keyboard animation) for SetKeyboardState API here.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

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