home *** CD-ROM | disk | FTP | other *** search
- /****************************************************************************
-
- Program: WINRUN.C
-
- History: Mon 03-18-1991 bd Created
- Sat 03-23-1991 bd Modified for Optional Command LIne Param
-
- Use: Utility for use with Program Manager File Property Command Line
-
- Example: {directory}WINRUN {-option} normal_command_line
-
- Options: -option parameter can be set to:
-
- STD - same as leaving option off command line
- MIN - activate app and minimize window
- MAX - activate app and maximize window
-
- Author: Bob Duffett
- Priority Software, Inc.
- P.O. Box 5548
- Athens, GA 30604
-
- (404) 548-4039 Voice
- (404) 543-7250 FAX
- (404) 543-3162 MHS Hub (PSI-GA)
-
- Build: cl -c -AS -Gsw -Owx -Zpe -W4 winrun.c
- link /nod winrun,,, libw slibcew, winrun.def
- rc winrun.res
-
- ****************************************************************************/
-
- #include "windows.h"
-
- #define NOREF(x) x=x
-
- int PASCAL WinMain
- ( HANDLE hInstance, HANDLE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )
- {
- int nParam = nCmdShow;
-
- NOREF( hInstance );
- NOREF( hPrevInstance );
-
- if( lpCmdLine[0] == '-' )
- {
- if( lstrlen(lpCmdLine) <= 6 || lpCmdLine[4] != ' ' )
- goto BotchedCommandLine;
-
- lpCmdLine += 3;
-
- if( *lpCmdLine == 'D' || *lpCmdLine == 'd' )
- ;
- else
- if( *lpCmdLine == 'N' || *lpCmdLine == 'n' )
- nParam = SW_SHOWMINIMIZED;
- else
- if( *lpCmdLine == 'X' || *lpCmdLine == 'x' )
- nParam = SW_SHOWMAXIMIZED;
- else
- goto BotchedCommandLine;
-
- lpCmdLine += 2;
- }
-
- if( *lpCmdLine == '\0' )
- return FALSE;
-
- return WinExec( lpCmdLine, nParam );
-
- BotchedCommandLine:
-
- MessageBox(
- NULL,
- "Problem: Invalid 'option' parameter\n"
- "\n"
- "Syntax:\n"
- "\240\240{directory}WINRUN\240{-option}\240normal_command_line\n"
- "\n"
- "Where:\n"
- " option is STD, MIN or MAX\n",
- "WINRUN Error Message",
- MB_ICONASTERISK | MB_OK );
-
- return FALSE;
- }
-
-