关于winexect 和 ShellExecute 的问题
1。winexect是干什么用的
2。winexect和ShellExecute 有什么区别
问题点数:50、回复次数:6Top
1 楼DentistryDoctor(不在无聊中无奈,就在沉默中变态)回复于 2004-12-01 17:11:25 得分 0
WinExec
The WinExec function runs the specified application.
Note This function is provided only for compatibility with 16-bit Windows. Applications should use the CreateProcess function.
UINT WinExec(
LPCSTR lpCmdLine,
UINT uCmdShow
);
Top
2 楼DentistryDoctor(不在无聊中无奈,就在沉默中变态)回复于 2004-12-01 17:11:47 得分 0
ShellExecute Function
--------------------------------------------------------------------------------
Performs an operation on a specified file.
Syntax
HINSTANCE ShellExecute( HWND hwnd,
LPCTSTR lpOperation,
LPCTSTR lpFile,
LPCTSTR lpParameters,
LPCTSTR lpDirectory,
INT nShowCmd
);
Top
3 楼ncucf(ncu晨风)回复于 2004-12-01 17:29:42 得分 10
通常用winexec就可以完成外部程序调用,如果你要复杂一点的参数和当前目录设置,就可以用shellexecute,如果更复杂的,可以用createprocessTop
4 楼Rogeremail(绿色环保-菜青虫)回复于 2004-12-01 17:45:24 得分 10
winexec属于将要淘汰的函数。Top
5 楼flinming(flinming)回复于 2004-12-01 18:18:37 得分 0
Q: 如何打开一个应用程序?
ShellExecute(this->m_hWnd,"open","calc.exe","","", SW_SHOW );
或
ShellExecute(this->m_hWnd,"open","notepad.exe",
"c:\\MyLog.log","",SW_SHOW );
As you can see, I haven't passed the full path of the programs.
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",
"mailto:nishinapp@yahoo.com","","", SW_SHOW );
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 = {0};
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;
ShExecInfo.hInstApp = NULL;
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))
{
WaitForSingleObject(ProcessInfo.hProcess,INFINITE);
CloseHandle(ProcessInfo.hThread);
CloseHandle(ProcessInfo.hProcess);
}
else
{
MessageBox("The process could not be started...");
}
Q: 如何显示文件或文件夹的属性?
SHELLEXECUTEINFO ShExecInfo ={0};
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;
ShExecInfo.hInstApp = NULL;
ShellExecuteEx(&ShExecInfo);
Top
6 楼oyljerry(【勇敢的心】→ ㊣提拉米苏√㊣)回复于 2004-12-01 20:57:57 得分 30
都可以打开进程,只不过一个参数少,功能简单,一个参数多,功能多些Top
相关问题
- ShellExecute()
- shellexecute和winexec有什么区别?
- 请教ShellExecute 和 GetWindowsDirectory 的用法
- shellexecute 和winexec 有什么区别?
- 有关ShellExecute和CreateProcess的问题
- ShellExecute问
- ShellExecute和WinExec和LoadLibrary 分别是哪几个DLL里的函数???????
- ShellExecute要Uses哪个.pas单元中?for D5 和 for D6.
- Delphi中怎样声明和使用ShellExecute函数?
- 为什么Del命令WINEXEC 和SHELLEXECUTE执行不了?




