在我的对话框中我想通过单击按钮启动电脑里的其他程序,有什么函数吗?谢谢

解决方案 »

  1.   

    winexec()是16位的winodws程序,当然也可以用win32函数如createprocess()
      

  2.   

    请看下面的例子:
    void ClassA::OnExe() 
    {
      int nRetValue;
      CString strFileName = "C:\\Program Files\\Test.exe";
      CString strWorkPath = "C:\\Program Files";  STARTUPINFO stInfo;
      PROCESS_INFORMATION prInfo;
      BOOL bResult;

      ZeroMemory(&stInfo, sizeof(stInfo));
      stInfo.cb = sizeof(stInfo);
      stInfo.dwFlags = STARTF_USESHOWWINDOW;
      stInfo.wShowWindow = SW_NORMAL;

      bResult = CreateProcess((LPCTSTR)strFileName, NULL,
    NULL, NULL, TRUE,
    CREATE_NEW_CONSOLE| RMAL_PRIORITY_CLASS,
    NULL, (LPCTSTR)strWorkPath, &stInfo, &prInfo);
      CloseHandle(prInfo.hThread);
      CloseHandle(prInfo.hProcess);
    }
      

  3.   

    Winexec("d:\\test.exe",NULL);
    ShellExecute(NULL,NULL,"d:\\test.exe",NULL,NULL,SW_SHOW);
    其中d:\\test.exe是test.exe这个可执行文件的完全路径!
      

  4.   

    早期还有system(), _exec(), _spawn(),真是多如牛毛。
    而且system()还能执行一条Dos命令