Here, it is of course referring to a program to read the data of the data window in another program. Methods have a variety of methods, simple ways to deliver messages to the data window! Let's see this:
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)
FUNCTION
Power Script
RetrievePost (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 do not 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) POST (LL_DW_HANDLE, 1307, 0) APPEND ROWPOST (LL_DW_HANDLE, 1357, 0) POST (LL_DW_HANDLE, 1312, 0, 0 POST (LL_DW_HANDLE, 1315, 0, DW_1.ROWCOUNT () 1) POST (LL_DW_HANDLE, 1325, 0) INSERTROOST (LL_DW_HANDLE, 1357, 0, 0) POST (LL_DW_HANDLE, 1313, 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_HANDE, 1338 , 0, 0) POST (LL_DW_HANDLE, 1304, 0, 0) Saveas Dialog Post (LL_DW_HANDLE, 1338, 0) POST (LL_DW_HAND Le, 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)
Reprinted from: http://www.mycgigount.com/~unoksoftGroup/undocument/undocumented_powerbuilder.html
By testing, POST (LL_DW_HANDLE, 1305, 0, 0) can be discovered to bring the data window to pop up the Saves dialog box. After further test, the meaning of WPARAM and LPARAM parameters is: Saves Type and SaveFileName string, so We can use the send message to save the contents of the data window as a text file, and then read the file to get the data.
I am test code in the same PB program:
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)
The above program is only tested in the same process, but in Windows, a process cannot directly read the memory of another process, so if the above code is used directly between two programs, it will cause illegal operations. Therefore, you need to write a data window plug-in, but also need to do more, here it is recommended to use the DLL insertion (using the setWindowlong or hook) method to intercept the message of DW, you can do it for what you want. Since I don't do active operation, I will point here.