Link to home
Start Free TrialLog in
Avatar of ahTri
ahTri

asked on

Open a text file

How can I open a text file or *.doc file by any default viewer or editor of the computer my program would possibly run ! sorry I only have 13 points left
ASKER CERTIFIED SOLUTION
Avatar of nietod
nietod

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mbequette
mbequette

I need a little further explanation.  If you want, for instance notepad to open a text file and your program is to control all of this, you can make a win32 CreateProcess call and pass the file name(parameters) and the executable(notepad) is to use.  This will work for other editors as well.  However, I am not sure by your question what you want.  If this is I can give you further explanation with specific code examples.
hope this helps,
mb
ShellExecute() works because you don't have to specify the application.  You just specify the file to be opened and windows finds the application to open it--if possible.
Avatar of ahTri

ASKER

thanks Nietod

for mbequette : what I want is to open a file by what ever a default viewer or editor of the host machine, not a specific one to be defined by CreateProcess ! For example a PC that doesnt have Words it would open a .doc file by WordPad or a wordviewer plugin ... thanks though