Hi,
I am trying to figure out what I have done wrong with a little app I am working on in C++ and if what I am doing is actually the best way.
I create my main application window and have a single menu with two selections, I then have the following code to determine what to do when either of the options is selected:
If I select the PREF from the menu my first child window is created fine and displayed but the second (childwnd1) does not get created. If I select STATS from the menu then it creates and displays the Stats window fine. At the top I have the DestroyWindow so that when I switch between PREF and STATS it will destroy the previously created window.Code:LRESULT CALLBACK WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) /* handle the messages */ { case WM_COMMAND: DestroyWindow(childhwnd); switch ( wParam ) { case SM_PREF: childhwnd = CreateWindow( "static", "Pref", WS_CHILD | SS_CENTER | WS_VISIBLE, 50, 50, 50, 50, hwnd, NULL, hThisInstance, NULL); childhwnd1 = CreateWindow( "BUTTON", "test", WS_CHILD | WS_VISIBLE, 200, 200, 100, 100, childhwnd, NULL, hThisInstance, NULL); return 0; case SM_STATS: childhwnd = CreateWindow( "static", "Stats", WS_CHILD | SS_CENTER | WS_VISIBLE, 0, 0, 50, 50, hwnd, NULL, hThisInstance, NULL); return 0; etc.....
I changed the parent of the childwnd1 to hwnd which is my main app window and then both the static and button displays. So I am guessing that I cannot create a child of a child within the same thread. Am I correct or barking up the wrong tree here? Or is there someway to look ahead and collect the correct property or something?
Is this a good way to switch between two different displays?
Any help or advice appreciated.
Ade



LinkBack URL
About LinkBacks



