Dim flag
Dim hw, cnt
hw = FindWindow("CabinetWClass", "我的电脑")
MsgBox hw
cnt = FindWindowEx(hw, 0, "ToolbarWindow32", vbNullString)
MsgBox cnt我用这种方法找不到,不只到为什么
Dim hw, cnt
hw = FindWindow("CabinetWClass", "我的电脑")
MsgBox hw
cnt = FindWindowEx(hw, 0, "ToolbarWindow32", vbNullString)
MsgBox cnt我用这种方法找不到,不只到为什么
cnt = FindWindowEx(hw, 0, "WorkerW", vbNullString)
cnt = FindWindowEx(hw, cnt, "ReBarWindow32", vbNullString)
cnt = FindWindowEx(hw, cnt, "ToolbarWindow32", vbNullString)
cnt = FindWindowEx(hw, 0, "WorkerW", vbNullString)
cnt = FindWindowEx(hw, 0, "ReBarWindow32", vbNullString)
cnt = FindWindowEx(hw, 0, "ToolbarWindow32", vbNullString)
Private Sub Command1_Click()
Dim hwd As Long
hwd = FindWindow("CabinetWClass", "我的电脑")
Print hwd
hwd = FindWindowEx(hwd, 0, "WorkerW", vbNullString)
Print hwd
hwd = FindWindowEx(hwd, 0, "ReBarWindow32", vbNullString)
Print hwd
hwd = FindWindowEx(hwd, 0, "ToolbarWindow32", vbNullString)
Print hwd
End Sub在xp下通过其他系统可能要修改一下
=================================================
我用的是myspy,用这些工具抓出来的时候一般都是用十六进制显示的,但我上面的代码显示的是十进制的结果,你换算一下看看是不是这原因????
我要的是工具栏的,不是菜单栏的~~~~~
==================
工具栏是不是放那些“前进”、“后退”、“向上”之类图标按钮的地方???这个句柄可不能一概而论,如果你的电脑里有安装flashget、东方网译之类的软件,你会发现在我的电脑的查看菜单的工具栏选项下,会有flashget、东方网译的选项,如果你钩选了它们,那么在工具栏里也就会有flashget、东方网译各自的工具条了,而它们的类名很可能一样,但句柄却是不同的。这种情况下,我可以想得到的办法就是用EnumChildWindows和getclass一层一层地列举工具栏里的所有东西,再一个一个地判断是不是你想要的。不过我也没试过有空试试。
hw = FindWindowEx(hw, 0, "WorkerW", vbNullString)
cnt = FindWindowEx(hw, 0, "ReBarWindow32", vbNullString)'得到工具条容器
cnt1 = FindWindowEx(cnt, 0, "ToolbarWindow32", vbNullString)'得到第一个工具条
cnt2 = FindWindowEx(cnt, cnt1, "ToolbarWindow32", vbNullString)'得到第二个工具条
cnt3 = FindWindowEx(cnt, cnt2, "ToolbarWindow32", vbNullString)'得到第三个工具条
........
你要的是那个工具条啊??
再一个,你打开了几个"我的电脑",你要取的那个又是哪个呢?