Ejemplo n.º 1
0
MRESULT EXPENTRY ClkWndProc (HWND hwnd, ULONG usMsg, MPARAM mp1, MPARAM mp2)
{
    switch (usMsg) {

    case WM_CREATE:
	ClkCreate (hwnd);
	return (WinDefWindowProc (hwnd, usMsg, mp1, mp2));

    case WM_DESTROY:
	ClkDestroy (hwnd);
	return (WinDefWindowProc (hwnd, usMsg, mp1, mp2));

    case WM_PAINT:
	ClkPaint (hwnd);
	break;

    case WM_SIZE:
	ClkSize (hwnd);
	return (WinDefWindowProc (hwnd, usMsg, mp1, mp2));

    default:
	/* let default window procedure handle it. */
	return (WinDefWindowProc (hwnd, usMsg, mp1, mp2));
    }

    return (MRFROMLONG(0));
}
Ejemplo n.º 2
0
/*
	SaverWindowProc
	This is the window procedure of the screen-size window that is
	created when the saver starts.
	There should be no reason to alter the code.
	Note that we do not process WM_PAINT messages. They are forwarded to
	the default window procedure, which just validates the window area
	and does no drawing. All drawing to the window should be done in
	the drawing-thread. Therefore, if you want to blank the screen before
	drawing on it for instance, issue a WinFillRect call at the beginning
	of your drawing-thread.
*/
MRESULT EXPENTRY SaverWindowProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
	switch(msg){
	case WM_CREATE:
		// reset the "stop" flag
		stop_draw_thread = FALSE;
		// store window handle
		hwndSaver = hwnd;
		// get presentation space
		hps = WinGetPS(hwnd);
		// start the drawing-thread
		tidDraw = _beginthread(draw_thread, NULL, STACKSIZE, NULL);
		// create thread to control priority of drawing thread
		if(low_priority){
			stop_priority_thread = FALSE;
			DosCreateThread(&tidPriority, (PFNTHREAD)priority_thread, 0, 2L, 1000);
		}
		return (MRESULT)FALSE;
	case WM_DESTROY:
		// release the presentation space
		WinReleasePS(hps);
		break;
	case WM_PAINT:
		// just validate the update area. all drawing is done
		// in the drawing-thread.
		return WinDefWindowProc(hwnd, msg, mp1, mp2);
	}
	return WinDefWindowProc(hwnd, msg, mp1, mp2);
}
MRESULT __CPP_EXPORT__ EXPENTRY OWinDefDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
 switch(msg)
  {
   case WM_INITDLG:
     if (!mp2) return(MRESULT(TRUE));
     WinSetWindowULong(hwnd, QWL_USER, (ULONG)mp2);
     if (!OApp::OCMDTrace(hwnd, msg, mp1, mp2))
       return(WinDefDlgProc(hwnd, msg, mp1, mp2));
     break;

   case DM_DRAGOVER:
     if (OApp::OCMDTrace(hwnd, msg, mp1, mp2))
       return(MPFROM2SHORT(DOR_DROP, DO_UNKNOWN));
     else
       return(MPFROM2SHORT(DOR_NODROP, DO_UNKNOWN));

   case WM_CONTROL:
     if(SHORT2FROMMP(mp1) == CN_DRAGOVER)
      {
       if (OApp::OCMDTrace(hwnd, msg, mp1, mp2))
         return(MPFROM2SHORT(DOR_DROP, DO_UNKNOWN));
       else
         return(MPFROM2SHORT(DOR_NODROP, DO_UNKNOWN));
      }
     else if (!OApp::OCMDTrace(hwnd, msg, mp1, mp2))
       return(WinDefWindowProc(hwnd, msg, mp1, mp2));
     break;

   case WM_HITTEST:
     if (!OApp::OCMDTrace(hwnd, msg, mp1, mp2))
       return(WinDefWindowProc(hwnd, msg, mp1, mp2));
     else
       return(MPFROMSHORT(HT_NORMAL));

   case WM_DRAWITEM:
     return(MRESULT(OApp::OCMDTrace(hwnd, msg, mp1, mp2)));

   case WM_CLOSE:
   case WM_DESTROY: {
     BOOL dispatched = OApp::OCMDTrace(hwnd, msg, mp1, mp2);
     WinSetWindowULong(hwnd, QWL_USER, (ULONG)OApp::currentOApp->NullHandler());
     if (!dispatched)
       return(WinDefWindowProc(hwnd, msg, mp1, mp2));
     break; }

   default:
     if (!OApp::OCMDTrace(hwnd, msg, mp1, mp2))
       return(WinDefDlgProc(hwnd, msg, mp1, mp2));
     break;
  }
 return(MRESULT(FALSE));
}
Ejemplo n.º 4
0
/*
	SaverWindowProc
	This is the window procedure of the screen-size window that is
	created when the saver starts.
	There should be no reason to alter the code.
	Note that we do not process WM_PAINT messages. They are forwarded to
	the default window procedure, which just validates the window area
	and does no drawing. All drawing to the window should be done in
	the drawing-thread. Therefore, if you want to blank the screen before
	drawing on it for instance, issue a WinFillRect call at the beginning
	of your drawing-thread.
*/
MRESULT EXPENTRY SaverWindowProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
	switch(msg){
	case WM_CREATE:
		/* reset the "stop" flag */
		stop_draw_thread = FALSE;
		/* store window handle */
		hwndSaver = hwnd;
		/* get presentation space */
		hps = WinGetPS(hwnd);
		/* start the drawing-thread */
/*
		$$$$$ note $$$$$
		Some compilers use another parameter ordering for
		_beginthread. The _beginthread call below works with EMX,
		ICC and BCC. Check your compiler docs for other compilers.
*/
#if defined(__BORLANDC__)
		/* for Borland C++ */
		tidDraw = _beginthread(draw_thread, STACKSIZE, NULL);
#elif defined(__EMX__) || defined(__IBMC__)
		/* for EMX and ICC */
		tidDraw = _beginthread(draw_thread, NULL, STACKSIZE, NULL);
#endif
		/* create thread to control priority of drawing thread */
		if(low_priority){
			stop_priority_thread = FALSE;
			DosCreateThread(&tidPriority, (PFNTHREAD)priority_thread, 0, 2L, 1000);
		}
		/* create timer that moves the saver window to top regularly */
		WinStartTimer(hab, hwndSaver, IDT_ZORDERTIMER, ZORDERTIMERSTEP);
		return (MRESULT)FALSE;
	case WM_TIMER:
		if(SHORT1FROMMP(mp1) == IDT_ZORDERTIMER){
			/* move saver window to top */
			WinSetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, SWP_ZORDER);
			return (MRESULT)0;
		}
		break;
	case WM_DESTROY:
		/* release the presentation space */
		WinReleasePS(hps);
		/* stop the z-order timer */
		WinStopTimer(hab, hwndSaver, IDT_ZORDERTIMER);
		break;
	case WM_PAINT:
		/* just validate the update area. all drawing is done */
		/* in the drawing-thread.                             */
		return WinDefWindowProc(hwnd, msg, mp1, mp2);
	}
	return WinDefWindowProc(hwnd, msg, mp1, mp2);
}
MRESULT EXPENTRY ClientWndProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
     {
     static BOOL fFlipFlop ;
     HPS         hps ;
     RECTL       rcl ;

     switch (msg)
          {
          case WM_TIMER:
               WinAlarm (HWND_DESKTOP, WA_NOTE) ;
               fFlipFlop = !fFlipFlop ;
               WinInvalidateRect (hwnd, NULL, FALSE) ;
               return 0 ;

          case WM_PAINT:
               hps = WinBeginPaint (hwnd, NULLHANDLE, NULL) ;

               WinQueryWindowRect (hwnd, &rcl) ;
               WinFillRect (hps, &rcl, fFlipFlop ? CLR_BLUE : CLR_RED) ;

               WinEndPaint (hps) ;
               return 0 ;
          }
     return WinDefWindowProc (hwnd, msg, mp1, mp2) ;
     }
