按钮的点击操作

Const micLong = 3

Const micString = 8

Const micRef = 32768

Const BN_CLICK = 245

 

Set oExtern = CreateObject("Mercury.ExternObj")

 

oExtern.Declare micLong,"FindWindow","user32.dll","FindWindowA",micString,micString

oExtern.Declare micLong,"FindWindowEx","user32.dll","FindWindowExA",micLong,micLong,micString,micString

oExtern.Declare micLong,"PostMessage","user32.dll","PostMessageA",micLong,micLong,micLong,micRef+micLong

oExtern.Declare micLong,"SetActiveWindow","user32.dll","SetActiveWindow",micLong

 

hwndWindow = oExtern.FindWindow(vbNULLString,"hello")

 

hwndButton = oExtern.FindWindowEx(hwndWindow,0,vbNULLString,"确定")

 

oExtern.SetActiveWindow hwndWindow

 

oExtern.PostMessage hwndButton,BN_CLICK,0,0

 

Set oExtern = Nothing

posted @ 2012-07-08 17:39  dushuai  阅读(207)  评论(0编辑  收藏  举报