I tried system("c:\\....exe") and ShellExecute("c:\....exe") but both of them shows a black DOS box.. I want do launch the program directly
Printable View
I tried system("c:\\....exe") and ShellExecute("c:\....exe") but both of them shows a black DOS box.. I want do launch the program directly
first this shuld be in win32 forum .
second the block box is from the exe?
third tried createproccess?
yes it is an exe file. How can I use createprocess?
the black box is from the exe?
Pass DETACHED_PROCESS as dwCreationFlags in CreateProcess.
http://msdn.microsoft.com/library/de...ateprocess.asp
Don't forget to call CloseHandle on both PROCESS_INFORMATION::hProcess and PROCESS_INFORMATION::hThread
Or CREATE_NO_WINDOW as dwCreationFlags. Either way.
http://msdn.microsoft.com/library/de...tion_flags.asp
no. it is a windows application.Quote:
Originally Posted by Mitsukai
Maybe SW_HIDE in ShellExecute (not sure, didn't do Win API programming for some time).
I want to launch an application with path C:\Program Files\Firm Name\Program Name.exe. I think it does not work because path contains spaces
i tried system(c:\\program files\\firm name\\program name.exe);
also system(C:\\progra~1\firmna~1\progra~1.exe (not compiling));
Forgot ""? Also you should enclose it in "" in command line, to distinguish path to executable from its command line parameters, so it'll look this way:(note \")Code:system("\"C:\\Program Files\\Firm Name\\Program Name.exe\"");
thank you it worked. also I found the total solution
to launch a windows program witout a black dos box, with parameters:
WinExec("C:\\Program Files\\My Application\\My App.exe C:\\foobar.tmp",SW_SHOWNORMAL)
It really works with spaces in directory names?
Yep, that's a security flaw.Quote:
Originally Posted by RoboTact
In order to avoid bugs written by bad programmers (especially Windows 3 programmers who assumed that most people don't put spaces in file names which was false, even in those early days), Windows first tries to search for a C:\Program.exe or C:\Program.com file, and if it doesn't exist, it tries C:\Program Files\My.exe (or .com), and then, C:\Program Files\My Application\My.exe (or .com), then, C:\Program Files\My Application\My App.exe. And, if it didn't exist, it would try C:\Program Files\My Application\My App.exe C:\foobar.tmp which is an invalid path, anyway.
This flaw can be exploited by malicious software.
One more example of "silently accept buggy input" strategy - though with such approach something sloppy is simplier to make work it tends to stay at that sloppy level. :(