how is windowblinds skinning? a programmers question...

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!
2,830 views 17 replies
Reply #1 Top
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.
Reply #2 Top
but...when i paint a command button, how do i retain its TEXT?

Powered by SkinBrowser!
Reply #3 Top
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.
Reply #4 Top
Oh, and then you have to paint that text onto the control with DrawText or something.
Reply #5 Top
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!
Reply #6 Top
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.
Reply #7 Top
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!
Reply #8 Top
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!
Reply #9 Top
but how come the CPU usage of WB is 'NIL'?

Powered by SkinBrowser!
Reply #10 Top
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.
Reply #11 Top
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!
Reply #12 Top
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!
Reply #15 Top
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?
Reply #16 Top
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!
Reply #17 Top
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.