假如我编一个对话框程序,上面有一个按钮,还有另外一个DOS程序也在它的编译目录下,我点这个按钮就可以运行DOS程序了,怎么实现?

解决方案 »

  1.   

    UINT WinExec(
      LPCSTR lpCmdLine,  // address of command line
      UINT uCmdShow      // window style for new application
    );
    WinExec("**.exe",SW_SHOW);
      

  2.   

    可以用
    UINT WinExec(
      LPCSTR lpCmdLine,  // address of command line
        UINT uCmdShow      // window style for new application
    );
    lpCmdShow为dos命令的字符串,
    nCmdShow为新窗口的样式。
      

  3.   

    这个不错
    HINSTANCE ShellExecute(
        HWND hwnd, 
        LPCTSTR lpVerb,
        LPCTSTR lpFile, 
        LPCTSTR lpParameters, 
        LPCTSTR lpDirectory,
        INT nShowCmd
    );
    详细说明见MSDN