how is windowblinds skinning? a programmers question...

Wednesday, July 17, 2002 by Lord Vimal | Discussion: WinCustomize Talk

how is windowblinds skinning windows. is it just taking the window handles (hwnd) and BITBLTing the bitmaps or setting the control's background.
i tried to experiment with it. just tried to change the START button's picture. and it worked!
i got the start button's hWnd, then i found its hDC then i BITBLTed the image onto it.
for the rollover image, i set up a timer (in VB) and checked if the hWnd under the mouse's coordinates is that of the START button (by GETCURSORPOS and WINDOWFROMPOINT API) then again i BITBLTed the picture.

is it this way or someother way??


Powered by SkinBrowser!
GreenReaper
Reply #1 Wednesday, July 17, 2002 11:04 PM
As I understand it, WB hooks into the message loop of each app and intercepts the paint messages. So if X is told to paint a combo box control, WB steps in and paints it itself.
Lord Vimal
Reply #2 Thursday, July 18, 2002 3:34 AM
but...when i paint a command button, how do i retain its TEXT?

Powered by SkinBrowser!
GreenReaper
Reply #3 Friday, July 19, 2002 3:04 AM
You use GetWindowText if it's in your application, otherwise you have to send a WM_GETTEXT message via SendMessage(hwnd, WM_GETTEXT, maxnumofcharstocopy, textbuffer). For VB, all should be long values, maxnumofcharstocopy should be, say, 255 and textbuffer should be = string(255, " "). SendMessage should be defined as:
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long

Good luck getting all this to work.
GreenReaper
Reply #4 Friday, July 19, 2002 3:05 AM
Oh, and then you have to paint that text onto the control with DrawText or something.
Lord Vimal
Reply #5 Friday, July 19, 2002 9:17 AM
oh...
so, its also painting the text!
hmm...i thought it is changing the font of the Control and applying a BACK PICTURE property or something!
so, you are one of the programmers of windowblinds??

anyway. WB is painting into all the hDc right? is it using BITBLT or other API SETDIBITSTODEVICE (for example)
because when i tried to paint just the startbutton, windows slows down!
or is it because i am running the program without compiling it in IDE. well, i think COMPILATION is better than INTERPRETATION!

and one more...how about the CLICK event or MOUSEDOWN event??
thanks ! anyway...i am NOT an EXPERT programmer. i am just a amateur. i am just 14!

Powered by SkinBrowser!
GreenReaper
Reply #6 Friday, July 19, 2002 5:57 PM
No, I'm just an interested hanger-on. I can't speak much for the specifics of implementation, although I do believe WB uses normal BitBlt/StretchBlt calls to paint the images.

Personally I think the slowdown is partially because you're using VB (and I get to say that - I'm a VB programmer . But using a timer and repainting is probably a problem as well - you really only want to repaint when you have to.

Again, if you want to monitor those events you need to hook into the message chain, especially if you also want to get mousedown messages. Which is kinda difficult although probably not impossible using VB. Don't let that stop you though - just be aware that you'll have to learn a lot more about how Windows works to do what you want to do, and know that some things may not be possible with VB. Have a look at SetWindowsHookEx. Try things. Crash a lot. Good luck.
Lord Vimal
Reply #7 Saturday, July 20, 2002 12:31 AM
well, if it uses BITBLT, then where is the SOURCE HDC ??
i am sure (i think) it doesnt use BITBLT. or the Picture box with the startbutton picture or something (hDc) should be VISIBLE...

but SETDIBITSTODEVICE...hmm...i think that should work. right??
i have a list of about 925 API's with examples!

Powered by SkinBrowser!
Lord Vimal
Reply #8 Saturday, July 20, 2002 12:32 AM
i hope this is it:
Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" (ByVal idHook As Long, ByVal lpfn As Long, ByVal hmod As Long, ByVal dwThreadId As Long) As Long

Powered by SkinBrowser!
Lord Vimal
Reply #9 Saturday, July 20, 2002 12:33 AM
but how come the CPU usage of WB is 'NIL'?

