Call a program
Call a program
I have written programs which run but I cannot call them from menu or from another program. thank you for help. :roll:
Re: Call a program
From WHICH menu?bonne wrote:I have written programs which run but I cannot call them from menu or from another program. thank you for help. :roll:
Windows start menu?
Do you want to run another program from the one that you coded?
ARGENTINA WORLD CHAMPION
Re: Call a program
With WINDOW98bonne wrote:I have written programs which run but I cannot call them from menu or from another program. thank you for help. :roll:
I try to call my Purebasic Program from another Purebasic pgm. or from Purebasic Menu ( "CreateMenu") , with the help of the example in documentation.:
----
If OpenWindow(0, 100, 150, 195, 260, #pb_Window_SystemMenu, "PureBasic - Menu")
If CreateMenu(0, WindowID())
MenuTitle("File")
MenuItem( 1, "Prg 1")
MenuItem( 7, "&Quit")
EndIf
Repeat
Select WaitWindowEvent()
Case #PB_EventMenu
Select EventMenuID()
Case 1
; >>>>>HERE I CANNOT FIND WHAT TO WRITE TO CALL MY PUREBASIC PROGRAMM !!!!!
Default
MessageRequester("Info", "MenuItem: "+Str(EventMenuID()), 0)
EndSelect
Case #WM_CLOSE ; #PB_EventCloseWindow
Quit = 1
EndSelect
Until Quit = 1
EndIf
-------
thank you again. Regards.
Yes the run program will work, but the program you launch with runprogram will take over as the new program and you will loose the ability to use your parent app. try this I found it works much better
File$="calc.exe"
ShellExecute_(#NULL,"Open",File$,"","",#SW_SHOWNORMAL)
just make sure the File$ points to a program in the Path$ if not you have to include it's path example
calc.exe is in the Windows directory so you dont need it's path
but if you have a program on drive d:\ under a directory called my apps
then you need to do this
File$="D:\My Apps\File.exe"
D:\ is the drive it's located on
My Apps being the directoy it's in
File.exe being the file you want to call
hope this helps
Sean
File$="calc.exe"
ShellExecute_(#NULL,"Open",File$,"","",#SW_SHOWNORMAL)
just make sure the File$ points to a program in the Path$ if not you have to include it's path example
calc.exe is in the Windows directory so you dont need it's path
but if you have a program on drive d:\ under a directory called my apps
then you need to do this
File$="D:\My Apps\File.exe"
D:\ is the drive it's located on
My Apps being the directoy it's in
File.exe being the file you want to call
hope this helps
Sean
scurrier wrote:Yes the run program will work, but the program you launch with runprogram will take over as the new program and you will loose the ability to use your parent app
Your parent app only pauses execution if you set the RunProgram flag to 1 (which is "Wait until the launched program quits" if we look at the docs)
So it would be incorrect to say that the new program takes over unless you have specifically told it to.
