Thanks Niara, that helped me understand it a lot more, but I still can't get it to work.
Am I suppose to create the button inside WM_COMMAND or WM_PAINT? The button doesn't even show up when I try it in either.
hDC = BeginPaint(hwnd,&paintstruct);
CreateWindowEx(WS_EX_CLIENTEDGE, "BUTTON", "",
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
150, 150, 50, 50, hwnd, (HMENU)IDC_MAIN_EDIT, g_hInst, NULL);