Click here to Skip to main content
16,008,183 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: ToolBar Pin
includeh102-Nov-02 7:07
includeh102-Nov-02 7:07 
GeneralDispatchMessage vs own function Pin
S van Leent2-Nov-02 4:55
S van Leent2-Nov-02 4:55 
GeneralRe: DispatchMessage vs own function Pin
ian mariano2-Nov-02 6:38
ian mariano2-Nov-02 6:38 
GeneralRe: DispatchMessage vs own function Pin
S van Leent2-Nov-02 10:12
S van Leent2-Nov-02 10:12 
GeneralRe: DispatchMessage vs own function Pin
Paul M Watt2-Nov-02 10:14
mentorPaul M Watt2-Nov-02 10:14 
GeneralRe: DispatchMessage vs own function Pin
S van Leent2-Nov-02 10:21
S van Leent2-Nov-02 10:21 
GeneralRe: DispatchMessage vs own function Pin
ian mariano2-Nov-02 15:19
ian mariano2-Nov-02 15:19 
GeneralRe: DispatchMessage vs own function Pin
S van Leent2-Nov-02 10:54
S van Leent2-Nov-02 10:54 
Got this code out of a MSJ from 1997

MS Systems journal example:

 //=================================================
 // Matt Pietrek
 // Microsoft Systems Journal, March 1997
 // Pseudocode for ring 3 portion of DispatchMessage
 //=================================================
 
 LONG DispatchMessageA( CONST MSG *lpmsg )
 {
     return DispatchMessageWorker( lpmsg, 1 ); // 0 == UNICODE, 1 = ANSI
 }
 
 LONG DispatchMessageWorker( CONST MSG *lpmsg, BOOL fAnsi )
 {
     if ( lpmsg->message == 0xFFFE0000 )
     {
         _UserSetLastError( ERROR_INVALID_PARAMETER );
         return 0;       
     }
 
     // If we have a non-null HWND, convert it to a pointer to the user mode
     // WND structure.  We'll use this ptr extensively.
     if ( lpmsg->hwnd )
     {
         pWnd = @ValidateHwnd( lpmsg->hwnd );
         if ( !pWnd )
             return 0;
     }
     else
         pWnd = 0;
 
     if ( (lpmsg->message != WM_TIMER) && (lpmsg->message != WM_SYSTIMER) )
     {
 
 begin_normal_message:
 
         if ( pWnd == 0 )    // Sanity check.  We'd better have a valid window!
             return 0;
 
         DWORD save_wParam = lpmsg->wParam;
 
         if ( (lpmsg->message != WM_PAINT) && !(pWnd->someFlags9E & 4) )
         {
             if ( IsWindowUnicode( lpmsg->hwnd ) )
             {
                 if ( fAnsi )
                     RtlMBMessageWParamCharToWCS( lpmsg->message, save_wParam );
                 else
                     RtlWCSMessageWParamCharToMB( lpmsg->message, save_wParam );
             }
 
             // Is the high bit in the wndproc address set?  If so, this is a
             // 16 bit window, and pfnWndProc is a 16:16 far address.  To get
             // the real address, turn off the high bit (0x80000000)
             if ( 0 == (pWnd->pfnWndProc & 0x80000000) )
             {
                 pWnd->pfnWndProc(   lpmsg->hwnd, lpmsg->message,
                                     lpmsg->wParam, lpmsg->lParam );
             }
             else
             {
                 pfnWowWndProcEx( lpmsg->hwnd, lpmsg->message, save_wParam,
                                  lpmsg->lParam, lpmsg->message, pWnd->0x90 );
             }
         }
         else    // WM_PAINT, or something else...
         {
             if ( fAnsi )
                 _RtlMBMessageWParamCharToWCS( lpmsg->message, save_wParam );        
 
             _NtUserDispatchMessage( lpmsg );        
         }
 
         lpmsg->wParam = save_wParam;
     }
     else    // WM_TIMER && WM_SYSTIMER
     {
         TIMERPROC pfnTimerCallback = lpmsg->lParam;
 
         if ( pfnTimerCallback == 0 )
             goto begin_normal_message;
 
         if ( lpmsg->message == WM_SYSTIMER )
             return _NtUserDispatchMessage( lpmsg );
 
         return pfnTimerCallback(    lpmsg->hwnd,
                                     lpmsg->message,
                                     lpmsg->wParam,      // wTimerId
                                     GetTickCount() );   // actually, an inline
                                                         // version of the code
                                                         // in KERNEL32.DLL
     }
 }


LPCTSTR Dutch = TEXT("Double Dutch Smile | :) ");
GeneralStrange List Box Problem Pin
Ayush2-Nov-02 4:36
Ayush2-Nov-02 4:36 
GeneralRe: Strange List Box Problem Pin
ian mariano2-Nov-02 10:40
ian mariano2-Nov-02 10:40 
GeneralRe: Strange List Box Problem Pin
Ayush2-Nov-02 14:35
Ayush2-Nov-02 14:35 
GeneralRe: Strange List Box Problem Pin
ian mariano2-Nov-02 15:11
ian mariano2-Nov-02 15:11 
QuestionHow to define operator = in CStringArray? Pin
ooosawaddee32-Nov-02 3:08
ooosawaddee32-Nov-02 3:08 
AnswerRe: How to define operator = in CStringArray? Pin
Dominik Reichl2-Nov-02 3:26
Dominik Reichl2-Nov-02 3:26 
Generalask another question Pin
ooosawaddee32-Nov-02 3:57
ooosawaddee32-Nov-02 3:57 
GeneralRe: ask another question Pin
Dominik Reichl2-Nov-02 6:03
Dominik Reichl2-Nov-02 6:03 
GeneralRe: ask another question Pin
dabs2-Nov-02 7:11
dabs2-Nov-02 7:11 
GeneralDate Formating Pin
Anonymous2-Nov-02 2:38
Anonymous2-Nov-02 2:38 
GeneralRe: Date Formating Pin
Dominik Reichl2-Nov-02 2:51
Dominik Reichl2-Nov-02 2:51 
Generaladd-in and adding right-click menu entries Pin
John Clayton2-Nov-02 1:14
John Clayton2-Nov-02 1:14 
Generalsetting DEVMODE structure Pin
vgkotha2-Nov-02 1:11
vgkotha2-Nov-02 1:11 
GeneralStupid debug question (concerning VC IDE) Pin
User 66582-Nov-02 0:34
User 66582-Nov-02 0:34 
GeneralRe: Stupid debug question (concerning VC IDE) Pin
carrie2-Nov-02 0:45
carrie2-Nov-02 0:45 
GeneralRe: Stupid debug question (concerning VC IDE) Pin
Anonymous2-Nov-02 0:49
Anonymous2-Nov-02 0:49 
GeneralThanks! Pin
User 66582-Nov-02 0:57
User 66582-Nov-02 0:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.