ShellExecute(handle,pchar('open'),pchar(File.exe),nil,nil,SW_NORMAL);                                                                            

解决方案 »

  1.   

    为保证程序可以正常启动,最好在执行之前首先检查程序文件是否存在。
    pchar(File.exe)写错了,应该是pchar('File.exe'),
      

  2.   

    ShellExecute(handle,nil,pchar('你要调用的文件名'),nil,nil,SW_NORMAL);
    最后一个参数为打开的方式,比如隐藏窗口,正常窗口,最大化等。
    The ShellExecute function opens or prints a specified file. The file can be an executable file or a document file. See ShellExecuteEx also. HINSTANCE ShellExecute(    HWND hwnd, // handle to parent window
        LPCTSTR lpOperation, // pointer to string that specifies operation to perform
        LPCTSTR lpFile, // pointer to filename or folder name string
        LPCTSTR lpParameters, // pointer to string that specifies executable-file parameters 
        LPCTSTR lpDirectory, // pointer to string that specifies default directory
        INT nShowCmd  // whether file is shown when opened
       );
     ParametershwndSpecifies a parent window. This window receives any message boxes that an application produces. For example, an application may report an error by producing a message box.lpOperationPointer to a null-terminated string that specifies the operation to perform. The following operation strings are valid:String Meaning
    "open" The function opens the file specified by lpFile. The file can be an executable file or a document file. The file can be a folder to open.
    "print" The function prints the file specified by lpFile. The file should be a document file. If the file is an executable file, the function opens the file, as if "open" had been specified.
    "explore" The function explores the folder specified by lpFile. 
     The lpOperation parameter can be NULL. In that case, the function opens the file specified by lpFile. lpFilePointer to a null-terminated string that specifies the file to open or print or the folder to open or explore. The function can open an executable file or a document file. The function can print a document file. lpParametersIf lpFile specifies an executable file, lpParameters is a pointer to a null-terminated string that specifies parameters to be passed to the application.
    If lpFile specifies a document file, lpParameters should be NULL. lpDirectoryPointer to a null-terminated string that specifies the default directory. nShowCmdIf lpFile specifies an executable file, nShowCmd specifies how the application is to be shown when it is opened. 
      

  3.   

     who can tell me how to open a executable application in c++?I have done according to what MSDN said,but there is no any window pup up?