电脑故障

位置:IT落伍者 >> 电脑故障 >> 浏览文章

VC运行程序文件


发布日期:2020/8/21
 

Q 如何打开一个应用程序?

ShellExecute(this>m_hWndopencalcexe SW_SHOW )或 ShellExecute(this>m_hWndopennotepadexec\\MyLoglogSW_SHOW )正如您所看到的我并没有传递程序的完整路径

Q 如何打开一个同系统程序相关连的文档?ShellExecute(this>m_hWndopenc\\abctxtSW_SHOW )

Q 如何打开一个网页?

ShellExecute(this>m_hWndopen SW_SHOW )

Q 如何激活相关程序发送EMAIL?

ShellExecute(this>m_hWndopenmailto SW_SHOW )

Q 如何用系统打印机打印文档?

ShellExecute(this>m_hWndprintc\\abctxt SW_HIDE)

Q 如何用系统查找功能来查找指定文件?

ShellExecute(m_hWndfindd\\nishNULLNULLSW_SHOW)

Q 如何启动一个程序直到它运行结束?

SHELLEXECUTEINFO ShExecInfo = {}ShExecInfocbSize = sizeof(SHELLEXECUTEINFO)ShExecInfofMask = SEE_MASK_NOCLOSEPROCESSShExecInfohwnd = NULLShExecInfolpVerb = NULLShExecInfolpFile = c\\MyProgramexeShExecInfolpParameters = ShExecInfolpDirectory = NULLShExecInfonShow = SW_SHOWShExecInfohInstApp = NULLShellExecuteEx(&ShExecInfo)WaitForSingleObject(ShExecInfohProcessINFINITE)PROCESS_INFORMATION ProcessInfoSTARTUPINFO StartupInfo //This is an [in] parameter ZeroMemory(&StartupInfo sizeof(StartupInfo))StartupInfocb = sizeof StartupInfo //Only compulsory field if(CreateProcess(c\\winnt\\notepadexe NULLNULLNULLFALSENULLNULL&StartupInfo&ProcessInfo))

{ WaitForSingleObject(ProcessInfohProcessINFINITE)CloseHandle(ProcessInfohThread)CloseHandle(ProcessInfohProcess)} else { MessageBox(The process could not be started……}

Q 如何显示文件或文件夹的属性?

SHELLEXECUTEINFO ShExecInfo ={}ShExecInfocbSize = sizeof(SHELLEXECUTEINFO)ShExecInfofMask = SEE_MASK_INVOKEIDLIST ShExecInfohwnd = NULLShExecInfolpVerb = propertiesShExecInfolpFile = c\\ //can be a file as well ShExecInfolpParameters = ShExecInfolpDirectory = NULLShExecInfonShow = SW_SHOWShExecInfohInstApp = NULLShellExecuteEx(&ShExecInfo)

上一篇:编程必学:控件的拖动和缩放技术全解

下一篇:DotNet for Symbian平台