SW_HIDE not working

I have spent a few hours trying to figure out why this is not working and cannot figure it out.

I create a HWND like this:
hWnd = CreateWindowEx(NULL, "Chat Window", "Winchat", WS_OVERLAPPEDWINDOW, 200,200,640,480, NULL, NULL, hInst, NULL);

and then i create a button like so:
1
2
hClientButton = CreateWindowEx(NULL, "BUTTON", "Client", WS_TABSTOP|WS_CHILD|BS_DEFPUSHBUTTON, 100,200,150,50, hWnd, (HMENU)101, GetModuleHandle(NULL), NULL);
ShowWindow(hClientButton, SW_HIDE);


Later on, i make the button visible with:
ShowWindow(hClientButton, SW_SHOW);

After hiding the button again, it is still visible on the parent window, but not selectable.
I have tried calling the hide function twice as suggested on some sites, ive minimized it, invalidiated the parent window, updated the parent window, etc.

NOTHING seems to get rid of the button when i try to hide it.


Anyone else experienced this or know what im doing wrong?
Its like washing a car... start washing, it starts raining.

I look for hours, and 5 mins after posting, i find the answer.


For anyone else having this problem, it was caused by not setting this value for the window my objects where in

window.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);

as soon as i included that line, everything was fine.
Topic archived. No new replies allowed.