Yes I may correct your code and/or modify it

As you run your dialog (with either DialogBox or CreateDialog) you specified a application defined DialogProc that handles all messages that comes in for your dialog. In this function you have some parameters:

Code:
LRESULT WINAPI DlgProc ( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam )
{
     /* handle the messages somewhat */
     return 0;
}
The first paramater hDlg is from type HWND. This is a handle with which windows recognizes your dialog box. msg is the message that should be handled. All windows messages start with WM_. So you might take a look at these in the MSDN - because there are a ton of messages that could be handled. The other two paramters are additional paramters and their meaning that differ from message to message.

In your case you want to handle the button pressed. To do this you have to handle the WM_COMMAND message. The lowest word of the wParam paramaters tells you which control caused this message and the highest word what event has been occured.

Code:
LRESULT WINAPI DlgProc ( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam )
{
     switch ( msg )
     {
            case WM_COMMAND:
                  { // Let's say your button has an ID of IDC_BUTTON
                        if ( LOWORD(wParam) == IDC_BUTTON )
                        { // Now do something here
                        }
                  }
                   break;
     }
     return 0;
}