Beispiel #1
0
static VOID APIENTRY ServiceRequests( VOID )
{
    USHORT              len;
    pmhelp_packet       data;

    WinCreateMsgQueue( Hab, 0 );
    for( ;; ) {
        if( DosRead( InStream, &data, sizeof( data ), &len ) != 0 ) break;
        if( len != sizeof( data ) ) break;
        switch( data.command ) {
        case PMHELP_LOCK:
            PidDebugee = data.pid;
            TidDebugee = data.tid;
            LockIt();
            break;
        case PMHELP_UNLOCK:
            PidDebugee = data.pid;
            TidDebugee = data.tid;
            UnLockIt();
            break;
        case PMHELP_EXIT:
            WinPostMsg( hwndClient, WM_QUIT, 0, 0 );/* Cause termination*/
            break;
        }
        WinInvalidateRegion( hwndClient, 0L, FALSE );
    }
    Say( "Read Failed" );
}
/*@ XToolBar::Draw(void)
@group display
@remarks Redraw the toolbar.
*/
void XToolBar::Draw(void)
{
   RECTL rect;
   WinQueryWindowRect(winhandle, &rect);
   HPS hps = WinGetPS(winhandle);
   GpiCreateLogColorTable(hps, LCOL_RESET, LCOLF_RGB, 0,0,NULL);
   WinFillRect( hps, &rect, SYSCLR_BUTTONMIDDLE);
   WinDrawBorder(hps, &rect, 1,1,0,0,DB_PATCOPY|DB_RAISED);
   HENUM e;
   HWND hwnd;

   e = WinBeginEnumWindows(winhandle);
   while ((hwnd = WinGetNextWindow(e)) != 0)
      WinInvalidateRegion(hwnd, NULLHANDLE, TRUE);
   WinEndEnumWindows(e);
}
/*@ XToolBar::SetHeight(const USHORT y)
@group sizing
@remarks Set the hight of the toolbar
@parameters USHORT ySize                 the new hight in pixels
*/
BOOL XToolBar::SetHeight(const USHORT y)
{
   SWP swp[200];

   if (IsVisible())
      cy = y;
/*
   if (line1)
   {
      line1->SetHeight(y - 2);
      XPoint p(0, y - 2);

      line2->Move(&p);
      p.Set(cx - 1, 0);
      line3->Move(&p);
      line3->SetHeight(y - 2);
   }
*/
   if (frame && frame->frameWin)
   {
      SWP swp2;

      WinQueryWindowPos(frame->winhandle, &swp2);
      WinSetWindowPos(frame->winhandle, HWND_TOP, 0, 0, swp2.cx - cx, swp2.cy - y, SWP_SIZE | SWP_SHOW | SWP_ZORDER);

      SHORT res = SHORT1FROMMR(WinSendMsg(frame->frameWin->winhandle, WM_QUERYFRAMECTLCOUNT, 0, 0));

      WinSendMsg(frame->frameWin->winhandle, WM_FORMATFRAME, MPFROMP(swp), 0);

      SHORT i;

      for (i = 0; i < res; i++)
      {
         if (swp[i].hwnd != 0)
            WinSetWindowPos(swp[i].hwnd, swp[i].hwndInsertBehind, swp[i].x, swp[i].y, swp[i].cx, swp[i].cy, swp[i].fl);
      }

      if (frame->clientWindow == NULL)
         WinInvalidateRegion(frame->winhandle, NULLHANDLE, TRUE);

      return TRUE;
   }
   else
      return FALSE;
}
Beispiel #4
0
void ReDraw( HWND hwnd )
{
  WinInvalidateRegion( hwnd, NULL, FALSE );
}
/**************************************************************************
 *
 *  Name       : MyWindowProc
 *
 *  Description: The window procedure associated with the client area in
 *               the standard frame window. It processes all messages
 *               either sent or posted to the client area, depending on
 *               the message command and parameters.
 *
 *  Concepts   :
 *
 *  API's      :   WinLoadString
 *                 WinInvalidateRegion
 *                 WinPostMsg
 *                 WinDefWindowProc
 *                 WinBeginPaint
 *                 GpiSetColor
 *                 GpiSetBackColor
 *                 GpiSetBackMix
 *                 GpiCharStringAt
 *                 WinEndPaint
 *
 *  Parameters :  hwnd = window handle
 *                msg = message code
 *                mp1 = first message parameter
 *                mp2 = second message parameter
 *
 *  Return     :  depends on message sent
 *
 *************************************************************************/
