// WinExec.lib - Cmm code wrapper for the WinExec function. This library // can be included in your source file to provide access to // to Windows' WinExec() function. // FUNCTION: WinExec() // SYNTAX: WinExec(CommandLine[,WindowState]) // CommandLine: String for the command line, wich is the program name to execute // followed possibly by optional paramters. // WindowState: How to display window (if non-Windows the PIF determines // show state). If not supplied then defaults to SW_SHOWNORMAL. // Must be one of the following: #define SW_HIDE 0 // Hides the window #define SW_SHOWNORMAL 1 // Activate and display at original size and position #define SW_SHOWMINIMIZED 2 // Activate and display as an icon #define SW_SHOWMAXIMIZED 3 // Activate and display maximized #define SW_SHOWNOACTIVATE 4 // Display normal size, but do not make active #define SW_SHOW 5 // Activate in current size and position #define SW_MINIMIZE 6 // minimize, then active top-window in task list #define SW_SHOWMINNOACTIVE 7 // show iconic, do not activate #define SW_SHOWNA 8 // show, current active window remains active #define SW_RESTORE 9 // same as SW_SHOWNORMAL // RETURN: Returns a value less than 32 if error, else returns a value // greater than 32 to indicate success. WinExec(CommandLine,WindowState) { // WindowState is optional, so use default if it wasn't supplied _WindowState = ( va_arg() < 2 ) ? SW_SHOWNORMAL : WindowState ; // use DynamicLink to call the WinExec() routine. return( DynamicLink("KERNEL","WINEXEC",SWORD16,PASCAL,CommandLine,_WindowState) ); }