kahkaha
July 22nd, 2006, 12:32 PM
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
|
Click to See Complete Forum and Search --> : launching a program without black DOS box kahkaha July 22nd, 2006, 12:32 PM 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 Mitsukai July 22nd, 2006, 12:35 PM first this shuld be in win32 forum . second the block box is from the exe? third tried createproccess? kahkaha July 22nd, 2006, 01:03 PM yes it is an exe file. How can I use createprocess? Mitsukai July 22nd, 2006, 01:08 PM the black box is from the exe? SuperKoko July 22nd, 2006, 02:28 PM Pass DETACHED_PROCESS as dwCreationFlags in CreateProcess. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/createprocess.asp Don't forget to call CloseHandle on both PROCESS_INFORMATION::hProcess and PROCESS_INFORMATION::hThread Calculator July 22nd, 2006, 02:33 PM Or CREATE_NO_WINDOW as dwCreationFlags. Either way. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/process_creation_flags.asp kahkaha July 23rd, 2006, 12:53 PM the black box is from the exe? no. it is a windows application. RoboTact July 23rd, 2006, 04:07 PM Maybe SW_HIDE in ShellExecute (not sure, didn't do Win API programming for some time). kahkaha August 9th, 2006, 04:42 AM 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)); RoboTact August 9th, 2006, 05:44 AM 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:system("\"C:\\Program Files\\Firm Name\\Program Name.exe\"");(note \") kahkaha August 14th, 2006, 05:26 AM 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) RoboTact August 14th, 2006, 05:50 AM It really works with spaces in directory names? SuperKoko August 14th, 2006, 06:54 AM It really works with spaces in directory names? Yep, that's a security flaw. 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. RoboTact August 14th, 2006, 07:10 AM 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. :( codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |