熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> .NET編程 >> 正文

VC運行程序文件

2022-06-13   來源: .NET編程 

  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)


From:http://tw.wingwit.com/Article/program/net/201311/13840.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.