View Full Version: Changing window properties

C++ Learning Community > C++ Help > Changing window properties


Title: Changing window properties


C-Man - March 6, 2004 12:26 PM (GMT)
Is there a way to change window properties when it is created.
Ex: Style / background Brush.
Ps. does anyone have any tips on how to skin a application.
Like winamp or real player or whatever.

Sam Fisher vs Solid Snake - March 6, 2004 03:16 PM (GMT)
i dont know the code for it but my guess is to creat your own file(the skin) then make it so your app can call it. when it does call it the prog should destroy the normal window and open the new one

C-Man - March 6, 2004 03:27 PM (GMT)
Can somebody tell me how to blit the skin on the window whit transparencies and
all. And killing the window , recreating it sonds a bit messy.
Isnt there some other way.

FrozenKnight - March 6, 2004 08:39 PM (GMT)
A firend From another fourm mentioned to me something about DIB's which allow you to set the screan for you to write your own routiens. i'd the example he showed me did some stuff that i thought was only posiable in Direct X or OpenGL. he mentoned the funtion SetDIBits. that may have something with what you are after but i'm not sure.

ih8censorship - March 6, 2004 09:13 PM (GMT)
to skin a program heres how i THINK it would work- okyou can have invisible windows right? well start your program and draw your bitmaps onto the invisible window. thats what i think windows media player does because if you move your cursor right you can see the window border... anyway to just color the backround of your window you can do like
CODE
wincl.hbrBackground = (HBRUSH)CreateSolidBrush(RGB(2,105,56));
and thats in your WNDCLASSEX that you use for your main window. thats enough just so you dont go insane from looking at the standard windows color all the time ;)
QUOTE
And killing the window , recreating it sonds a bit messy.
Isnt there some other way.

Cman- i dont know if this is exactly what you want but try
CODE
ShowWindow(hwnd,SW_HIDE);
and then use SW_SHOW when you want to show it again

TheHawgMaster - March 6, 2004 10:50 PM (GMT)
The keys to skinned windows:
  • GetWindowDC (I think that's what it's called)
  • GetSystemMetrics
  • Ownerdraw controls.

C-Man - March 7, 2004 07:22 AM (GMT)
CODE
wincl.hbrBackground = (HBRUSH)CreateSolidBrush(RGB(2,105,56));
this only works when you registering the class . But how to change
theese things when window is created allready.And using gdi blit flikers alot!
I use BS_PATTERN and LoadBitmap . But how to change those
when the window is created without having to kill it and create it again .
And SetDiBits i'll have a look at that thanx.

TheHawgMaster - March 7, 2004 07:38 AM (GMT)
QUOTE
And using gdi blit flikers alot!
Only draw on the window when you recieve a WM_PAINT message, and (IMPORTANT) validate the window whne you're done painting it. (Use ValidateRect function)

C-Man - March 7, 2004 07:40 AM (GMT)
Yes i wait until WM_PAINT . But didnt validate thanx :D .




* Hosted for free by zIFBoards