MRESULT EXPENTRY ClientWndProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
     {
     static HBITMAP hbm ;
     HPS            hps ;
     RECTL          rcl ;

     switch (msg)
          {
          case WM_CREATE:
               hps = WinGetPS (hwnd) ;
               hbm = GpiLoadBitmap (hps, 0, IDB_HELLO, 0L, 0L) ;
               WinReleasePS (hps) ;
               return 0 ;

          case WM_PAINT:
               hps = WinBeginPaint (hwnd, NULLHANDLE, NULL) ;
               GpiErase (hps) ;

               WinQueryWindowRect (hwnd, &rcl) ;

               if (hbm)
                    WinDrawBitmap (hps, hbm, NULL, (PPOINTL) &rcl,
                                   CLR_BACKGROUND, CLR_NEUTRAL, DBM_STRETCH) ;

               WinEndPaint (hps) ;
               return 0 ;

          case WM_DESTROY:
               if (hbm)
                    GpiDeleteBitmap (hbm) ;               
               return 0 ;
          }
     return WinDefWindowProc (hwnd, msg, mp1, mp2) ;
     }
MRESULT EXPENTRY ClientWndProc (HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
    HPS     hps;
    BOOL    bHandled = TRUE;
    MRESULT mReturn  = 0;

    switch (msg)
    {
        case WM_PAINT:
            hps = WinBeginPaint (hWnd,0,0);
            WinEndPaint (hps);
            break;

        case WM_ERASEBACKGROUND:
            mReturn = MRFROMLONG(1L);
            break;

		  case WM_COMMAND:
		      switch (LOUSHORT(mp1))
            {
                case IDM_ABOUT:
                    DisplayAbout (hWnd, szTitle);
                    break;
            }

        default:
            bHandled = FALSE;
            break;
    }

    if (!bHandled)
        mReturn = WinDefWindowProc (hWnd,msg,mp1,mp2);

    return (mReturn);
}
Ejemplo n.º 8
0
MRESULT clbQueryWparms(PCLBOX pclb, PWNDPARAMS pwpm) {
   // parametri presentazione: usa procedura default
   if (isOrdWndParm(pwpm->fsStatus))
      return(WinDefWindowProc(pclb->hwnd, WM_QUERYWINDOWPARAMS,
                              (MPARAM)pwpm, MPVOID));
   // testo finestra
   if (pwpm->fsStatus & WPM_TEXT) {
      if (pclb->fl & CLBXS_CHECK && pclb->hchk) {
         WinQueryWindowText(pclb->hchk, pwpm->cchText, pwpm->pszText);
      } else if (pclb->cbtxt) {
         memcpy((PVOID)pwpm->pszText, (PVOID)pclb->psz,
                min(pwpm->cchText, pclb->cbtxt) + 1);
      } else {
         if (pwpm->cchText) *(pwpm->pszText) = '\0';
      } /* endif */
   } /* endif */
   // lunghezza testo finestra
   if (pwpm->fsStatus & WPM_CCHTEXT) {
      if (pclb->fl & CLBXS_CHECK && pclb->hchk)
         pwpm->cchText = (pclb->fl & CLBXS_CHECK && pclb->hchk)?
                         WinQueryWindowTextLength(pclb->hchk): pclb->cbtxt;
   } /* endif */
   if (pwpm->fsStatus & WPM_CTLDATA) {
      if (pwpm->cbCtlData < sizeof(CLBOXCDATA)) return (MRESULT)FALSE;
      ((PCLBOXCDATA)pwpm->pCtlData)->cb =  sizeof(CLBOXCDATA);
      ((PCLBOXCDATA)pwpm->pCtlData)->cch = pclb->cchef;
   } /* endif */
   if (pwpm->fsStatus & WPM_CBCTLDATA) {
      pwpm->cbCtlData = sizeof(CLBOXCDATA);
   } /* endif */
   return (MRESULT)TRUE;
}
Ejemplo n.º 9
0
MRESULT EXPENTRY ClientWndProc (HWND hwnd, ULONG msg, 
                                        MPARAM mp1, MPARAM mp2)

