[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  WinExec( nCmdLine, nCmdShow )-> <hInstance>
------------------------------------------------------------------------------


 PARAMETER:

  <nCmdLine>    Is a string that contains the command line to execute. If it
                does not contains a path, then Windows searches in the order

                1  The current directory.

                2  The Windows directory (the directory containing WIN.COM);
                   GetWinDir() retrieves the path of this directory.

                3  The Windows system directory ( containing system files 
                   such as GDI.EXE); GetSysDir() retrieves the path of this
                   directory.

                4  The directory containing the executable file for the
                   current task; GetModuleFileName() retrieves the path of
                   this directory.

                5  The directories listed in the PATH environment variable

                6  The directories mapped in a network.


  <nCmdShow>    Specifies how the windows application has to be shown. See
                This parameter can be one of the following values:

                SW_HIDE            Hides the window and passes activation
                ( 0 )              to another window.

                SW_MINIMIZE        Minimizes the specified window and 
                ( 6 )              activates the top-level window in the
                                   system's list.

                SW_RESTORE         Activates and displays a window. If the
                ( 9 )              window is minimized or maximized, 
                                   Windows restores it to its original size
                                   and position (same as SW_SHOWNORMAL)

                SW_SHOW            Activates a window and displays it in
                ( 6 )              its current size and position.

                SW_SHOWMAXIMIZED   Activates a window and displays it as
                ( 3 )              a maximized window.

                SW_SHOWMINIMIZED   Activates a window and displays it as 
                ( 2 )              an icon.

                SW_SHOWMINNOACTIVE Displays a window as an icon. The 
                ( 7 )              window that is currently active remains
                                   active.

                SW_SHOWNA          Displays a window in its current state.
                ( 8 )              The window that is currently active 
                                   remains active.

                SW_SHOWNOACTIVATE  Displays a window in its most recent
                ( 4 )              size and position. The window that is
                                   currently active remains active.

                SW_SHOWNORMAL      Activates and displays a window. If the
                ( 1 )              window is minimized or maximized, 
                                   Windows restores it to its original size 
                                   and position (same as SW_RESTORE)



 RETURNS:

  <hInstance> identifies the instance of the loaded module, if the function
  is successful. Otherwise, the return value is an error value less than 32:

     0  System was out of memory, executable file was corrupt, or
        relocations were invalid.

     2  File was not found.

     3  Path was not found.

     5  Attempt was made to dynamically link to a task, or there was a
        sharing or network-protection error.

     6  Library required separate data segments for each task.

     8  There was insufficient memory to start the application.

    10  Windows version was incorrect.

    11  Executable file was invalid. Either it was not a Windows application
        or there was an error in the .EXE image.

    12  Application was designed for a different operating system.

    13  Application was designed for MS-DOS 4.0.

    14  Type of executable file was unknown.

    15  Attempt was made to load a real-mode application (developed for an
        earlier version of Windows).

    16  Attempt was made to load a second instance of an executable file
        containing multiple data segments that were not marked read-only.

    19  Attempt was made to load a compressed executable file. The file must
        be decompressed before it can be loaded.

    20  Dynamic-link library (DLL) file was invalid. One of the DLLs
        required to run this application was corrupt.

    21  Application requires 32-bit extensions.



 DESCRIPTION:

  WinExec() runs the specified application.


 EXAMPLE:


    +--------------------------------------------------------------+
    |  /* Launch an invisible DOS Window */                        |
    |   WINEXEC( ctoolpath + "touch.pif " + cProg, 0 )             |
    |                                                              |
    |  /* Run an Expert Help PIF */                                |
    |   WINEXEC( "C:\NG\EH.PIF", 6 )                               |
    +--------------------------------------------------------------+



 SOURCE:

  SOURCE\WINAPI\WINEXEC.C



See Also: GetWinDir GetSysDir GetModuleFileName ShowWindow
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson