Page 1 of 1

Call a program

Posted: Tue Dec 02, 2003 12:00 am
by bonne
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

Posted: Tue Dec 02, 2003 1:22 am
by ricardo
bonne wrote:I have written programs which run but I cannot call them from menu or from another program. thank you for help. :roll:
From WHICH menu?

Windows start menu?

Do you want to run another program from the one that you coded?

Re: Call a program

Posted: Wed Dec 03, 2003 11:26 pm
by bonne
bonne wrote:I have written programs which run but I cannot call them from menu or from another program. thank you for help. :roll:
With WINDOW98
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.

Posted: Wed Dec 03, 2003 11:31 pm
by srod
Try the "RunProgram" command.

Posted: Sun Dec 07, 2003 1:53 am
by scurrier
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

Posted: Sun Dec 07, 2003 2:06 am
by Paul
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. :)