|
发表于 2019-1-11 22:09
来自手机
|
显示全部楼层
本帖最后由 lss001 于 2019-1-21 10:16 编辑
美好未来686 发表于 2019-1-11 10:05
s = String(10, Chr(0))
明白了 我已经搞定了,s=split(s," ")(0)
Private Declare Function GetForegroundWindow Lib "user32" () As Long
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" _
(ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Sub hqckbt() '获取窗口标题
Dim k As Long, s As String * 255
Shell "notepad.exe", 2'打开记事本
Application.Wait Now + TimeSerial(0, 0, 2)
k = GetForegroundWindow()
GetWindowText k, s, Len(s)
Shell "taskkill /f /im notepad.exe"'关闭记事本
MsgBox "窗口标题: " & s
End Sub |
评分
-
1
查看全部评分
-
|