首页 > 开发 > 综合 > 正文

如何编写一个能读取Powerbuilder的数据窗口中数据的程序

2024-07-21 02:10:00
字体:
来源:转载
供稿:网友

这里当然指一个程序读取另一个程序中数据窗口的数据。设想的方法有多种,简单的方法是向数据窗口传递消息啦!先看看这个:

how to manipulate datawindow without using datawindow functions.
// i test only on powerbuilder 6.5 build 444long ll_dw_handlell_dw_handle = handle(dw_1)
functionpower scriptretrievepost(ll_dw_handle, 1306, 0, 0)post(ll_dw_handle, 1320, 0, 0)scrollnextpagepost(ll_dw_handle, 1318, 0, 0)scrollpriorpagepost(ll_dw_handle, 1319, 0, 0) scrolltofirstpagepost(ll_dw_handle, 1315, 0, 1) // 1 = first row?scrolltolastpagepost(ll_dw_handle, 1315, 0, 99999999) // 99999999 = last page ? pb6 programmer don't know how to get the last page :)sort dialogpost(ll_dw_handle, 1309, 0, 0) filter dialogpost(ll_dw_handle, 1311, 0, 0) deleterowpost(ll_dw_handle, 1357, 0, 0) post(ll_dw_handle, 1307, 0, 0) append rowpost(ll_dw_handle, 1357, 0, 0)post(ll_dw_handle, 1312, 0, 0)post(ll_dw_handle, 1315, 0, dw_1.rowcount() + 1)post(ll_dw_handle, 1325, 0, 0)insertrowpost(ll_dw_handle, 1357, 0, 0)post(ll_dw_handle, 1313, 0, 0)post(ll_dw_handle, 1312, 0, dw_1.getrow())post(ll_dw_handle, 1315, 0, dw_1.getrow())post(ll_dw_handle, 1325, 0, 0)updatepost(ll_dw_handle, 1357, 0, 0)post(ll_dw_handle, 1338, 0, 0)post(ll_dw_handle, 1304, 0, 0) saveas dialog post(ll_dw_handle, 1338, 0, 0)post(ll_dw_handle, 1305, 0, 0) printpost(ll_dw_handle, 1303, 0, 0)retrieve (yield)post(ll_dw_handle, 1306, 1, 0)post(ll_dw_handle, 1320, 0, 0)cancelpost(ll_dw_handle, 1320, 0, 0)

转载自:http://www.mycgiserver.com/~unoksoftgroup/undocumented/undocumented_powerbuilder.html

通过测试发现使用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_dw_handlell_dw_handle = handle(dw_1)string ss="c:/111.txt"sndmsg(ll_dw_handle, 1305, 2, s)

如果要编写一个数据窗口外挂程序,只要得到数据窗口的句柄就可以了,我就点到这里为止了。
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表