Results 1 to 5 of 5

Thread: [2005] How to send "Enter"

Hybrid View

  1. #1

    Thread Starter
    Hyperactive Member Ivenesco's Avatar
    Join Date
    Sep 2007
    Location
    Poland, Lublin
    Posts
    325

    [2005] How to send "Enter"

    How can I send to application "Enter", or other keys? I mean:
    Code:
    Dim hwnd As Int32 = FindWindow("Notepad", Nothing)
    If Not hwnd = 0 Then
          hwnd = FindWindowEx(hwnd, 0, "edit", Nothing)
          If Not hwnd = 0 Then
               SendMessage(hwnd, WM_PASTE, 0, 0)
          End If
    End If
    I won't "paste" something, but send key like "Enter" or "Esc".

  2. #2
    Hyperactive Member knxrb's Avatar
    Join Date
    Jul 2007
    Location
    United Kingdom
    Posts
    321

    Re: [2005] How to send "Enter"

    Code:
    SendKeys.Send("{ENTER}")
    Did I help you with your problem? If I did rate me by clicking here: Rate knxrb

  3. #3

    Thread Starter
    Hyperactive Member Ivenesco's Avatar
    Join Date
    Sep 2007
    Location
    Poland, Lublin
    Posts
    325

    Re: [2005] How to send "Enter"

    I need to send win mesasge, not use sendkeys (target window can be hidden).

  4. #4
    Hyperactive Member knxrb's Avatar
    Join Date
    Jul 2007
    Location
    United Kingdom
    Posts
    321

    Re: [2005] How to send "Enter"

    Make your window so that when it is 'hidden' it doesn't hide it completely.
    Make the window Top and Left greater than the screen size so it is offscreen.
    Then the user cannot see it, but it can still have SendKeys.Send("{}") sent to it.

    Example:
    Code:
    Dim intLeft As Integer = Screen.PrimaryScreen.Bounds.Width + 10
    Dim intTop As Integer = Screen.PrimaryScreen.Bounds.Height + 10
    
    Me.Left = intLeft
    Me.Top = intTop
    That will make it like this:
    Last edited by knxrb; Feb 25th, 2008 at 06:30 AM.
    Did I help you with your problem? If I did rate me by clicking here: Rate knxrb

  5. #5

    Thread Starter
    Hyperactive Member Ivenesco's Avatar
    Join Date
    Sep 2007
    Location
    Poland, Lublin
    Posts
    325

    Re: [2005] How to send "Enter"

    It's not a solution. If somebody is using PC at that moment, my app will take focus for a while. I need app. working hidden, without disturbing users (I wrote something like you described, but it's really wrong way to send keys to app.).

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