EDIT: Problem resolved. Pretty stupid of me. I had declared the "font" globally for using it multiple times (I send the message in another function than where I first used it). I finally tried declaring it within the function I use to set up the containers and now it works fine.
---- Cut original problem ------ See below
Another slight problem I also have is that the subclassed statics don't redraw correctly so in my subclassed proc I used this:
Code:
LRESULT CALLBACK FrameProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message) /* handle the messages */
{
case WM_PAINT:
{
PAINTSTRUCT ps;
HDC hdc;
RECT r;
GetClientRect (hwnd, &r);
hdc=BeginPaint(hwnd, &ps);
Rectangle (hdc,-10,-10,800,600 );
EndPaint (hwnd, &ps);
break;
}
case WM_CTLCOLORSTATIC:
{
return (LONG) GetStockObject(WHITE_BRUSH);
}
The Rectangle function is used to update the static container so that it's background stays white and doesn't get redrawn with crap when things overlap it. I'm sure this isn't the proper way of handling this.
A screenshot of this problem (overlapping) is found here: http://programming-designs.com/error.gif
Any help is greatly appreciated! If I haven't made myself clear enough please specify what you want to know. Thanks.