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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OpenDialog inerferes with CreateProcess

Status
Not open for further replies.

samoff

Programmer
Aug 16, 2000
15
0
0
GB
I have an app that selects files and uses each as the parameter for a DOS program (don't ask me why). I'm using CreateProcess to lauch the DOS prog.
Oddly, when OpenDialog is used to select files from any directory other than the Apps own dir, CreateProcess fails. Very-oddly, if you select files from the Apps own directory, everything's fine.

Anyone come across this? Know a workaround?

Thanks for your time.


sam

http:
 
Figured it out.

The OpenDialog alters the App's default directory so that when I CreateProcess it's no longer looking in the right place.
The solution is to find the Application directory and prepend it to the exe name to give CreateProcess an absolute path.

So you can all relax now.

ta.



sam

http:
 
I too have the stange requirement to launch DOS Apps from Within Delphi Apps.
I use the executefile() proc in fmxutils.!
Never had any probs with passing the filename param from an opendialog.
 
samoff,

I think I have the same problem, did you or somebody else figure out how to solve this?

greetings,

roman.nl
 
give the full path to the file you want to open because when you use the OpenDialog, the default app's directory changes. so you either need the full path to the file or change the directory back to the default (usually the app's directory : path := ExtractFileDir(application.ExeName);)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top