Newbie to the win32api, what I'm trying to do is have my app replace the contents of a window, or create a new popup window when a button is pressed.
What I do is get the wparam that gets sent to WM_COMMAND to identify which button was pushed, and then I try to run a CreateWindow function, but nothing happens. I've confirmed that message boxes and dialog boxes work, but the CreateWindow function doesn't.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
case WM_COMMAND:
wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
// Parse the menu selections:
switch (wmId)
{
case BUTTON_ID:
//DialogBox(hInst, MAKEINTRESOURCE(Newswin), hWnd, Newswin);
NewWin = CreateWindow( L"label", L"text",
WS_CHILD | WS_POPUP,
CW_USERDEFAULT, CW_USERDEFAULT,
800, 400,
hWnd, NULL,
hInst, NULL );
break;
I've done some further investigating into this matter, and found that while that is an issue, it's not the source of the error. I'll post what I did to get the window to pop up, but I'm still having multiple problems such as : The menu bar doesn't show (and yes i changed WS_CHILD to WS_CHILDWINDOW), the exit code closes both the main window and the child window (regardless of which window sends the command), and the new window has all the properties of the parent window (I wanted a fresh window).