VBSCRIPT简单又很奇怪的Function相关问题
- VBScript code
Dim Shell, win, hWndSet Shell = CreateObject("Shell.Application")Set win = Shell.windowsDim ieset ie = GetfocusHwnd()Delay 3000MessageBox typename(ie) '为EMTPYFunction GetfocusHwnd() Dim i,hWnd hWnd = GetForegroundWindow() For i = 0 To win.count - 1 If win(i).hWnd = hWnd Then Set GetfocusHwnd = win(i) MessageBox typename(GetfocusHwnd)'为IWEBBROWER2 Exit For End If NextEnd Function [解决办法]
问题是啥?还要等着别人码字问问?
[解决办法]
这样呢
Dim Shell, win, hWnd
Set Shell = CreateObject("Shell.Application")
Set win = Shell.windows
Dim ie
set ie = win(GetfocusHwnd())
Delay 3000
MessageBox typename(ie) '为EMTPY
Function GetfocusHwnd()
Dim i,hWnd
hWnd = GetForegroundWindow()
For i = 0 To win.count - 1
If win(i).hWnd = hWnd Then
GetfocusHwnd = i
Exit For
End If
Next
End Function
[解决办法]
结贴啦
分不多