深入淺出ShellExecute

2021-04-18 18:33:41 字數 2029 閱讀 8201

深入淺出shellexecute譯者:徐景周(原作:nishant s)

q: 如何開啟乙個應用程式?

shellexecute(this->m_hwnd,"open","calc.exe","","", sw_show );
shellexecute(this->m_hwnd,"open","notepad.exe",

"c://mylog.log","",sw_show );

正如您所看到的,我並沒有傳遞程式的完整路徑。q: 如何開啟乙個同系統程式相關連的文件?
shellexecute(this->m_hwnd,"open",

"c://abc.txt","","",sw_show );

q: 如何開啟乙個網頁?
shellexecute(this->m_hwnd,"open",

"http://www.google.com","","", sw_show );

q: 如何啟用相關程式,傳送email?
shellexecute(this->m_hwnd,"open",q: 如何用系統印表機列印文件?shellexecute(this->m_hwnd,"print",

"c://abc.txt","","", sw_hide);

q: 如何用系統查詢功能來查詢指定檔案?
shellexecute(m_hwnd,"find","d://nish",

null,null,sw_show);

q: 如何啟動乙個程式,直到它執行結束?
shellexecuteinfo shexecinfo = ;

shexecinfo.cbsize = sizeof(shellexecuteinfo);

shexecinfo.fmask = see_mask_nocloseprocess;

shexecinfo.hwnd = null;

shexecinfo.lpverb = null;

shexecinfo.lpfile = "c://myprogram.exe";

shexecinfo.lpparameters = "";

shexecinfo.lpdirectory = null;

shexecinfo.nshow = sw_show;

shellexecuteex(&shexecinfo);

waitforsingleobject(shexecinfo.hprocess,infinite);

或:
process_information processinfo; 

startupinfo startupinfo; //this is an [in] parameter

zeromemory(&startupinfo, sizeof(startupinfo));

startupinfo.cb = sizeof startupinfo ; //only compulsory field

if(createprocess("c://winnt//notepad.exe", null,

null,null,false,0,null,

null,&startupinfo,&processinfo))

else

q: 如何顯示檔案或資料夾的屬性?
shellexecuteinfo shexecinfo =;

shexecinfo.cbsize = sizeof(shellexecuteinfo);

shexecinfo.fmask = see_mask_invokeidlist ;

shexecinfo.hwnd = null;

shexecinfo.lpverb = "properties";

shexecinfo.lpfile = "c://"; //can be a file as well

shexecinfo.lpparameters = "";

shexecinfo.lpdirectory = null;

shexecinfo.nshow = sw_show;

shellexecuteex(&shexecinfo);

深入淺出sizeof

int佔 位元組,short佔 位元組 1.0 回答下列問題 答案在文章末尾 1.sizeof char 2.sizeof a 3.sizeof a 4.strlen a 如果你答對了全部四道題,那麼你可以不用細看下面關於sizeof的論述。如果你答錯了部分題目,那麼就跟著我來一起 關於sizeof...

深入淺出ShellExecute

ipconfig c log.txt應如何處理?二樓的朋友,開啟拔號網路這樣 shellexecute null,open c windows rundll32.exe shell32.dll,control rundll c windows system telephon.cpl null,sw ...

深入淺出PHP Exploring PHP

一直以來,橫觀國內的php現狀,很少有專門介紹php內部機制的書。呵呵,我會隨時記錄下研究的心得,有機會的時候,彙總成書。今天這篇,我內心是想打算做為乙個導論 php是乙個被廣泛應用的指令碼語言,因為它的成功,所以很多時候,我們應用php的時候是更不不需要考慮底層到底是怎麼實現的。我相信大多數的 p...