on 04-02-2015 3:02 AM
I want to run another powerbuilder application exe from our main application when a user clicks on a menu item
I've seen examples of the run and wait.
Will this work with another pb .exe
My goal is to force the user to close the launched .exe before returning the "launching application"
Thanks
Richard
Hi Richard;
We use a very simple way to achieve two messaging between PB program;
launched .exe:
SendMessage(hwn,WM_SETTEXT,0,ref msg)
or
Send(hwn,WM_SETTEXT,0,ref msg)
hwn =handle(textbox) from the original PB applicatio.
This will trigger the original PB applicatio a textbox event pbm_settext
So that it can be very flexible to achieve the desired effect.
Also just interested can look at it: http://scn.sap.com/thread/3722995
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
To run & wait you can use the WScript object:
lole_wsh = CREATE OleObject
li_rc = lole_wsh.ConnectToNewObject ("WScript.Shell")
IF li_rc = 0 THEN
li_rc = lole_wsh.Run (as_commandline, ai_windowstyle, ab_wait)
END IF
For more information: Run Method (Windows Script Host)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Richard;
Yes, this approach can be used successfully for what you want to accomplish. To make sure that the original PB application does not allow processing while the 2nd PB application is running, I would launch the "Run & Wait" from a Response window. I would have the Response window display a message to the user that it is "Waiting for Application XXX to complete". Being a response window, Application #1 should be modal at this point. Once Application #2 completes, the Run & Wait should be satisfied and it can now close the Response dialogue & reset the user's focus back to the application. The user should then be able to continue where they left off.
HTH
Regards .... Chris
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
or you use this free tool.
http://www.topwizprogramming.com/freecode_runandwait.html
This program shows how to execute other programs and wait for them to finish before continuing. Also shows how to automatically load a file into the program registered for that file type.
Win API Functions used:
CloseHandle
CreateProcess
ExpandEnvironmentStrings
GetExitCodeProcess
ShellExecuteEx
TerminateProcess
WaitForSingleObject
I use this and it works.
André Rust
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.