Click to See Complete Forum and Search --> : [beginner]How to divide window into 4 parts and paint with colors?


kinnera12
January 18th, 2008, 08:58 AM
i am a beginner plz help me solve this question

The application should create a window. The window should be divided into 4 parts. Each part should be painted with a color (choose a color of your choice). When I click on a particular color, there should be a
message box saying the color on which I clicked.
thanku
kinnera

jeffreygoines
January 18th, 2008, 09:15 AM
create 4 child windows and color them with diffrent colors.
you can create a windows that has no caption by setting its style WS_POPUPWINDOW

kinnera12
January 18th, 2008, 11:21 AM
Can U Plz give Me idea

Plasmator
January 18th, 2008, 10:28 PM
Sounds awfully like homework; read the forum FAQ.

kinnera12
January 19th, 2008, 04:58 AM
should i write 1 createwindow(),AND 4 WINPROC()'S LIKE BELOW

CreateWindowEx(0, WndClassName, NULL,
WS_POPUPWINDOW, Left, Top, Width, Height,
hWndParent, NULL, hInstance, NULL);

and
LRESULT CALLBACK MyWinProc(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam)
{
PAINTSTRUCT ps;
switch (nMsg)
{
case WM_PAINT:
{
BeginPaint(hWnd, &ps);
SetBkColor(ps.hdc, RGB(255, 0, 0));
SetTextColor(ps.hdc, RGB( 255, 255, 255));
TextOut(ps.hdc, 10, 10, "RED", 9);
EndPaint(hWnd, &ps);
return 0;
}
case WM_CLOSE:
{
DestroyWindow(hWnd);
PostQuitMessage(0);
return 0;
}
}
return DefWindowProc(hWnd, nMsg, wParam, lParam);
}

is that code correct