|
-
Jul 19th, 2001, 04:21 AM
#1
Run a file from my program?
I have created an MFC EXE and I have added a button. Now I want IExplorer.exe to open when I click the button. The same as Shell("IExplorer.exe") in VB.
void CTestDlg::OnOpenButton()
{
// open iexplorer.exe code
}
How can I do this?
-
Jul 19th, 2001, 05:04 AM
#2
PowerPoster
try this...
PHP Code:
ShellExecute(hDlg, "open", "IExplorer.exe", NULL, NULL, SW_SHOWNORMAL);
-
Jul 19th, 2001, 06:15 AM
#3
Hmm that didn't work. It gave me a error at the Dlg parameter. I don't have that identifier identified. I tried to NULL and it compiled successfully but nothing happend in the program.
What shall I do
-
Jul 19th, 2001, 01:35 PM
#4
Junior Member
well if you're trying to run Internet Explorer, you need to execute iexplore.exe .. you may also have to supply the path.
additionally, if the return value of ShellExecute is <32 there was an error...
-
Jul 19th, 2001, 03:04 PM
#5
What do you mean I have to execute it? Thats the problem I'm having 
I want to be able to execute other programs from my program.
ShellExecute doesn't seem to work, hmm..
Let's say I want to execute test.exe from my program and test.exe is in the same directory as my program, how would I do?
-
Jul 19th, 2001, 03:54 PM
#6
Frenzied Member
Try:
Code:
WinExec("test.exe",SW_SHOW);
However it is a lot better to use the ShellExecute API.
-
Jul 19th, 2001, 04:00 PM
#7
Junior Member
ShellExecute(hwnd, "test.exe", 0, 0, SW_SHOW)
don't use WinExec() ... it's kept for 16-bit compatibility only...
for more information check out the MSDN Library @ msdn.microsoft.com
-
Jul 19th, 2001, 04:49 PM
#8
Ahh thanks alot guys! It works now.
Thanks again.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|