Shoutbox

Random UIFILE trick - dfc dtb functions - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Skinning (/forumdisplay.php?fid=41)
+----- Thread: Random UIFILE trick - dfc dtb functions (/showthread.php?tid=80254)

Random UIFILE trick - dfc dtb functions by TheSteve on 12-20-2007 at 08:06 AM

So I was in a debugging session today, and I noticed a couple functions I hadn't seen before and could find online documentation for.

So I worked them out and here are the results:

dfc stands for DrawFrameControl which is a Windows API function that some of you may be familiar with. For those that aren't familier, this function allows you to easily draw basic windows controls. The function prototype looks like this:

code:
dfc(nType, nState) - DrawFrameControl
nType:
1 - Title bar
2 - Menu bar
3 - Scroll bar
4 - Standard button
5 - Popup menu item.
nState:
These values change based on the control type. For valid values you'll need to look at the documentation and winuser.h to get the number values

Now if you try this dfc function you may notice that it draws really old looking controls.  This is because this function draws the "Windows Classic" style controls.  Ok so this is kind of pointless isn't it.

This brings us to the dtb function. dtb stands for DrawThemeBackground. This function controls all of the painting for the Windows XP and Windows Vista themes support.  So with this function you can get all of the Windows XP/Vista style controls. These controls will match the currently selected windows theme as long as you're not in Windows Classic mode.
The function looks like this
code:
dtb(nControlType, nPart, nStyle, 0) - DrawThemeBackground
controltype:
0 - ScrollBar
1 - Toolbar
2 - Clock
3 - Combobox
4 - Edit
5 - Explorer
6 - Globals
7 - Header
8 - ListView
9 - MENU
10 - MenuBand
11 - Pager
12 - Progress
13 - Rebar
14 - Spin
15 - StartPanel
16 - Status
17 - Tab
18 - TaskBand
19 - TaskBandVert
20 - TaskBandGroupMenu
21 - Taskbar
22 - TaskVert
23 - Tooltip
24 - TrackBar
25 - TrayNotify
26 - TreeView
27 - Window
28 - Static
29 - Button
30 - Button-OK
31 - Button-CANCEL
32 - Button-ABORT
33 - Button-RETRY
34 - Button-IGNORE
35 - Button-YES
36 - Button-NO
37 - Button-CLOSE
38 - Button-HELP
39 - Button-TRYAGAIN
40 - Button-CONTINUE
41 - Button-APPLY
nPart and nStyle:
There are a lot of these.  Please check the documentation for DrawThemeBackground and TmSchema.h for correct values for specific control types
0:
I am currently not aware of the purpose of the last parameter. Setting it to 0 seems the safest thing to do. ( setting it to a rect seemed to lock up messenger)


Because you need the header files in order to get the correct numbers, you will either need to download the Windows SDK (it's free) or ask one of your programmer buddies to send the header.  If I get some time I'll put together a whole list of values and put it here.

Note: In case you got the wrong idea, this cannot achieve glass in Windows Vista.

EDIT: I found an online copy of TmSchema.h in the wine project. You can find it here: http://source.winehq.org/source/include/tmschema.h
RE: Random UIFILE trick - dfc dtb functions by Patchou on 12-20-2007 at 05:50 PM

Thanks for the info :).

I'll really have to get started on the tutorials section of the web site...


RE: Random UIFILE trick - dfc dtb functions by davidpolitis on 12-21-2007 at 01:06 AM

A shame that MP!L cannot handle controls :(


RE: Random UIFILE trick - dfc dtb functions by Patchou on 12-21-2007 at 05:21 AM

what do you mean?


RE: Random UIFILE trick - dfc dtb functions by davidpolitis on 12-21-2007 at 05:43 AM

Well, say that you want to add your own menu, you have to edit an existing menu such as the background chooser and then get the button to just use a cmdid, so that backgrounds are still accessible, because messenger handles menus and drop downs. Hence new ones cannot be added.


RE: Random UIFILE trick - dfc dtb functions by Patchou on 12-21-2007 at 05:46 AM

oh I see. Well, that's definitively the kind of request I can accept. I'll keep that suggestion for the next updates (I wanted to do somethign for menus anyway).


RE: Random UIFILE trick - dfc dtb functions by TheBlasphemer on 01-19-2009 at 12:16 PM

Quick addition to Steve's post:
the last argument to DTB is a default: if the theme handle can not be found, this value is used instead. Should probably be a graphic or an RLE.