Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing Parameters (or Such) prior to 'My.Exe' Excecuting? 1

Status
Not open for further replies.

Docpro777

Programmer
Joined
Jul 1, 2003
Messages
105
Location
US
I'm trying to make several SHORTCUTs (desktop) to cause one .EXE file to perform differently as per each situation:

(Currently I replicate My.Exe with My2nd.Exe (My3rd.Exe ...etc.) and use the SYS(16,1) calling program function to differentiate. This is too much memory)

I've thought about:
1) running dos command shortcuts to somehow pass a parameter or something
2) create specific temp file(s) or something via a dos command (.bat file) that then launches My.exe that searches for this temp file (and then erases)

Any ideas would be appreciated

Philip M. Traynor, DPM
 
You can indeed pass a parameter to your compiled application...just put a Parameters line at the beginning of your Main.prg (or whatever you have set as MAIN). Then pass in the parameter. It might be helpful if you could explain a little more about why you felt such a requirement as renaming your exe's was necessary as it may shed some light on what would be the best solution to your problem.

Slighthaze = NULL
craig1442@mchsi.com
"Whom computers would destroy, they must first drive mad." - Anon​
 
Renaming an exe is a temporary work-around.

I need to be able to launch some specific routine(s) that are within my.exe.

a parameter for mycustomer list
a parameter for myappointments today

etc.

..while remaining within the exe.

Perhaps I'll try your parameter idea in main.prg and run compile new separate .exe s (if possible) to invoke specific routines from the desktop.



Philip M. Traynor, DPM
 
I'd use the parameter scheme.

That way, if no parameters are passed in, the application
will just run in normal mode - or - maybe the other way
around :-)

Darrell
 
Problem solved Slighthaze and Darrell, (Halleluiah):
I compiled one separate 'MyShortcut.exe' (just 23 kbytes) with the following code in a single main.prg:
****************************
a=SYS(16,1)
lno=1
lpos=1
DO WHILE lpos>0
lPositionLast=lPos
lPos=AT("\",a,lno)
lno=lno+1
ENDDO
a=RIGHT(a,LEN(a)-lPositionLast)
a=LEFT(a,AT(".",a)-1)
DO My.exe WITH a
****************************
Of course there's a parameter statement at beginning of main.prg in 'My.exe' that converts the parameter into a public vaiable.

The beauty is: now I can change my parameter string without coding nor compiling other .exe files. The parameter string becomes ANY TITLE of the .EXE FILE ITSELF (which can be cloned and renamed in Explorer).

Now I can call subroutines within 'My.exe' without going launching My.exe to point and click needlessly.


Philip M. Traynor, DPM
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top