p-designs
July 23rd, 2006, 02:57 PM
Hello,
After figuring out how to add a wndproc to a seperate class and handle a window I've come across a new problem:
In my main.cpp file I load a window with classname "PokerMain" and then create a class of type CardTable. When CardTable is initialized it is supposed to load a window of classname "PokerTable" but does not appear - that is, unless I change the window so that it's parent is HWND_DESKTOP rather than identifying PokerMain's hwnd as it's parent, then it appears after the PokerMain window is closed.
However, when using PokerMain's hwnd as the parent and loading the application I close PokerMain's window yet the program is not terminated. So the PokerTable window is loaded but not visible?
Heres a snippet for the code:
CardTable::CardTable(char* sBackground, int width, int height, HWND hWndParent){
HINSTANCE hInst = GetModuleHandle(NULL);
char szClassName[] = "PokerTable";
WND_WIDTH = width;
WND_HEIGHT = height;
hMemDC = 0;
origDC = 0;
hBackground = LoadBitmapFile(sBackground);
cm.gDeck = cm.createDeck();
hRichEdit = LoadLibrary("RICHED32.DLL");
RegisterWindowClass(szClassName, hInst);
hWnd = CreateWindowEx (0, szClassName, "John's Poker Table", (WS_CLIPCHILDREN | WS_OVERLAPPEDWINDOW) & 0xFFFEFFFF, CW_USEDEFAULT,
CW_USEDEFAULT, WND_WIDTH, WND_HEIGHT, hWndParent, 0, hInst, this);
ShowWindow (hWnd, 1);
<more code here>
}
And my main.cpp (PokerMain) has this:
hwndMain = CreateWindowEx (0, szClassName, "Poker Main", (WS_CLIPCHILDREN | WS_OVERLAPPEDWINDOW) & 0xFFFEFFFF,
CW_USEDEFAULT, CW_USEDEFAULT, 800, 600, HWND_DESKTOP, 0, hThisInstance, NULL);
ShowWindow(hwndMain, 1);
CardTable cd("pokerbgd.dat", 800, 600, hwndMain);
Any help is greatly appreciated.
After figuring out how to add a wndproc to a seperate class and handle a window I've come across a new problem:
In my main.cpp file I load a window with classname "PokerMain" and then create a class of type CardTable. When CardTable is initialized it is supposed to load a window of classname "PokerTable" but does not appear - that is, unless I change the window so that it's parent is HWND_DESKTOP rather than identifying PokerMain's hwnd as it's parent, then it appears after the PokerMain window is closed.
However, when using PokerMain's hwnd as the parent and loading the application I close PokerMain's window yet the program is not terminated. So the PokerTable window is loaded but not visible?
Heres a snippet for the code:
CardTable::CardTable(char* sBackground, int width, int height, HWND hWndParent){
HINSTANCE hInst = GetModuleHandle(NULL);
char szClassName[] = "PokerTable";
WND_WIDTH = width;
WND_HEIGHT = height;
hMemDC = 0;
origDC = 0;
hBackground = LoadBitmapFile(sBackground);
cm.gDeck = cm.createDeck();
hRichEdit = LoadLibrary("RICHED32.DLL");
RegisterWindowClass(szClassName, hInst);
hWnd = CreateWindowEx (0, szClassName, "John's Poker Table", (WS_CLIPCHILDREN | WS_OVERLAPPEDWINDOW) & 0xFFFEFFFF, CW_USEDEFAULT,
CW_USEDEFAULT, WND_WIDTH, WND_HEIGHT, hWndParent, 0, hInst, this);
ShowWindow (hWnd, 1);
<more code here>
}
And my main.cpp (PokerMain) has this:
hwndMain = CreateWindowEx (0, szClassName, "Poker Main", (WS_CLIPCHILDREN | WS_OVERLAPPEDWINDOW) & 0xFFFEFFFF,
CW_USEDEFAULT, CW_USEDEFAULT, 800, 600, HWND_DESKTOP, 0, hThisInstance, NULL);
ShowWindow(hwndMain, 1);
CardTable cd("pokerbgd.dat", 800, 600, hwndMain);
Any help is greatly appreciated.