Unless I have a reason or need I just use my already registered window class for my button as well. Like this:
Code:
MSG msg;
HWND hwnd,hButton;
WNDCLASS wc;
static TCHAR szAppName[]=TEXT("Window");
wc.style=CS_HREDRAW|CS_VREDRAW;
wc.cbWndExtra=0;
wc.cbClsExtra=0;
wc.hInstance=hInstance;
wc.lpfnWndProc=WndProc;
wc.hbrBackground=(HBRUSH)(COLOR_WINDOW);
wc.hIcon=LoadIcon(NULL,IDI_APPLICATION);
wc.hCursor=LoadCursor(NULL,IDC_ARROW);
wc.lpszMenuName=NULL;
wc.lpszClassName=szAppName;
if(!RegisterClass(&wc))
{
MessageBox(NULL,"Error registering WNDCLASS!","ERROR",MB_ICONERROR);
return 0;
}
hwnd=CreateWindow(szAppName,szAppName,WS_POPUPWINDOW|WS_CAPTION|WS_MINIMIZEBOX,350,150,300,210,NULL,NULL,hInstance,NULL);
hButton=CreateWindow(TEXT("BUTTON"),TEXT("Button"),WS_CHILD|WS_VISIBLE,130,50,100,23,hwnd,NULL,hInstance,NULL);
I took this code from a calculator I made a while back(I made a few changes though), so that's why it's a popup window and positioned the way it is.