![]() |
|
#1
|
|||
|
|||
How to open files outside my program?Hi to everyone! Excuse me if my english fail.
I`m using C++ Builder 5 to develop a program, i have a .CHF help file and my program need to open it when the user click on "Open help file". But i don`t know how to do that, i only found how to make my program open files for editing, the program need to open that file like if the user have double clicked the file. It need to trigger the same action that the "double click" trigger in the windows, it need to open the file with the default registered program for that file format. Anyone know how to do something like that? |
|||
|
#2
|
|||
|
|||
Re: How to open files outside my program?ive asked this question here before, and didnt get a very good response.
|
|
#3
|
|||
|
|||
Re: How to open files outside my program?If I'm correct, the default double click action in Windows is "open." What actually happens with "open" depends on the file type.
If the extension is .exe, Windows knows "a'HA, an executable", if it's a .txt, it might know "notepad on the row for this one" or whatever. This is essentially the same as running the file from the command prompt. Thus, as a poor man's solution I offer this: CPP / C++ / C Code:
I would think there's a more.. Sophisticated method to achieve this. I assume you're developing a GUI application. You might want to consult your reference or ask around on a more specific forum to get the answers you want, since to my knowledge this is not part of C++ standard (I might be wrong, though, what do I know). Doesn't mean you can't ask here, but it means you're probably going to get a better answer elsewhere. |
|
#4
|
|||
|
|||
Re: How to open files outside my program?Thanks Kimmo, like you said i need a metod to do that in the windows GUI, becouse using system("file.rar"); im my GUI program will open the command prompt and then open the file. I need to open the file without the command prompt.
|
|
#5
|
|||
|
|||
Re: How to open files outside my program?You may try ShellExecute( file_name ). I've never messed with it before but it sounds straight-forward.
See http://support.microsoft.com/kb/238245 for details. |
|
#6
|
|||
|
|||
Re: How to open files outside my program?Thanks fakepoo, it is what i wanted. Thanks for the microsoft link, it has lots of infos about that command, i`m using it in my program now, and everting is OK.
![]() In the C++ Builder i`m using the falowing code in the OnClick event of my "Open help file" button: CPP / C++ / C Code:
|
Recent GIDBlog
Not selected for officer school by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Two-Tier data dissemination code installation problem | nidhibansal1984 | Computer Software Forum - Linux | 6 | 16-Sep-2007 10:13 |
| malloc/free usage, and general good programming behavior | lavaka | C Programming Language | 7 | 14-Jun-2007 19:50 |
| BOOKEEPING program, HELP!! | yabud | C Programming Language | 10 | 17-Nov-2006 03:48 |
| Bloodshed Dev C++ Project Options | JdS | C++ Forum | 6 | 11-Nov-2005 17:23 |
| Compiling/Linking | roostercogburn | C Programming Language | 5 | 08-Nov-2005 14:32 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The