{
HPS hps;
RECTL rcl;

switch (msg)
    {
    case WM_CREATE:
        return 0;

    case WM_PAINT:
        hps=WinBeginPaint(hwnd, NULLHANDLE, NULL);
        WinQueryWindowRect(hwnd, &rcl);
        GpiErase(hps);
        WinFillRect(hps, &rcl, CLR_BLUE);
        PaintClient(hps, 100, 100);

        WinEndPaint(hps);
        return 0;

    case WM_DESTROY:
        return 0;
    }
return WinDefWindowProc(hwnd, msg, mp1, mp2);
}
Ejemplo n.º 10
0
VOID PumpMessageQueue( VOID )
{
    char        class_name[80];
    QMSG        qmsg;
    ERRORID     err;
    ULONG       ulCount;

    for( ;; ) {
        DosWaitEventSem( PumpMessageSem, SEM_INDEFINITE_WAIT );
        DosResetEventSem( PumpMessageSem, &ulCount );
        WinThreadAssocQueue( GUIGetHAB(), GUIPMmq );
        while ( WinGetMsg( GUIGetHAB(), &qmsg, 0L, 0, 0 ) ) {
            WinQueryClassName( qmsg.hwnd, sizeof( class_name ), class_name );
            if (strcmp( class_name, "GUIClass" ) == 0 ||
                strcmp( class_name, "WTool" ) == 0) {
                WinDefWindowProc( qmsg.hwnd, qmsg.msg, qmsg.mp1, qmsg.mp2 );
            } else {
                WinDispatchMsg( GUIGetHAB(), &qmsg );
            }
        }
        WinThreadAssocQueue( GUIGetHAB(), NULL );
        err = WinGetLastError( GUIGetHAB() );
        DosPostEventSem( PumpMessageDoneSem );
    }
}
Ejemplo n.º 11
0
Archivo: hin.c Proyecto: komh/hanedit2
MRESULT APIENTRY HIA_WndProc(HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2)
{
   switch (msg) {
   case WM_CREATE:              return hia_wmCreate(hwnd,mp1,mp2);
   case WM_DESTROY:             return hia_wmDestroy(hwnd,mp1,mp2);
   case WM_CHAR:                return hia_wmChar(hwnd,mp1,mp2);

   case HIAM_CONNECT:           return hia_usermConnect(hwnd,mp1,mp2);
   case HIAM_REGISTERNOTIFY:    return hia_usermRegisterNotify(hwnd,mp1,mp2);
   case HIAM_UNREGISTERNOTIFY:  return hia_usermUnregisterNotify(hwnd,mp1,mp2);

   case HIAM_COMPLETEHCH:       return hia_usermCompleteHch(hwnd,mp1,mp2);
   case HIAM_CANCELBUF:         return hia_usermCancelBuf(hwnd,mp1,mp2);
   case HIAM_CANCELKEY:         return hia_usermCancelKey(hwnd,mp1,mp2);
   case HIAM_CHANGEHANMODE:     return hia_usermChangeHanMode(hwnd,mp1,mp2);
   case HIAM_CHANGEINSERTMODE:  return hia_usermChangeInsertMode(hwnd,mp1,mp2);
   case HIAM_CHANGEKBDTYPE:     return hia_usermChangeKbdType(hwnd,mp1,mp2);
   case HIAM_SETKBDTYPE:        return hia_usermSetKbdType(hwnd,mp1,mp2);
   case HIAM_SETHANMODE:        return hia_usermSetHanMode(hwnd,mp1,mp2);
   case HIAM_SETINSERTMODE:     return hia_usermSetInsertMode(hwnd,mp1,mp2);
   case HIAM_QUERYWORKINGHCH:   return hia_usermQueryWorkingHch(hwnd,mp1,mp2);
   case HIAM_QUERYSTATE:        return hia_usermQueryState(hwnd,mp1,mp2);

   case HIAM_QUERYHANJAKEYCHECKPROC:        return hia_usermQueryHanjaKeyCheckProc( hwnd, mp1, mp2 );
   case HIAM_SETHANJAKEYCHECKPROC:          return hia_usermSetHanjaKeyCheckProc( hwnd, mp1, mp2 );
   case HIAM_QUERYSPECIALCHARKEYCHECKPROC:  return hia_usermQuerySpecialCharKeyCheckProc( hwnd, mp1, mp2 );
   case HIAM_SETSPECIALCHARKEYCHECKPROC:    return hia_usermSetSpecialCharKeyCheckProc( hwnd, mp1, mp2 );

   default:                     return WinDefWindowProc(hwnd,msg,mp1,mp2);
   }
}
Ejemplo n.º 12
0
MRESULT EXPENTRY MainClientProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
    WindowCellCtlData *pWCtlData = 0;

    pWCtlData = (WindowCellCtlData *)WinQueryWindowULong(hwnd, QWL_USER);

    switch(msg)
    {
        case WM_COMMAND:
            switch(SHORT1FROMMP(mp1))
            {
                case IDB_EXIT:
					WinPostMsg(hwnd, WM_QUIT, 0L, 0L);
                    return ((MRESULT) NULL);

                case ID_LPANE  :OKMsgBox("Button ID_LPANE pressed!"); break;
                case ID_RPANE  :OKMsgBox("Button ID_RPANE pressed!"); break;
                case MAIN_FRAME:OKMsgBox("Button MAIN_FRAME pressed!"); break;
                case ID_TOOLBAR:OKMsgBox("Button ID_TOOLBAR pressed!"); break;
            }
            break;

        case WM_CLOSE:
			WinPostMsg(hwnd, WM_QUIT, 0L, 0L);
			return ((MRESULT) NULL);
    }
    if(pWCtlData)
        return pWCtlData->pOldProc(hwnd, msg, mp1, mp2);

    return WinDefWindowProc(hwnd, msg, mp1, mp2);
}
Ejemplo n.º 13
0
static void APIENTRY SoftModeThread( thread_data *thread )
{
    QMSG        qmsg;
    ULONG       rc;
    RECTL       rcl;
    HPS         ps;

    rc = WinThreadAssocQueue( HabDebugger, thread->hmq );
    rc = WinSetHook( HabDebugger, thread->hmq, HK_CALLHOOK, (PFN)CallHookProc, NULLHANDLE );
    PSetHmqDebugee( thread->hmq, HwndDummy );
    rc = WinSetHook( HabDebugger, NULLHANDLE, HK_SENDMSG, (PFN)PSendMsgHookProc, HookDLL );
    while( WinQuerySendMsg( HabDebugger, NULLHANDLE, thread->hmq, &qmsg ) ) {
        WinReplyMsg( HabDebugger, NULLHANDLE, thread->hmq, (MRESULT)0 );
    }
    while( WinGetMsg( HabDebugger, &qmsg, 0, 0, 0 ) ) { // handle messages for task
        switch( qmsg.msg ) {
            case WM_PAINT:
                // don't do any painting
                ps = WinBeginPaint( qmsg.hwnd, 0, &rcl );
                WinEndPaint( ps );
                break;
            default:
                // have the default window procedure handle the rest
                WinDefWindowProc( qmsg.hwnd, qmsg.msg, qmsg.mp1, qmsg.mp2 );
        }
    }
    WinReleaseHook( HabDebugger, NULLHANDLE, HK_SENDMSG, (PFN)PSendMsgHookProc, HookDLL );
    PSetHmqDebugee( thread->hmq, NULLHANDLE );
    WinReleaseHook( HabDebugger, thread->hmq, HK_CALLHOOK, (PFN)CallHookProc, NULLHANDLE );
    WinThreadAssocQueue( HabDebugger, NULLHANDLE );
    WinPostMsg( HwndDebugger, WM_QUIT, 0, 0 ); // tell debugger we're done
}
Ejemplo n.º 14
0
Archivo: khserver.c Proyecto: komh/kime
MRESULT EXPENTRY khs_wndProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 )
{
    switch( msg )
    {
        case WM_CREATE  : return khs_wmCreate( hwnd, mp1, mp2 );
        case WM_DESTROY : return khs_wmDestroy( hwnd, mp1, mp2 );

        case KHSM_FINDWND           : return khs_umFindWnd( hwnd, mp1, mp2 );
        case KHSM_ADDWND            : return khs_umAddWnd( hwnd, mp1, mp2 );
        case KHSM_DELWND            : return khs_umDelWnd( hwnd, mp1, mp2 );
        case KHSM_QUERYHANSTATUS    : return khs_umQueryHanStatus( hwnd, mp1, mp2 );
        case KHSM_CHANGEHANSTATUS   : return khs_umChangeHanStatus( hwnd, mp1, mp2 );
        case KHSM_SETHANSTATUS      : return khs_umSetHanStatus( hwnd, mp1, mp2 );
        case KHSM_QUERYIMSTATUS     : return khs_umQueryImStatus( hwnd, mp1, mp2 );
        case KHSM_CHANGEIMSTATUS    : return khs_umChangeImStatus( hwnd, mp1, mp2 );
        case KHSM_SETIMSTATUS       : return khs_umSetImStatus( hwnd, mp1, mp2 );
        case KHSM_CHECKDBCSSUPPORT  : return khs_umCheckDBCSSupport( hwnd, mp1, mp2 );
        case KHSM_ISEXCEPTWINDOW    : return khs_umIsExceptWindow( hwnd, mp1, mp2 );
        case KHSM_RELOADEXCEPTFILE  : return khs_umReloadExceptFile( hwnd, mp1, mp2 );

#ifdef DEBUG
        case KHSM_STOREKEYINFO      : return khs_umStoreKeyInfo( hwnd, mp1, mp2 );
        case KHSM_STOREMSG          : return khs_umStoreMsg( hwnd, mp1, mp2 );
#endif
    }

    return WinDefWindowProc( hwnd, msg, mp1, mp2 );
}
Ejemplo n.º 15
0
MRESULT EXPENTRY HCHLBWndProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 )
{
    switch( msg )
    {
        case WM_CREATE   : return hchlb_wmCreate( hwnd, mp1, mp2 );
        case WM_DESTROY  : return hchlb_wmDestroy( hwnd, mp1, mp2 );
        case WM_SIZE     : return hchlb_wmSize( hwnd, mp1, mp2 );
        case WM_SETFOCUS : return hchlb_wmSetFocus( hwnd, mp1, mp2 );
        case WM_PAINT    : return hchlb_wmPaint( hwnd, mp1, mp2 );
        case WM_VSCROLL  : return hchlb_wmVscroll( hwnd, mp1, mp2 );

        case HCHLM_QUERYCOUNT     : return hchlb_umQueryCount( hwnd, mp1, mp2 );
        case HCHLM_DELETEALL      : return hchlb_umDeleteAll( hwnd, mp1, mp2 );
        case HCHLM_DELETE         : return hchlb_umDelete( hwnd, mp1, mp2 );
        case HCHLM_INSERT         : return hchlb_umInsert( hwnd, mp1, mp2 );
        case HCHLM_QUERYHCH       : return hchlb_umQueryHch( hwnd, mp1, mp2 );
        case HCHLM_QUERYSELECTION : return hchlb_umQuerySelection( hwnd, mp1, mp2 );
        case HCHLM_QUERYTOPINDEX  : return hchlb_umQueryTopIndex( hwnd, mp1, mp2 );
        case HCHLM_SETTOPINDEX    : return hchlb_umSetTopIndex( hwnd, mp1, mp2 );
        case HCHLM_SEARCHHCH      : return hchlb_umSearchHch( hwnd, mp1, mp2 );
        case HCHLM_SELECTITEM     : return hchlb_umSelectItem( hwnd, mp1, mp2 );
        case HCHLM_QUERYVERTINT   : return hchlb_umQueryVertInt( hwnd, mp1, mp2 );
        case HCHLM_SETVERTINT     : return hchlb_umSetVertInt( hwnd, mp1, mp2 );
        case HCHLM_QUERYHORZINT   : return hchlb_umQueryHorzInt( hwnd, mp1, mp2 );
        case HCHLM_SETHORZINT     : return hchlb_umSetHorzInt( hwnd, mp1, mp2 );
        case HCHLM_REFRESH        : return hchlb_umRefresh( hwnd, mp1, mp2 );

        default         : return WinDefWindowProc( hwnd, msg, mp1, mp2 );
    }
}
MRESULT EXPENTRY ClientWndProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
     {
     static CHAR     *szMenuText [3] = { NULL,
                                         "A~bout PoorMenu...",
                                         "~Help..." } ;
     static MENUITEM mi [3] = {
                              MIT_END, MIS_SEPARATOR, 0, 0,         0, 0,
                              MIT_END, MIS_TEXT,      0, IDM_ABOUT, 0, 0,
                              MIT_END, MIS_TEXT,      0, IDM_HELP,  0, 0
                              } ;
     HWND            hwndSysMenu, hwndSysSubMenu ;
     INT             iItem, idSysMenu ;
     MENUITEM        miSysMenu ;

     switch (msg)
          {
          case WM_CREATE:
               hwndSysMenu = WinWindowFromID (
                                  WinQueryWindow (hwnd, QW_PARENT),
                                  FID_SYSMENU) ;

               idSysMenu = SHORT1FROMMR (WinSendMsg (hwndSysMenu,
                                                     MM_ITEMIDFROMPOSITION,
                                                     NULL, NULL)) ;

               WinSendMsg (hwndSysMenu, MM_QUERYITEM,
                           MPFROM2SHORT (idSysMenu, FALSE),
                           MPFROMP (&miSysMenu)) ;

               hwndSysSubMenu = miSysMenu.hwndSubMenu ;

               for (iItem = 0 ; iItem < 3 ; iItem++)
                    WinSendMsg (hwndSysSubMenu, MM_INSERTITEM,
                                MPFROMP (mi + iItem),
                                MPFROMP (szMenuText [iItem])) ;
               return 0 ;

          case WM_COMMAND:
               switch (COMMANDMSG(&msg)->cmd)
                    {
                    case IDM_ABOUT:
                         WinMessageBox (HWND_DESKTOP, hwnd,
                                   "(C) Charles Petzold, 1993",
                                   szCaption, 0, MB_OK | MB_INFORMATION) ;
                         return 0 ;

                    case IDM_HELP:
                         WinMessageBox (HWND_DESKTOP, hwnd,
                                   "Help not yet implemented",
                                   szCaption, 0, MB_OK | MB_WARNING) ;
                         return 0 ;
                    }
               break ;

          case WM_ERASEBACKGROUND:
               return MRFROMSHORT (1) ;
          }
     return WinDefWindowProc (hwnd, msg, mp1, mp2) ;
     }
