0

another question:
when I create a window, I use function CALLBACK WndProc(), if another dialog box will be triggered by clicking a certain button in this window, I may use another function CALLBACK DlgProc(). if there is other more, I may use another CALLBACK DlgProc()....
could I integrate all those DlgProc() or ToolDlgProc() or other functions in WndProc()? then it may looks more simple.
I mean, all those functions looked the same:
like

LRESULT CALLBACK WndProc(....)
{ 
 switch(msg)
 { 
  case WM_COMMAND:....
         case  .....
        }
}
BOOL CALLBACK DlgProc(....)
{
    switch(Message)
    {
        case WM_INITDIALOG:
        case ...
     }
}

Edited by Reverend Jim: Fixed formatting

3
Contributors
2
Replies
4
Views
10 Years
Discussion Span
Last Post by GloriousEremite
0

You could do it all in just one callback function, but it might sometimes get a little messy and complicated because the function might have to decide which window it was being called for. Yes, the window handle is passed to the callback function, but that might not be enough to distinguish between dialogs or controls.

The macros CALLBACK and WINAPI should be used because (1) they are Microsoft standards and (2) if Microsoft decides to change the macros then you will be SOL if you didn't use them. The same with using int instead of HANDLE -- 64-bit programmers will find out very quickly when they begin to migrate their 32-bit windows programs to 64 bit if they did not use standard Microsoft macros because the size of the HANDLE object was changed.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.