home *** CD-ROM | disk | FTP | other *** search
/ Shareware Supreme Volume 6 #1 / swsii.zip / swsii / 410 / SYSNEWS.ZIP / SYSNEWS.C < prev    next >
Encoding:
C/C++ Source or Header  |  1993-01-18  |  935 b   |  40 lines

  1. // Copyright ⌐ Nick Payne 1993
  2. // CIS 100033,3030
  3.  
  4. #include <windows.h>
  5. #include <string.h>
  6. #include <stdio.h>
  7.  
  8. #define argv __argv
  9.  
  10. extern char **argv;
  11.  
  12. int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
  13.                    LPSTR lpszCmdLine, int nCmdShow)
  14. {
  15.     POFSTRUCT pof;
  16.     char execCmd[80];
  17.     HWND hWindow;
  18.   RECT rect;
  19.  
  20.     // is there a parameter on the command line?
  21.     if (_fstrlen(lpszCmdLine) == 0)
  22.         _fstrcpy(lpszCmdLine, "SYSNEWS.TXT");
  23.  
  24.     // does the file exist?
  25.     if (OpenFile(lpszCmdLine, pof, OF_READ | OF_EXIST) != -1)
  26.     {
  27.         _fstrcpy(execCmd, "NOTEPAD.EXE ");
  28.         _fstrcat(execCmd, lpszCmdLine);
  29.  
  30.         WinExec(execCmd, SW_NORMAL);            // fire up Notepad
  31.     // get its window handle
  32.         hWindow = FindWindow("Notepad", NULL);
  33.         if (hWindow != NULL)
  34.         // force the Notepad window to stay on top
  35.             SetWindowPos(hWindow, HWND_TOPMOST, 0, 0, 0, 0,
  36.                 SWP_NOMOVE | SWP_NOSIZE); 
  37.     }
  38.  
  39.     return 0;
  40. }