Results 1 to 5 of 5

Thread: AppActivate & SendKeys

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2000
    Posts
    93
    Are there any API equivalents to these VB methods?

  2. #2
    Guest
    Use the SetForegroundWindow and the SendMessage API functions.


    Code:
    Private Declare Function SendMessage _
    Lib "user32" Alias "SendMessageA" (ByVal hwnd As _
    Long, ByVal wMsg As Long, ByVal wParam As Integer, _
    ByVal lParam As Any) As Long
    
    Private Declare Function SetForegroundWindow _
    Lib "user32" (ByVal hwnd As Long) As Long
    
    Private Const WM_SETTEXT = &HC
    
    
    Private Sub Command1_Click()
        SetForegroundWindow hwnd
        SendMessage hwnd, WM_SETTEXT, 0, ByVal "Text"
    End Sub

  3. #3
    Guest
    Actually not. The WM_SETTEXT method differents from SendKeys. The SendKeys function is actually a series of WM_CHAR messages, but using WM_SETTEXT is easier.

  4. #4
    Guest
    Thanks for sharing Megatron.
    So that's why the text comes out slowly like that?

    H|
    He|
    Hel|
    Hell|
    Hello|
    Hello |
    Hello W|
    Hello Wo|
    Hello Wor|
    Hello Worl|
    Hello World|


    Ah, so much free time .

  5. #5
    Guest
    Well, I haven't really noticed anything like that, but i'm not suprised if it does this.

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