I'm currently designing a program that I want to open a seperate window and display a bitmap, when selected in a menu. I set up a menu and the child window and the bitmap but when ran and the menu selected it doesn't do anything. It acts likes I got nothing in the switch statment in the menu.
What i have is
Code:
case IDM_WD_568A:
hwndChild = CreateWindow (szChildClass, NULL,
WS_CHILDWINDOW | WS_VISIBLE, 0, 0, 282, 363, hwnd, 568A,
(HINSTANCE GetWindowLong(hwnd, GWL_HINSTANCE), NULL);
The childWndProc is:
Code:
LRESULT CALLBACK ChildWndProc (HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam)
{
static HBITMAP hBitmap;
static int cxClient, cyClient, cxSource, cySource ;
BITMAP bitmap;
HDC hdc, hdcmem;
HINSTANCE hInstance ;
int x,y;
PAINTSTRUCT ps;
switch (message)
{
case WM_CREATE :
hInstance = ((LPCREATESTRUCT) lParam)->hInstance;
hBitmap = LoadBitmap ("childInstance", TEXT ("Wiring Diagram"));
GetObject (hBitmap, sizeof (BITMAP), &bitmap);
cxSource = bitmap.bmWidth;
cySource = bitmap.bmHeight;
return 0;
case WM_PAINT:
hdc = BeginPaint (hwnd, &ps) ;
hdcmem = CreateCompatibleDC (hdc) ;
SelectObject (hdcmem, hBitmap);
for (y = 0 ; y < cyClient ; y += cySource)
for (x = 0 ; x < cxClient ; x += cxSource)
{
BitBlt (hdc, x, y, cxSource, cySource, hdcmem, 0, 0, SRCCOPY) ;
}
DeleteDC (hdcmem);
EndPaint (hwnd, &ps);
return 0;
case WM_DESTROY:
DeleteObject(hBitmap);
return 0;
}
}
What am I doing wrong?
Ray Koons
PS..I used to post ALOT here like 2 years ago but to a hiatus from programming but am starting to get back into it.