Ejemplo n.º 17
0
static MRESULT EXPENTRY AttribSelectProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
   PATTRIBSELECTDATA pWinData = WinQueryWindowPtr(hwnd, QWL_USER);

   switch(msg)
   {
      case WM_CREATE:
         return (MRESULT) CreateWindow(hwnd, (PCREATESTRUCT) mp2);

      case WM_DESTROY:
         DestroyWindow(pWinData);
         break;

      case WM_HELP:
         /* Weiterleiten mit eigener ID */
         mp1 = MPFROMSHORT(WinQueryWindowUShort(hwnd, QWS_ID));
         break;

      case ATTSM_SETATTRIB:
         return (MRESULT) SetAttrib(hwnd, pWinData, (ULONG) mp1, (ULONG) mp2);

      case ATTSM_QUERYATTRIB:
         return (MRESULT) QueryAttrib(pWinData);

      case WM_CONTROL:
         if (SHORT1FROMMP(mp1) == ATTSID_VALUE)
         {
            switch(SHORT2FROMMP(mp1))
            {
               case VN_ENTER:
                  AttribClicked(hwnd, pWinData, SHORT1FROMMP(mp2), SHORT2FROMMP(mp2));
                  break;

               case VN_HELP:
#if 0
                  WinPostMsg(WinQueryWindow(hwnd, QW_OWNER), WM_HELP,
                             MPFROMSHORT(WinQueryWindowUShort(hwnd, QWS_ID)),
                             mp2);
#endif
                  break;
            }
         }
         break;

      case WM_DRAWITEM:
         if (SHORT1FROMMP(mp1) == ATTSID_VALUE)
            return (MRESULT) DrawItem(pWinData, (POWNERITEM) mp2);
         else
            break;

      case WM_QUERYDLGCODE:
         return WinSendMsg(pWinData->hwndValueSet, msg, mp1, mp2);

      default:
         break;
   }
   return WinDefWindowProc(hwnd, msg, mp1, mp2);
}
MRESULT EXPENTRY MyWindowProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
  SWP   swp;
  ULONG rc;

  HWND  hFrame;
  HWND  hListBox;                                /* Listbox window handle    */

  switch (msg)
         {
         case WM_CREATE:
              hListBox = WinCreateWindow(hwnd,
                                         WC_LISTBOX,
                                         NULL,
                                         WS_VISIBLE     |
                                         LS_NOADJUSTPOS |
                                         LS_HORZSCROLL,
                                         0, 0, 0, 0,
                                         hwnd,
                                         HWND_TOP,
                                         ID_LISTBOX,
                                         0,
                                         0);

              pwpList = WinSubclassWindow(hListBox,
                           wpSubList);

              hFrame = WinQueryWindow(hwnd,
                                      QW_PARENT);
              rc = WinSetWindowPos(hFrame,
                                   HWND_TOP,
                                   0, 0,
                                   400, 300,
                                   SWP_SIZE     |
                                   SWP_ACTIVATE |
                                   SWP_SHOW);
              break;

         case WM_SIZE:
              WinQueryWindowPos(hwnd, &swp);
              hListBox=WinWindowFromID(hwnd,
                                       ID_LISTBOX);
              WinSetWindowPos(hListBox,
                              HWND_TOP,
                              swp.x, swp.y,
                              swp.cx, swp.cy,
                              SWP_SIZE  |
                              SWP_SHOW);
              break;

         default:
              return(WinDefWindowProc(hwnd,
                                      msg,
                                      mp1,
                                      mp2));
         }
  return((MRESULT)FALSE);
}
Ejemplo n.º 19
0
MRESULT EXPENTRY ClientWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
   HPS      hps;
   RECTL    rcl;
   static ULONG    i = 1;
   ULONG    ulMem;
   char     szBuf[200];

   switch (msg) {
      case WM_CREATE:
         /* use smaller text */
         WinSetPresParam(hwnd, PP_FONTNAMESIZE, 7, (PVOID)"8.Helv");
         /* start the timer (ticks each 0.5 sec.) */
         AddFloat(WinQueryWindow(hwnd, QW_PARENT));
         WinStartTimer(hab, hwnd, ID_TIMER, 500);
         break;

      /* make window always stay on top (if desired) */
      case WM_VRNENABLED:
         if (bFloat)
            WinSetWindowPos(hwndFrame, HWND_TOP, 0, 0, 0, 0, SWP_ZORDER);
         break;

      case WM_COMMAND:  /* why doesn't WM_SYSCOMMAND work? */
         if (LOUSHORT(mp1) == IDM_FLOAT) {
            bFloat = !bFloat;
            WinCheckMenuItem(hwndSysSubmenu, IDM_FLOAT, bFloat);
         }
         break;

      case WM_TIMER:
         if (++i > 13)
            i = 1;
         WinInvalidateRect(hwnd, NULL, FALSE);
         return FALSE;

      case WM_PAINT:
         hps = WinBeginPaint(hwnd, NULLHANDLE, &rcl);
         /* necessary to avoid incorrectly repainting window */
         WinQueryWindowRect(hwnd, &rcl);

/*         sprintf(szBuf, " Current use %dK  Maximum ever used %dK  Errors %d",
                 meminfo->used / 1024,
                 meminfo->maxused / 1024, meminfo->num_err);*/
         sprintf(szBuf, " Current use %dB  Maximum ever used %dK  Errors %d",
                 meminfo->used,
                 meminfo->maxused / 1024, meminfo->num_err);
         WinDrawText(hps, -1, szBuf, &rcl, CLR_BLACK, CLR_WHITE,
                     DT_CENTER | DT_VCENTER | DT_ERASERECT);

         WinEndPaint(hps);
         break;
   }

   return WinDefWindowProc(hwnd, msg, mp1, mp2);
}
Ejemplo n.º 20
0
MRESULT EXPENTRY EventWindowProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
  if (msg == sMsgId) {
    nsAppShell *as = reinterpret_cast<nsAppShell *>(mp2);
    as->NativeEventCallback();
    NS_RELEASE(as);
    return (MRESULT)TRUE;
  }
  return WinDefWindowProc(hwnd, msg, mp1, mp2);
}
Ejemplo n.º 21
0
/*
 *  FUNCTION:   DragWndProc
 *
 *  DESCRIPTION:
 * 
 *    Window procedure for drag window
 * 
 */
