控制另一个程序里的数据窗口

来源:互联网 发布:颐和园结局 知乎 编辑:程序博客网 时间:2024/06/05 10:15

控制另一个程序里的数据窗口

通过测试发现使用Post(ll_dw_handle, 1305, 0, 0) ,可以使数据窗口弹出saveas的对话框,经过进一步的试验,发现wparam和lparam参数的含义分别是 :saveas type和 savefilename字符串的地址,所以我们就可以使用发送消息的方式使数据窗口内容保存为文本文件,然后读取文件就可以获取数据了。 
  我在pb程序中的测试代码: 
  Function integer SndMsg(long hWnd, long uMsg, long wp, & 
   ref string filename) library “user32.dll” Alias For “SendMessageA” 
  long ll_handle 
  ll_handle = handle(dw_1) 
  string s 
  s=”c:\111.txt” 
  SndMsg(ll_dw_handle, 1305, 2, s) 
如果要编写一个数据窗口外挂程序,只要得到数据窗口的句柄就可以了。 
以下为消息对应的Datawindow命令(网上搜索的资料)

FunctionPower scriptRetrievePost(ll_handle, 1306, 0, 0)-Post(ll_handle, 1320, 0, 0)Retrieve (yield)Post(ll_handle, 1306, 1, 0)-Post(ll_handle, 1320, 0, 0)ScrollNextPagePost(ll_handle, 1318, 0, 0)ScrollPriorPagePost(ll_handle, 1319, 0, 0)ScrollToFirstPagePost(ll_handle, 1315, 0, 1)ScrollToLastPagePost(ll_handle, 1315, 0, 999999)Sort DialogPost(ll_handle, 1309, 0, 0)Filter DialogPost(ll_handle, 1311, 0, 0)Append RowPost(ll_handle, 1357, 0, 0)-Post(ll_handle, 1312, 0, 0)-Post(ll_handle, 1315, 0, 999999)-Post(ll_handle, 1325, 0, 0)InsertRowPost(ll_handle, 1357, 0, 0)-Post(ll_handle, 1313, 0, 0)-Post(ll_handle, 1312, 0, 1)-Post(ll_handle, 1315, 0, 1)-Post(ll_handle, 1325, 0, 0)DeleteRowPost(ll_handle, 1357, 0, 0)-Post(ll_handle, 1307, 0, 0)UpdatePost(ll_handle, 1357, 0, 0)-Post(ll_handle, 1338, 0, 0)-Post(ll_handle, 1304, 0, 0)SaveAs DialogPost(ll_handle, 1338, 0, 0)-Post(ll_handle, 1305, 0, 0)PrintPost(ll_handle, 1303, 0, 0)CancelPost(ll_handle, 1320, 0, 0)
原创粉丝点击