我想在一个程序里调用另一个程序,怎么办??
 看以前的帖子。说用WinExecute。
 我在DELPHI的帮助里没找到。

解决方案 »

  1.   


    在DELPHI的帮助中的“windows SDK”里面有的啊
    我的是D6.
    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.   

    winexec('你的程序路径',SW_SHOWNORMAL);
      

  3.   

    命令如下:
    WinExec(LPCSTR lpCmdLine,Uint uCmdshow);
    参数如下:
    lpCmdline:命令执行字符串,出就是我们在“开始”——“执行”或是在DOS窗口下,可以输入的命令行,能过这个命令行,可以传入不同的执行命令,而执行时顺注意下列事项
    1,此应用程序必须可以执行
    2,目录及路径必须正确
    3,自己可以调用自己
    4,被调用的程序为独立的执行绪,和调用者无关
    5,不可远程调用
    uCmdShow: 执行模式,程序执行时所显示的状态,我们可以让程序在执行时无声无息,出可发显示成最大窗口
    SW_HIDE:将程序隐藏
    SW_MAXIMIZE:将程序最大化
    SW_MINIMIZE:将程序最小化
    SW_RESTORE:将程序还原化
    SW_SHOW:将程序显示在正确的位置
    SW_SHOWDEFAULT:将程序显示在默认的位置
    SW_SHOWMAXIMIZED:将程序显示最大化
    SW_SHOWMINIMIZED:将程序显示最小化
    SW_SHOWMINNOACTIVE:将程序显示最小化但不Active
    SW_SHOWNA:将程序显示但Active
    SW_SHOWNOACTIVEATE:将程序显示但不Active
    SW_SHOWNORMAL:将程序显示一般状态
    返回值大于31说明程序执行成功
      

  4.   

    借楼主宝地用一下,我也是用WINEXEC函数调用其它应用程序,程序是在WIN2000下写的,一切运行正常,但是把程序移到WIN98机上,WINEXEC命令起不了作用,不调用了,这是什么原因,难道WINEXEC在98下不兼容吗?
      

  5.   

    TO:Stiven_PFan(爱卿儿) 
     上帝呀!
     要是向你说的那样。我就完蛋了!
     你快说清楚点!