我要在DELPHI里调用一些执行文件,介绍winexec函数的用法最好详细点,谢谢大家

解决方案 »

  1.   

    api帮助
    The WinExec function runs the specified application. This function is provided for compatibility with earlier versions of Windows. For Win32-based applications, use the CreateProcess function. UINT WinExec(    LPCSTR lpCmdLine, // address of command line 
        UINT uCmdShow  // window style for new application 
       );
     ParameterslpCmdLinePoints to a null-terminated character string that contains the command line (filename plus optional parameters) for the application to be executed. If the name of the executable file in the lpCmdLine parameter does not contain a directory path, Windows searches for the executable file in this sequence: 1. The directory from which the application loaded. 
    2. The current directory. 
    3. The Windows system directory. The GetSystemDirectory function retrieves the path of this directory. 
    4. The Windows directory. The GetWindowsDirectory function retrieves the path of this directory. 
    5. The directories listed in the PATH environment variable.  uCmdShowSpecifies how a Windows-based application window is to be shown and is used to supply the wShowWindow member of the STARTUPINFO parameter to the CreateProcess function. For a list of the acceptable values, see the description of the nCmdShow parameter of the ShowWindow function. For a non-Windows - based application, the PIF file, if any, for the application determines the window state.  Return ValuesIf the function succeeds, the return value is greater than 31.
    If the function fails, the return value is one of the following error values: Value Meaning
    0 The system is out of memory or resources.
    ERROR_BAD_FORMAT The .EXE file is invalid (non-Win32 .EXE or error in .EXE image).
    ERROR_FILE_NOT_FOUND The specified file was not found.
    ERROR_PATH_NOT_FOUND The specified path was not found.
     ResWin32-based applications should use the CreateProcess function rather than this function. The WinExec function exists in Win32 to provide compatibility with earlier versions of Windows. For more information about how the WinExec function is implemented, see the Res section of the LoadModule function.
    In Win32, the WinExec function returns when the started process calls the GetMessage function or a time-out limit is reached. To avoid waiting for the time out delay, call the GetMessage function as soon as possible in any process started by a call to WinExec. 
      

  2.   

    调用16位application的,若是32位用createprocess。
    另外在delphi的帮助中是有的,不过要用开始->borland delphi->help->MS SDK help->win32 SDK reference
      

  3.   

    调用16位application的,若是32位用createprocess。
    另外在delphi的帮助中是有的,不过要用开始->borland delphi->help->MS SDK help->win32 SDK reference
      

  4.   

    用CreateProcess吧,控制起来方便一些
      

  5.   

    winexec('执行文件名(包括路径)',0);
    具体参数及帮助楼上都说了
      

  6.   

    WinExec ('文件名(路径)',控制窗口的可见性)控制窗口的可见性:
    SW_HIDE 隐藏窗口,活动状态给令一个窗口 
    SW_MINIMIZE 最小化窗口,活动状态给令一个窗口 
    SW_RESTORE 用原来的大小和位置显示一个窗口,同时令其进入活动状态 
    SW_SHOW 用当前的大小和位置显示一个窗口,同时令其进入活动状态 
    SW_SHOWMAXIMIZED 最大化窗口,并将其激活 
    SW_SHOWMINIMIZED 最小化窗口,并将其激活 
    SW_SHOWMINNOACTIVE 最小化一个窗口,同时不改变活动窗口 
    SW_SHOWNA 用当前的大小和位置显示一个窗口,不改变活动窗口 
    SW_SHOWNOACTIVATE 用最近的大小和位置显示一个窗口,同时不改变活动窗口 
    SW_SHOWNORMAL 与SW_RESTORE相同
      

  7.   

    WinExec是16位Windows平台上的,Win32平台上要用ShellExecute.
    procedure THyperlinkLabel.Click;
    begin
      inherited Click;
      case OperateType of
           otHyperlink,otExecuteFile:
                           ShellExecute(Application.Handle,nil,PChar(LinkTo),nil,nil,SW_SHOWNORMAL);
           otEMail:        ShellExecute(Application.Handle,nil,PChar('mailto:'+LinkTo),nil,nil,SW_SHOWNORMAL);
           otMyComputer:   ShellExecute(Application.Handle,'Open',PChar(LinkTo),nil,nil,SW_SHOWNORMAL);
           otExplore:      ShellExecute(Application.Handle,'Explore',PChar(LinkTo),nil,nil,SW_SHOWNORMAL);
      end;
    end;