Take another look at the winprog samples, you will find something similar to the next piece of code on the window main procedure (if the button is in a popup, you will have to search that on the popup window main procedure):

Code:
LRESULT CALLBACK mainproc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
switch(msg)
    {
    ...
    case WM_COMMAND:
        {
        switch(LOWORD(wParam))
                {
                case IDC_MAIN_EDIT:
                    {
                    MessageBox();
                    }
                break;
                }
        }
    break;
...
The notification of all standard bottonclicks will come via WM_COMMAND message; that message is send as UINT argument to the window procedure, and some information values are appended as LPARAM and WPARAM. You are searching for the 'WM_COMMAND' notification, so first check it uot from the 'UINT msg' argument. Once you have find it, you also know that with WM_COMMAND messages, the loworder word of the WPARAM is the idetifier of the control that have generated the message, so use the macro 'LOWORD()' to get the loworder and check if is the id of you button (in the code you posted should be 'IDC_MAIN_EDIT', if you find it just call the messagebox.

Take a look at the clipped thread on that board for lots of tutorials, samples, etc...
And hope that helps

Niara