|
-
Dec 26th, 2004, 11:59 AM
#1
Thread Starter
Lively Member
sendkeys to active window
Hi,
Does anyone have any idea why this only work in design and not from the exe ?
Option Explicit
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long
Public Sub RSPaste()
Dim sClipboardData As String
Dim iHwnd As Long
sClipboardData = Clipboard.GetText()
Clipboard.Clear
If sClipboardData <> vbNullString Then
Clipboard.SetText "wooo" & sClipboardData
Else
Clipboard.SetText "hoooo"
End If
iHwnd = FindWindowWild("*Visual Basic*", False)
If iHwnd <> 0 Then
SetForegroundWindow iHwnd
SendKeys ("^v")
End If
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|