There are several problems I can see here.

1) You should use the resource editor to create a dialog resource and then use CreateDialog vs CreateWindow when creating a dialog. You can put the button control in the dialog resource so you don't have to create it in code.

2) A button does not have a dialogproc. It has a wndproc which for what you are trying to do should be sufficient. What you need to do is have the dialog (parent of the button) handle WM_COMMAND message for BN_CLICK with the id of the button.

3) Before you start pumping messages, call ShowWindow(hDlg) and UpdateWindow(hDlg).