MRESULT EXPENTRY DragWndProc( HWND hwnd, ULONG msg,
                                   MPARAM mp1, MPARAM mp2 )
{
    PDRAGSTRUCT     pDragData;
    PDRAGTRANSFER   pDragTrans;
    ULONG           cbLength;
    PSZ             pBuffer;
    PSZ             pBufferEnd;
    M_SrcTransient  *somSelfClass;

	switch (msg)
	{
		case WM_CREATE:

            // Set the window pointer to our data structure
			WinSetWindowPtr(hwnd, QWL_USER, (PVOID)mp1);
            break;

        case DM_RENDER:

            // Retrieve the window pointer
			pDragData = (PDRAGSTRUCT) WinQueryWindowPtr(hwnd, QWL_USER);
			if (pDragData == NULL)
				{
				break;
				}

            // Get the DRAGTRANSFER structure
            pDragTrans = (PDRAGTRANSFER) PVOIDFROMMP(mp1);

            // Extract the target foldername and perform a copy
            // ******************************************************
            // The following few lines seem to be a bit dodgy.  If you are
            // reading this (and you are!!), and you know a better way of
            // getting object pointers to class objects etc., please send
            // me some info on CIS - 100241,1425.  I do a lot of that stuff
            // and would appreciate it if anyone could tell me how to do
            // it "cleaner"
            cbLength = DrgQueryStrName(pDragTrans->hstrRenderToName, cbLength, pBuffer);
            pBuffer = new char[cbLength+1];
            cbLength = DrgQueryStrName(pDragTrans->hstrRenderToName, cbLength, pBuffer);
            pBuffer[cbLength] = '\0';
            pBufferEnd = strrchr(pBuffer, '\\');
            pBufferEnd[0] = '\0';
            somSelfClass = (M_SrcTransient *)pDragData->somSelf->somGetClass();
            pDragData->somSelf->wpCopyObject(
                somSelfClass->wpclsQueryFolder(pBuffer, FALSE), FALSE);
            delete pBuffer;
            break;

    }   /* end switch(msg) */

	return (WinDefWindowProc(hwnd, msg, mp1, mp2) );
    
}
Ejemplo n.º 22
0
/*
	SaverWindowProc
	This is the window procedure of the screen-size window that is
	created when the saver starts.
	There should be no reason to alter the code.
	Note that we do not process WM_PAINT messages. They are forwarded to
	the default window procedure, which just validates the window area
	and does no drawing. All drawing to the window should be done in
	the drawing-thread. Therefore, if you want to blank the screen before
	drawing on it for instance, issue a WinFillRect call at the beginning
	of your drawing-thread.
*/
MRESULT EXPENTRY SaverWindowProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
	static	SIZEL	pagesize={0, 0};
	switch(msg){
	case WM_CREATE:
		// reset the "stop" flag
		stop_draw_thread = FALSE;
		// store window handle
		hwndSaver = hwnd;
		// get hdc and create normal presentation space
		hdc = WinOpenWindowDC (hwnd);
		hps = GpiCreatePS (hab, hdc, &pagesize, GPIA_ASSOC|PU_PELS|GPIT_NORMAL);
		// start the drawing-thread
		tidDraw = _beginthread(draw_thread, NULL, STACKSIZE, NULL);
		// create thread to control priority of drawing thread
		if(low_priority){
			stop_priority_thread = FALSE;
			DosCreateThread(&tidPriority, (PFNTHREAD)priority_thread, 0, 2L, 1000);
		}
		// create timer that moves the saver window to top regularly
		WinStartTimer(hab, hwndSaver, IDT_ZORDERTIMER, ZORDERTIMERSTEP);
		return (MRESULT)FALSE;
	case WM_TIMER:
		if(SHORT1FROMMP(mp1) == IDT_ZORDERTIMER){
			// move saver window to top
			WinSetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, SWP_ZORDER);
			return (MRESULT)0;
		}
		break;
	case WM_DESTROY:
		// destroy the presentation space
		GpiDestroyPS(hps);
		// stop the z-order timer
		WinStopTimer(hab, hwndSaver, IDT_ZORDERTIMER);
		break;
	case WM_PAINT:
		// just validate the update area. all drawing is done
		// in the drawing-thread.
		return WinDefWindowProc(hwnd, msg, mp1, mp2);
	}
	return WinDefWindowProc(hwnd, msg, mp1, mp2);
}
Ejemplo n.º 23
0
MRESULT EXPENTRY ClientWndProc (HWND hwnd, USHORT msg, 
                                MPARAM mp1, MPARAM mp2)
     {
     static HWND hwndMenuPopup ;
     HPS         hps ;
     POINTL      ptlMouse ;

     switch (msg)
          {
          case WM_CREATE:
               hwndMenuPopup = WinLoadMenu (hwnd, NULL, ID_POPUP) ;
               WinSetWindowPos (hwndMenuPopup, NULL, 
                                0, 0, 0, 0, SWP_SIZE) ;
               WinSetParent (hwndMenuPopup, HWND_DESKTOP, FALSE) ;
               return 0 ;

          case WM_BUTTON2UP:
               WinQueryPointerPos (HWND_DESKTOP, &ptlMouse) ;
               ptlMouse.y += WinQuerySysValue (HWND_DESKTOP, 
                                               SV_CYMENU) ;

               WinSetWindowPos (hwndMenuPopup, NULL,
                                (SHORT) ptlMouse.x, (SHORT) ptlMouse.y,
                                0, 0, SWP_MOVE) ;

               WinSendMsg (hwndMenuPopup, MM_SELECTITEM,
                           MPFROM2SHORT (IDM_POPUP, FALSE),
                           MPFROMSHORT (FALSE)) ;

               WinSetCapture (HWND_DESKTOP, hwndMenuPopup) ;
               return 0 ;

          case WM_COMMAND:
               switch (COMMANDMSG(&msg)->cmd)
                    {
                    case IDM_ABOUT:
                         WinDlgBox (HWND_DESKTOP, hwnd, AboutDlgProc,
                                    NULL, IDD_ABOUT, NULL) ;
                         return 0 ;
                    }
               break ;

          case WM_PAINT:
               hps = WinBeginPaint (hwnd, NULL, NULL) ;
               GpiErase (hps) ;
               WinEndPaint (hps) ;
               return 0 ;
          }
     return WinDefWindowProc (hwnd, msg, mp1, mp2) ;
     }