Powered by SkinBrowser!
GreenReaper
Reply #10 Saturday, July 20, 2002 3:57 AM
Because WBLoad.exe doesn't do the work. It's all done in WBlind.dll. WBLoad just stores the bitmaps (AFAIK, perhaps not even that) and hooks the DLL into each app's message chain. It loads the bitmaps into shared memory and then lets the DLL instances blt from there. WB code runs in the process of every skinned app via WBlind.dll.
Lord Vimal
Reply #11 Saturday, July 20, 2002 4:17 AM
hmm...
is cursorxp works the same way??
how does cursorxp know to change the cursor to busy, help etc...
i think its also the same thing.

anyway...do you develop softwares?

Powered by SkinBrowser!
Lord Vimal
Reply #12 Saturday, July 20, 2002 4:23 AM
is there a way to change the properties of a control.

eg: how to change the background of a control.?

next: using a spyware (say) how can u find whether the control behind your mousepointer is a label or a picturebox?
you can detect a COMMAND button because its class name is BUTTON.

i am running XP and have trouble finding the START BUTTON's handle. (hWnd)

i used the FINDWINDOW function to first find the Taskbar's handle (Shell_TrayWnd) and then ran a loop with FINDWINDOWEX function to find a class named BUTTON (since there is only 1 button in windows 98-the startbutton. but in XP, there r 2 buttons one is the START button, another is the HIDE icons in the systray. thats also a button.)

any other way to find the START button's handle??

Powered by SkinBrowser!
Lord Vimal
Reply #13 Saturday, July 20, 2002 12:08 PM
hello?

Powered by SkinBrowser!
Lord Vimal
Reply #14 Sunday, July 21, 2002 3:14 AM
green reaper...r u there?

Powered by SkinBrowser!
GreenReaper
Reply #15 Sunday, July 21, 2002 6:27 PM
Hmm. I posted here, but it seems it didn't work.

I'm not sure how CursorXP works. It might be using the IAccessible interface to retrieve the name of the mouse cursor object which changes according to the cursor state.

I do develop some software, but not for Stardock. Some is at www.greenreaper.co.uk

If you want to change the background of an XP themable app there are APIs to do it (but you need to be set up as the thing doing the skinning, don't know how that works), otherwise you have to take control of the message chain and filter the paint messages so that your skinning app knows when to paint the background.

Perhaps the Start button has a different window text to the hide button? If so you could use that as well to find it.

Don't know about the label/picturebox question, although have you checked what classes they give?
Lord Vimal
Reply #16 Monday, July 22, 2002 2:48 AM
no, they dont give any classes...
they just show classes of their parent hWnd..and their parent classes. hey it is possible to determine if the app has been done in VB!
but the app should use FORMS which are created by VB by default...the app can also use modules alone using CREATEWINDOW function. the classes are THUNDERRT'X'FORM where x may be 5 or 6...in which VB they created.

the start button works well with the API spyz. when u move the cursor over the startbutton, it shows that its text is START. only SOMETIMES it works because there is another control named BUTTON in the taskbar (i had mentioned it earlier)..the HIDE or SHOW button. thats why when i ran the loop to find a class named BUTTON, it got stuck!

i cant use the window text because it is a child window. if i use the FINDWINDOW function with the lpWindowText (i think) parameter, it returns '0' (failed. but hey! 0 is the screen's hWnd!)

thats y i was finding another way to get the START button's hWNd.

if u dont develop soft for stardock, how come u have been rated DEVELOPER??
thanks!

Powered by SkinBrowser!
GreenReaper
Reply #17 Monday, July 22, 2002 5:09 PM
I'm a Journeyman, and one of the options for our titles is Developer (like you can have Citizen, Mr, Mrs, etc). Not many use it.

Please login to comment and/or vote for this skin.

Welcome Guest! Please take the time to register with us.
There are many great features available to you once you register, including:

  • Richer content, access to many features that are disabled for guests like commenting on the forums and downloading skins.
  • Access to a great community, with a massive database of many, many areas of interest.
  • Access to contests & subscription offers like exclusive emails.
  • It's simple, and FREE!



web-wc01