I'm wondering how I can open a file literally in C++ (like double clicking it)?
views:
387answers:
5
+1
A:
You mean like open explorer?
How about using
system("explorer.exe file.to.open");
a_m0d
2009-06-11 05:28:39
yes, something like this..
Charles Khunt
2009-06-11 05:30:46
+2
A:
Use ShellExecute with the "open" verb. See this article for more information.
Jason Williams
2009-06-11 05:34:49
+7
A:
Provided you have the ".txt" extension registered (and text files should be associated with Notepad in a default installation, or something else if you've changed it from Explorer - you'd have to work pretty hard to disassociate them), Windows will open it for you without you having to specify the executable name:
ShellExecute (hwnd,"open","c:\\x.txt",NULL,NULL,SW_SHOW);
or, for a web page in your browser of choice:
ShellExecute (hwnd,"open","http://www.microsoft.com",NULL,NULL,SW_SHOW);
paxdiablo
2009-06-11 05:37:10