Ejemplo n.º 24
0
MRESULT APIENTRY ClientWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
	switch (msg)
	{
	case WM_ERASEBACKGROUND:	return MRFROMLONG(TRUE);
	case WM_CONTROL:		return mainwmControl(hwnd, mp1, mp2);
	case WM_CREATE:			return mainwmCreate(hwnd, mp1, mp2);
	case WM_CLOSE:			return mainwmClose(hwnd,mp1,mp2);
	case WM_CHAR:			return mainwmChar(hwnd,mp1,mp2);
	case WM_PAINT:			return mainwmPaint(hwnd,mp1,mp2);

	default:			return WinDefWindowProc(hwnd, msg, mp1, mp2);
	} /* endswitch */
}
Ejemplo n.º 25
0
MRESULT EXPENTRY OS2Factory::OS2Proc( HWND hwnd, ULONG msg,
                                      MPARAM mp1, MPARAM mp2 )
{
    // Get pointer to thread info: should only work with the parent window
    intf_thread_t *p_intf = (intf_thread_t *)WinQueryWindowPtr( hwnd, 0 );

    // If doesn't exist, treat windows message normally
    if( p_intf == NULL || p_intf->p_sys->p_osFactory == NULL )
    {
        return WinDefWindowProc( hwnd, msg, mp1, mp2 );
    }

    OS2Factory *pFactory = (OS2Factory*)OS2Factory::instance( p_intf );
    GenericWindow *pWin = pFactory->m_windowMap[hwnd];

    // Subclass a frame window
    if( !pFactory->m_pfnwpOldFrameProc )
    {
        // Store with it a pointer to the interface thread
        WinSetWindowPtr( pFactory->m_hParentWindow, 0, p_intf );

        pFactory->m_pfnwpOldFrameProc =
            WinSubclassWindow( pFactory->m_hParentWindow, OS2FrameProc );
    }

    if( hwnd != pFactory->getParentWindow() && pWin )
    {
        OS2Loop* pLoop =
            (OS2Loop*) OSFactory::instance( p_intf )->getOSLoop();
        if( pLoop )
            return pLoop->processEvent( hwnd, msg, mp1, mp2 );
    }

    // If hwnd does not match any window or message not processed
    return WinDefWindowProc( hwnd, msg, mp1, mp2 );
}
   //------------------------
   // A main window procedure
   //------------------------
   static MRESULT EXPENTRY message::MainProc (HWND hwnd, ULONG msg, MPARAM mp1,
                                                                                      MPARAM mp2)
   {
      HWND  hwndtemp;

      // Must retrieve the pointer (to all the data members) from the frame since a user pointer
      // can't be stored with a client window.

      hwndtemp = WinQueryWindow (hwnd, QW_PARENT);
      PMESSAGEDATA pmd2;
      if (hwndtemp) pmd2 = (PMESSAGEDATA) WinQueryWindowULong (hwndtemp, QWL_USER);

      switch (msg)
      {
         case WM_SIZE:

            // Keep the MLE sized to fit the client.

            if (pmd2)
            {
               WinQueryWindowPos (pmd2->hwndClient, (PSWP)&pmd2->swp);
               WinSetWindowPos (pmd2->hwndMLE, HWND_TOP, pmd2->swp.x,
                            pmd2->swp.y, pmd2->swp.cx, pmd2->swp.cy, SWP_SIZE | SWP_MOVE);
            }
            break;

         case WM_SETFOCUS:

            // If the message window loses focus, shut it down.
            // This will ensure that the function that called it will get a return and
            // will have a chance to delete new memory etc.

            if (pmd2)
            {
               if (SHORT1FROMMP (mp2) == 0)
                                 WinSendMsg (hwnd, WM_CLOSE, NULL, NULL);
            }
            break;

//-         case WM_CLOSE:
//-            if (pmd2)
//-            {
//-
//-            }
//-            break;
      }
      return WinDefWindowProc (hwnd, msg, mp1, mp2) ;
   }