MRESULT EXPENTRY MyWindowProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 )
{
  switch( msg )
  {
      case WM_TIMER: {
          WinInvalidateRegion( hwnd, 0L, FALSE );
          break;
        }
    case WM_CREATE:
      /*
       * Window initialization is performed here in WM_CREATE processing
       * WinLoadString loads strings from the resource file.
       */
      WinLoadString( hab, (HMODULE)0L, IDS_HELLO, STRINGLENGTH, szHello );
      WinLoadString( hab, (HMODULE)0L, IDS_1,     STRINGLENGTH, sz1     );
      WinLoadString( hab, (HMODULE)0L, IDS_2,     STRINGLENGTH, sz2     );
      WinLoadString( hab, (HMODULE)0L, IDS_3,     STRINGLENGTH, sz3     );
      strcpy( szString, szHello );      /* Copy text Hello into szString*/
      break;

    case WM_COMMAND:
      /*
       * When the user chooses option 1, 2, or 3 from the Options pull-
       * down, the text string is set to 1, 2, or 3, and
       * WinInvalidateRegion sends a WM_PAINT message.
       * When Exit is chosen, the application posts itself a WM_CLOSE
       * message.
       */
      {
      USHORT command;                   /* WM_COMMAND command value     */
      command = SHORT1FROMMP(mp1);      /* Extract the command value    */
      switch (command)
      {
        case ID_EXITPROG:
          WinPostMsg( hwnd, WM_CLOSE, (MPARAM)0, (MPARAM)0 );
          break;
        default:
          return WinDefWindowProc( hwnd, msg, mp1, mp2 );
      }

      break;
      }
    case WM_ERASEBACKGROUND:
      /*
       * Return TRUE to request PM to paint the window background
       * in SYSCLR_WINDOW.
       */
      return (MRESULT)( TRUE );
    case WM_PAINT:
      /*
       * Window contents are drawn here in WM_PAINT processing.
       */
      {
      HPS    hps;                       /* Presentation Space handle    */
      RECTL  rc;                        /* Rectangle coordinates        */
      POINTL pt;                        /* String screen coordinates    */
      POINTL pPos;
      LONG lColor,r,g,b;
      FATTRS fat;
      HPS shps = WinGetScreenPS(HWND_DESKTOP);
fat.usRecordLength = sizeof(FATTRS); /* sets size of structure   */
fat.fsSelection = 0;         /* uses default selection           */
fat.lMatch = 0L;             /* does not force match             */
fat.idRegistry = 0;          /* uses default registry            */
fat.usCodePage = 0;        /* code-page 850                    */
fat.lMaxBaselineExt = 14L;   /* requested font height is 12 pels */
fat.lAveCharWidth = 14L;     /* requested font width is 12 pels  */
fat.fsType = 0;              /* uses default type                */
fat.fsFontUse = FATTR_FONTUSE_NOMIX;/* doesn't mix with graphics */
strcpy(fat.szFacename ,"Courier");
      WinQueryPointerPos(HWND_DESKTOP, &pPos);
      hps = WinBeginPaint( hwnd, 0L, &rc );
      GpiCreateLogColorTable(shps, 0, LCOLF_RGB, 0, 0, NULL);
      GpiCreateLogColorTable(hps, 0, LCOLF_RGB, 0, 0, NULL);
      pt.x = 10; pt.y = 27;             /* Set the text coordinates,    */
      lColor=GpiQueryPel(shps, &pPos);
      GpiSetBackColor( hps, 16777215);  /* its background and    */
      WinFillRect( hps, &rc, lColor);
      GpiSetBackMix( hps, BM_OVERPAINT );      /* how it mixes,         */
      b = lColor & 0x000000FF;
      lColor = lColor >> 8;
      g = lColor & 0x000000FF;
      lColor = lColor >> 8;
      r = lColor & 0x000000FF;
      WinReleasePS(shps);
      sprintf(szString,"Color: #%.2X%.2X%.2X",r,g,b);
      GpiCreateLogFont(hps, NULL, 1L, &fat);
      GpiSetCharSet(hps, 1L);
      GpiSetCharMode(hps, CM_MODE1);
      GpiCharStringAt( hps,&pt ,(LONG)strlen( szString ), szString );
      WinEndPaint( hps );                      /* Drawing is complete   */
      break;
      }
    case WM_CLOSE:
      WinPostMsg( hwnd, WM_QUIT, (MPARAM)0,(MPARAM)0 );/* Cause termination*/
      break;
    default:
      /*
       * Everything else comes here.  This call MUST exist
       * in your window procedure.
       */

      return WinDefWindowProc( hwnd, msg, mp1, mp2 );
  }
  return (MRESULT)FALSE;
} /* End of MyWindowProc */
Beispiel #6
0
 static void Say( char *str )
 {
     if( str != NULL ) strcpy( Message, str );
     WinInvalidateRegion( hwndClient, 0L, FALSE );
 }
