• Advertisement


This topic is now archived and is closed to further replies.

Connect 4 andChildwindow problem

This topic is 5674 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Greetings all, I am having trouble with my childwindows in my connect 4 game done using windows gdi. The board is 7 x 6, (an array of 42 childwindows). The problem is I cannot get the child windows to be set to yellow when the game INITIALLY starts. I tried setting the background color to yellow in the ChildWndProc in the WM_CREATE message: WM_CREATE: SetClassLong(hwndChild), GCL_HBRBACKGROUND), (LONG)CreateSolidBrush(255,255,0); --------------------------------------------------------- I also tried creating a yellow brush in putting in the child''s window class as the hbkrground but it still didnot work. WNDCLASS wc; . . wc.hbkground = (HBRUSH) yellow_brush;(may not be spelled right) ------------------------------------------------------------- Although, when a player click on a column i have no problem coloring the child window''s background yellow because i use a function like this which also colors the coin. PlayerMove(HWND hwnd, HDC hdc) { RECT rect; GetClientRect(hwnd, &rect); FillRect(&rect, CreateSolidBrush(RGB(255,255,0)));//yellow brush SelectObject(hdc, CreateSolidBrush(RGB(255,0,0)));//red coin DeleteObject(hdc,SelectObject(GetStockObject(WHITE_BRUSH)); } Any suggestion is appreciated. Thanks in advance! ----------------------------- "There are ones that say they can and there are those who actually do." "...u can not learn programming in a class, you have to learn it on your own."

Share this post

Link to post
Share on other sites

  • Advertisement