Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long Private Sub Form_Load()Dim hw&, cnt& Dim rttitle As String * 256 'hw& = FindWindow(vbNullString, "QQ用户登录") ' ThunderRTMain under VB4 hw& = FindWindow("ThunderRT5Main", vbNullString)cnt = GetWindowText(hw&, rttitle, 255)MsgBox Left$(rttitle, cnt), 0, "消息"End Sub
谢谢。我用Private declare function winexec lib"kernel32" alias "winexec"(byval lpcmdline s string,byval ncmdshow as long) as long ncmdshow 设为sw_shownormal或 sw_restore即可。
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Sub Form_Load()Dim hw&, cnt&
Dim rttitle As String * 256
'hw& = FindWindow(vbNullString, "QQ用户登录") ' ThunderRTMain under VB4
hw& = FindWindow("ThunderRT5Main", vbNullString)cnt = GetWindowText(hw&, rttitle, 255)MsgBox Left$(rttitle, cnt), 0, "消息"End Sub
ncmdshow 设为sw_shownormal或 sw_restore即可。