Ejemplo n.º 27
0
MRESULT EXPENTRY ClientWndProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
     {
     static INT  cxClient, cyClient ;
     static LONG alJoin [] = { LINEJOIN_BEVEL, LINEJOIN_ROUND, LINEJOIN_MITRE },
                 alEnd  [] = { LINEEND_FLAT, LINEEND_SQUARE, LINEEND_ROUND } ;
     HPS         hps ;
     INT         i ;

     switch (msg)
	  {
          case WM_SIZE:
               cxClient = SHORT1FROMMP (mp2) ;
               cyClient = SHORT2FROMMP (mp2) ;
               return 0 ;

          case WM_PAINT:
               hps = WinBeginPaint (hwnd, NULLHANDLE, NULL) ;

               GpiErase (hps) ;

               for (i = 0 ; i < 3 ; i++)
                    {
                              // Draw the geometric line

                    GpiSetLineJoin (hps, alJoin [i]) ;
                    GpiSetLineEnd  (hps, alEnd  [i]) ;
                    GpiSetLineWidthGeom (hps, cxClient / 20) ;
                    GpiSetColor (hps, CLR_DARKGRAY) ;

                    GpiBeginPath (hps, 1) ;
                    DrawFigure (hps, i, cxClient, cyClient) ;
                    GpiEndPath (hps) ;

                    GpiStrokePath (hps, 1, 0) ;

                              // Draw the cosmetic line

                    GpiSetLineWidth (hps, LINEWIDTH_THICK) ;
                    GpiSetColor (hps, CLR_BLACK) ;

                    DrawFigure (hps, i, cxClient, cyClient) ;
                    }

               WinEndPaint (hps) ;
               return 0 ;
          }
     return WinDefWindowProc (hwnd, msg, mp1, mp2) ;
     }
