home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / siqftst.zip / siqtst.c < prev    next >
Text File  |  1996-02-12  |  2KB  |  110 lines

  1.  #define INCL_PM
  2.  #define INCL_DOS 
  3.  
  4.  #define MYAPP           "MyApp"
  5.  #define ID_MYWINDOW     42
  6.  #define ID_BUTTON       51 
  7.  
  8.  /* Includes */
  9.  
  10.  #include <os2.h>
  11.  
  12.  /* Prototypes */
  13.  
  14.  MRESULT EXPENTRY MyWinProc (HWND, ULONG, MPARAM, MPARAM);
  15.  
  16.  /* Global Variables */
  17.  
  18.  HAB     hab;
  19.  HWND    hwndClient,
  20.          hwndFrame,
  21.          hwndButton;
  22.  
  23.  /* main function */
  24.  
  25.  void main (void)
  26.  {
  27.      HMQ     hmq;
  28.      QMSG    qmsg;
  29.      ULONG   flCreate;
  30.  
  31.      hab = WinInitialize (0);
  32.      if (!hab)
  33.          return;
  34.  
  35.      hmq = WinCreateMsgQueue (hab, 0);
  36.  
  37.      WinRegisterClass(
  38.          hab,
  39.          MYAPP,
  40.          (PFNWP) MyWinProc,
  41.          CS_SIZEREDRAW,
  42.          0);
  43.  
  44.      flCreate =  FCF_TITLEBAR    | FCF_SYSMENU       |
  45.                  FCF_SIZEBORDER  | 
  46.                  FCF_TASKLIST    | FCF_SHELLPOSITION ;
  47.  
  48.      hwndFrame = WinCreateStdWindow(
  49.          HWND_DESKTOP,
  50.          WS_VISIBLE,
  51.          &flCreate,
  52.          MYAPP,
  53.          "SIQ fix test",
  54.          0L,
  55.          NULLHANDLE,
  56.          ID_MYWINDOW,
  57.          &hwndClient);
  58.  
  59.  
  60.     hwndButton = WinCreateWindow(hwndClient,
  61.         WC_BUTTON,
  62.         "Lock PM queue",
  63.             WS_VISIBLE | BS_PUSHBUTTON,
  64.         10,10,
  65.         200,50,
  66.         hwndClient,
  67.         HWND_TOP,
  68.         ID_BUTTON,
  69.         NULL,
  70.         NULL);
  71.  
  72.      while (WinGetMsg (hab,&qmsg,(HWND)NULL,0,0))
  73.          WinDispatchMsg (hab,&qmsg);
  74.  
  75.      WinDestroyWindow(hwndFrame);
  76.      WinDestroyMsgQueue(hmq);
  77.      WinTerminate(hab);
  78.  }
  79.  
  80.  /* our window procedure */
  81.  
  82.  MRESULT EXPENTRY MyWinProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
  83.  {
  84.      switch (msg)
  85.      {
  86.          case WM_ERASEBACKGROUND:
  87.              return (MRESULT) TRUE;
  88.              break;
  89.  
  90.          case WM_COMMAND:
  91.            switch (SHORT1FROMMP(mp1))
  92.             {
  93.              case ID_BUTTON:
  94.               WinSetWindowText(hwndButton,"PM queue Locked");
  95.               DosBeep(1000,250);
  96.               DosSleep(30000);
  97.               DosBeep(1000,1000);
  98.               WinSetWindowText(hwndButton,"Lock PM queue");
  99.  
  100.              return 0;
  101.             }
  102.   
  103.          default:
  104.              return WinDefWindowProc (hwnd, msg, mp1, mp2);
  105.      }
  106.      return FALSE;
  107.  }
  108.    
  109.  
  110.