Buttons are actually windows and are created same way:
<br />
#define btn_ID 5000 //used as the button's id during creation<br />
<pre>HWND hwndButton = CreateWindowEx( 0, L"BUTTON", L"OK", WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON, 10, 10, 100, 100, m_hwnd, (HMENU)btn_ID, appInstance, NULL); <br />
<pre>LRESULT CALLBACK WndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ){ int commandType = HIWORD (wParam); int controlID = LOWORD (wParam); switch( msg ){ case WM_CREATE:{ } break; case WM_COMMAND:{ switch( commandType ){<br />
<br />
case BN_CLICKED:{<br />
<br />
switch( controlID ){<br />
<br />
case btn_ID:{<br />
<br />
}<br />
break;<br />
}</pre><br />