Ejemplo n.º 28
0
MRESULT EXPENTRY PM_winProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
    switch (msg)
    {
    case WM_CREATE:       wmCreate      ();          break;
    case WM_PAINT:        wmPaint       (hwnd);      break;
    case WM_CHAR:         wmChar        (hwnd, mp1); break;
    case WM_DESTROY:      wmDestroy     ();          break;
    case WM_SETSELECTION: wmSetSelection(mp1);       break;
    //    case WM_SETFOCUS: log("WM_SETFOCUS",mp1); break;
    //    case WM_ACTIVATE: log("WM_ACTIVATE",mp1); break;
    //    case WM_FOCUSCHANGE: log("WM_FOCUSCHANGE",mp1); break;

    }
    return WinDefWindowProc (hwnd, msg, mp1, mp2);
}
Ejemplo n.º 29
0
static MRESULT EXPENTRY kstProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
    KSTPTR  p      ;
//    HPS     hps    ;
//    RECTL   rct    ;
//    UCHAR   buf[2] ;

    p = (KSTPTR) WinQueryWindowPtr(hwnd, 0) ;

#ifdef DEBUG
    TRACE("keyst  %08x\n", msg) ;
#endif

    switch (msg) {

    case WM_CREATE :
        WinSetWindowPtr(hwnd, 0, (PVOID) mp1) ;
        return (MRESULT) 0 ;

    case WM_PAINT :
        kstDraw(hwnd, p) ;
        return (MRESULT) 0 ;

    case WM_SINGLESELECT :
        kstSend(hwnd, p, IDM_KEYTGL) ;
        return (MRESULT) 0 ;

    case WM_CONTEXTMENU  :
        kstMenu(hwnd, p) ;
        return (MRESULT) 0 ;

    case WM_COMMAND :
        kstSend(hwnd, p, SHORT1FROMMP(mp1)) ;
        return (MRESULT) 0 ;

    case WM_KST_UPDATE :
        WinInvalidateRect(hwnd, NULL, FALSE) ;
        return (MRESULT) 0 ;

    case WM_KST_KEYDN :
    case WM_KST_KEYUP :
        p->keyDown = (msg == WM_KST_KEYDN) ? TRUE : FALSE ;
        WinInvalidateRect(hwnd, NULL, FALSE) ;
        return (MRESULT) 0 ;
    }
    return WinDefWindowProc(hwnd, msg, mp1, mp2) ;
}
Ejemplo n.º 30
-1
//==============================================================================
// WndProc - this function vectors WndProc (window processing) message handling
//           requests to the correct message handler
//==============================================================================
MRESULT EXPENTRY _export WndProc(HWND hWnd, ULONG iMessage, MPARAM mParam1, MPARAM mParam2)
{
    Window *pWindow = (Window *)WinQueryWindowULong(hWnd,0);
    if  (pWindow == 0) {
        if (iMessage == WM_CREATE) {
            pWindow = Main::tempthis;
            WinSetWindowULong(hWnd,0,(ULONG)pWindow);
            return pWindow->WndProc(hWnd,iMessage,mParam1,mParam2);
            }
        else return WinDefWindowProc(hWnd,iMessage,mParam1,mParam2);
        }
    else return pWindow->WndProc(hWnd,iMessage,mParam1,mParam2);
}