A
a_fi
Unregistered / Unconfirmed
GUEST, unregistred user!
#include <ShellApi.hpp><br>//---------------------------------------------------------------------------<br>#pragma package(smart_init)<br>#pragma resource "*.dfm"<br>TForm1 *Form1;<br>//---------------------------------------------------------------------------<br>__fastcall TForm1::TForm1(TComponent* Owner)<br>: TForm(Owner)<br>{<br>}<br>//---------------------------------------------------------------------------<br><br>void __fastcall TForm1::Button1Click(TObject *Sender)<br>{<br>STARTUPINFO StartupInfo;<br>PROCESS_INFORMATION ProcessInfo;<br>char *sCommandLine;<br>bool bCreateProcess;<br><br>sCommandLine ="c://windows//notepad c://.1.txt";<br>StartupInfo.cb = sizeof(STARTUPINFO);<br>StartupInfo.dwFlags = STARTF_USESHOWWINDOW;<br>StartupInfo.wShowWindow = SW_NORMAL;<br>CreateProcess(NULL,sCommandLine.c_str(), NULL,<br>NULL, FALSE, CREATE_NEW_CONSOLE|NORMAL_PRIORITY_CLASS, NULL,<br>NULL, &StartupInfo, &ProcessInfo);<br><br>if (bCreateProcess)<br>WaitForSingleObject(ProcessInfo.hProcess, INFINITE);<br><br>if(bCreateProcess)<br>{<br>WaitForInputIdle(ProcessInfo.hProcess, 60000);<br>//time-out interval in milliseconds<br>Memo1->Clear();<br><br>Memo1->Lines->Add("你好");<br><br>}<br><br>}<br>==========================<br>question:<br>why not notepad open this file(c:/1.txt)?<br>为何记事本未运行,怎样使他打开指定的文件c:/1.txt?<br><br><br><br><br>