|
▼勉強中 さん:
メモ帳の例です。
このまま実行しても良いです。
Option Explicit
Private Declare Function FindWindow Lib "user32" _
Alias "FindWindowA" _
(ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32" _
Alias "FindWindowExA" _
(ByVal hWndParent As Long, _
ByVal hWndChildAfter As Long, _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Private Declare Function SendMessage Lib "user32" _
Alias "SendMessageA" _
(ByVal hWnd As Long, _
ByVal Msg As Long, _
ByVal wParam As Long, _
lParam As Any) As Long
Private Const WM_SETTEXT = &HC
Private Declare Sub Sleep Lib "kernel32" _
(ByVal dwMilliseconds As Long)
Sub TESTa()
Dim pID As Long
Dim lngRtn As Long
Dim hWnd1 As Long
Dim hWnd2 As Long
Dim strA As String
pID = Shell("Notepad.exe", vbNormalFocus)
While hWnd1 = 0
hWnd1 = FindWindow("Notepad", "無題 - メモ帳")
Sleep 1
Wend
hWnd2 = FindWindowEx(hWnd1, 0, "edit", vbNullString)
strA = "TEST"
lngRtn = SendMessage(hWnd2, WM_SETTEXT, 0, ByVal strA)
End Sub
|
|