Beispiel #7
0
/**************************************************************************
 *
 *  Name       : MyWindowProc
 *
 *  Description: The window procedure associated with the client area in
 *               the standard frame window. It processes all messages
 *               either sent or posted to the client area, depending on
 *               the message command and parameters.
 *
 *  Concepts   :
 *
 *  API's      :   WinLoadString
 *                 WinInvalidateRegion
 *                 WinPostMsg
 *                 WinDefWindowProc
 *                 WinBeginPaint
 *                 GpiSetColor
 *                 GpiSetBackColor
 *                 GpiSetBackMix
 *                 GpiCharStringAt
 *                 WinEndPaint
 *
 *  Parameters :  hwnd = window handle
 *                msg = message code
 *                mp1 = first message parameter
 *                mp2 = second message parameter
 *
 *  Return     :  depends on message sent
 *
 *************************************************************************/
MRESULT EXPENTRY MyWindowProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 )
{
  switch( msg )
  {
    case WM_CREATE:
      /*
       * Window initialization is performed here in WM_CREATE processing
       * WinLoadString loads strings from the resource file.
       */
      WinLoadString( hab, (HMODULE)0L, IDS_HELLO, STRINGLENGTH, szHello );
      WinLoadString( hab, (HMODULE)0L, IDS_1,     STRINGLENGTH, sz1     );
      WinLoadString( hab, (HMODULE)0L, IDS_2,     STRINGLENGTH, sz2     );
      WinLoadString( hab, (HMODULE)0L, IDS_3,     STRINGLENGTH, sz3     );
      strcpy( szString, szHello );      /* Copy text Hello into szString*/
      break;

    case WM_COMMAND:
      /*
       * When the user chooses option 1, 2, or 3 from the Options pull-
       * down, the text string is set to 1, 2, or 3, and
       * WinInvalidateRegion sends a WM_PAINT message.
       * When Exit is chosen, the application posts itself a WM_CLOSE
       * message.
       */
      {
      USHORT command;                   /* WM_COMMAND command value     */
      command = SHORT1FROMMP(mp1);      /* Extract the command value    */
      switch (command)
      {
        case ID_OPTION1:
          strcpy( szString, sz1 );
          WinInvalidateRegion( hwnd, 0L, false );
          LockIt();
          break;
        case ID_OPTION2:
          strcpy( szString, sz2 );
          WinInvalidateRegion( hwnd, 0L, false );
          UnLockIt();
          break;
        case ID_OPTION3:
#pragma aux int3 = "int 3";
          int3();
          strcpy( szString, sz3 );
          WinInvalidateRegion( hwnd, 0L, false );
          break;
        case ID_EXITPROG:
          WinPostMsg( hwnd, WM_CLOSE, (MPARAM)0, (MPARAM)0 );
          break;
        default:
          return WinDefWindowProc( hwnd, msg, mp1, mp2 );
      }

      break;
      }
    case WM_ERASEBACKGROUND:
      /*
       * Return true to request PM to paint the window background
       * in SYSCLR_WINDOW.
       */
      return (MRESULT)( true );
    case WM_PAINT:
      /*
       * Window contents are drawn here in WM_PAINT processing.
       */
      {
      HPS    hps;                       /* Presentation Space handle    */
      RECTL  rc;                        /* Rectangle coordinates        */
      POINTL pt;                        /* String screen coordinates    */
      char   buff[256];
                                        /* Create a presentation space  */
      sprintf( buff, "hab = %8.8x, hmq = %8.8x, hwnd = %8.8x", hab, hmq, hwnd );
      hps = WinBeginPaint( hwnd, 0L, &rc );
      pt.x = 0; pt.y = 50;              /* Set the text coordinates,    */
      GpiSetColor( hps, CLR_NEUTRAL );         /* colour of the text,   */
      GpiSetBackColor( hps, CLR_BACKGROUND );  /* its background and    */
      GpiSetBackMix( hps, BM_OVERPAINT );      /* how it mixes,         */
                                               /* and draw the string...*/
      GpiCharStringAt( hps, &pt, (LONG)strlen( buff ), buff );
      WinEndPaint( hps );                      /* Drawing is complete   */
      break;
      }
    case WM_CLOSE:
      /*
       * This is the place to put your termination routines
       */
      WinPostMsg( hwnd, WM_QUIT, (MPARAM)0,(MPARAM)0 );/* Cause termination*/
      break;
    default:
      /*
       * Everything else comes here.  This call MUST exist
       * in your window procedure.
       */

      return WinDefWindowProc( hwnd, msg, mp1, mp2 );
  }
  return( (MRESULT)false );
} /* End of MyWindowProc */