¦b²Ä 12 ³¹´£¨ìªº owner draw ¤]¯à§ïÅܱ±¥óªº¥~Æ[¡A»P custom draw ¤£¦Pªº¦a¤è¬ù¦³¤U±´XÂI¡G
¥Ñ¤W±ªº¤ñ¸û¡A±zÀ³·í¥i¥Hµo²{ custom draw ¦ü¥G¤ñ owner draw §ó¦³¼u©Ê¡A¤]§óÆF¬¡¡C¨º»ò¡Acustom draw ¤S¬O¦p¦ó¿ì¨ìªº©O¡Hì¨Ó©Ò¦³¤ä´© custom draw ªº±±¥ó·|¦bø»s¸Ó±±¥ó®É¡A¦Û°Êªºµo°e³qª¾½X¬° NM_CUSTOMDRAW ªº WM_NOTIFY °T®§µ¹¤÷µøµ¡ªºµøµ¡¨ç¦¡¡A¨ä©ÒÄâ±aªº wParam ¬°±±¥óªºÃѧO½X¡AlParam ¬° NMCUSTOMDRAW µ²ºcÅé¦ì§}©Î¥H NMCUSTOMDRAW µ²ºcÅ鬰°_ÀYªº¥t¤@¸û¤jµ²ºcÅé¦ì§}¡C³oÓµ²ºcÅéùر¥]§t¤F¤@ÓÄæ¦ì¡AdwDrawStage¡A¨ä·N¸q¬°¦¹¨è§Y±N¶i¦æþÓø»s¶¥¬q¡Aµ{¦¡¥² ¶·°µ¾A·íªºªð¦^È¡A¥H«ü©wµ{¦¡t³dþ¨Ç³¡¥÷ªºÃ¸»s¡A¦Ó¨t²Î¤St³dø»sþ¨Ç³¡¥÷¡A³oÓ dwDrawStage ©Ò¥Nªíªº¼ÆÈ»P¸Óªð¦^¤°»ò¡A¬O custom draw ªººëÅè¡A®eµy«á¦A¸Ôz¡C©Ò¿×ªº¡u¥H NMCUSTOMDRAW µ²ºcÅ鬰°_ÀYªº¥t¤@¸û¤jµ²ºcÅé¡v³q±`¬Oµ¹¸û¬°½ÆÂøªº³q¥Î±±¥ó©Ò¨Ï¥Î¡A¨Ò¦p¡u¾ðª¬À˵ø¡v¡B¡u²M³æÀ˵ø]¡K¡Kµ¥µ¥¡C°Ñ¦Ò¤Uªí¡G
±±¥ó | µ²ºcÅé |
²M³æÀ˵ø ( list view ) | NMLVCUSTOMDRAW |
¤u¨ã¦C ( toolbar ) | NMTBCUSTOMDRAW |
¤u¨ã´£¥Ü ( tooltip ) | NMTTCUSTOMDRAW |
¾ðª¬À˵ø ( tree-view ) | NMTVCUSTOMDRAW |
¼ÐÃDÄæ ( header controls )¡Brebar controls¡Btrackbar controls | NMCUSTOMDRAW |
¤§©Ò¥H¦³³o¨Ç¤£¦Pªºµ²ºcÅé¡A·íµM¬O¦]¬°¨CºØ³q¥Î±±¥ó©Ê½è¤£¦PªºÃö«Y¡A¤£¹L¥»³¹¶È¶È°Q½×¾ðª¬À˵ø¦Ó¤w¡C
¥Ñ¤W±ªº±Ôz¥iª¾¡A³\¦h³q¥Î±±¥ó³£¯à¶i¦æ custom draw¡A¦ý¬O¥»³¹¶È¶È»¡©ú¾ðª¬À˵øªº custom draw ¥Îªk¡A©Ò¥H¤]¥u¤¶²Ð NMTVCUSTOMDRAW ¦Ó¤w¡C¦Ü©ó¨ä¥L³q¥Î±±¥óªº custom draw ¤j¦P¤p²§¡A½Ð¦Û¦æ¬ã¨s MSDN¡C¤@¶}©l¡A¥ý¬Ý¬Ý¥»³¹ªº¨Ò¤l¡ATVCD.EXE¡C¥¦°õ¦æ«á¡A¨Ï¥ÎªÌ¥i¥H¥Ñ¥D¿ï³æªº¡uÀ˵ø¡v¿ï¾Ü¥|ºØ¦r§Î»P¤TºØ¤j¤p¡A¤]¥i¥H¿ï¾Ü¥|ºØ¤£¦PªºI´º¡A¦p¤U¹Ï©Ò¥Ü¡G
¤W±ªº¨â±iÅã¥Üªº¬O¤£¥Î custom draw «áªºµ²ªG¡A³o¤]¬O¤@¯ë°õ¦æ¾ðª¬À˵ø¬Ý¨ìªº±¡§Î¡C©³¤Uªº¤T±i«h¬O¹ê¦æ custom draw «áªºµ²ªG¡J¥ªÃ䪺¾ðª¬À˵ø¡A¬O¨Ï¥ÎªÌ¿ï¾Ü¤FI´º¬°¡u¶À¬õº¥¶i¡v¡A¦r§Î¬°¡u12¡vÂIªº¡u·s²Ó©úÅé¡v¡F¤¤¶¡ªº¾ðª¬À˵ø¬O¿ï¾Ü¤FI´º¬°¡u¶À¥Õ¥æ¿ù¡v¡A¦r§Î¬°¡u14¡vÂIªº¡u·L³n¥¿¶ÂÅé¡v¡F¥kÃ䪺¾ðª¬À˵ø«h¬O¿ï¾Ü¤FI´º¬°¡u¬ü¤k¹Ï¡v¡A¦r§Î¬°¡u14¡vÂIªº¡uCourier New¡v¡C
¦pªG¤£¨Ï¥Î custom draw ¤è¦¡¡AÀ³¸Ó¬OµLªk³y¦¨¤W±ªºµe±¡C©³¤U¤p¤ì°¸±N¤¶²Ð¦b¾ðª¬À˵ø¨Ï¥Î custom draw¡C
Win32 ¨t²Î¦bø»s¾ðª¬À˵ø«e¡A·|¦Û¦æµo¥X³qª¾½X¬° NM_CUSTOMDRAW ªº WM_NOTIFY °T®§¡A¨ä wParam ¬O¾ðª¬À˵øªºÃѧO½X¡FlParam «h¬O NMTVCUSTOMDRAW µ²ºcÅé¦ì§}¡A³oÓµ²ºcÅ骺¦UÄæ¦ì¦p¤U©Ò¥Ü¡C±zÀ³·í¥i¥H¬Ý¨£¡ANMTVCUSTOMDRAW ªº²Ä¤@Ó¦¨û¬O NMCUSTOMDRAW µ²ºcÅé¡A¥t¥~ÁÙ¦³¤TÓÄæ¦ì¡A©Ò¥H¥»³¹¤@¶}©l¤~»¡ lParam ©Ò«üªº¦ì§}¬O¤@Ó¥H NMCUSTOMDRAW ¬°°_ÀYªºµ²ºcÅé¡C
NMTVCUSTOMDRAW STRUCT nmcd NMCUSTOMDRAW <> clrText COLORREF ? ;¶µ¥Ø¦WºÙªºÃC¦â clrTextBk COLORREF ? ;¶µ¥Ø¦WºÙI´ºÃC¦â iLevel DWORD ? ;®Ú¶µ¥Ø¬° 0¡F®Ú¶µ¥Øªº¤l¶µ¥Ø¬° 1¡F®Ú¶µ¥Øªº®]¶µ¥Ø¬° 2¡K¡K NMTVCUSTOMDRAW ENDS
NMTVCUSTOMDRAW µ²ºcÅ餤ªº clrText¡BcltRextBk¡BiLevel ¥i°Ñ¨£¤W±¥kÃ䪺µùÄÀ¡C¦pªGªð¦^®É¡A±z³]©w¤F clrText ©Î clrTextBk¡A¨Ã§@¨ä¥L¾A·íªº³]©w¡A¨º»ò´N·|§ïÅܶµ¥Ø¦WºÙªºÃC¦â¤Î¶µ¥Ø¦WºÙªºI´ºÃC¦â ( ¶µ¥Ø¦WºÙªºI´º¶È¶È¬O«ü¥]¦í¶µ¥Ø¦WºÙ¤å¦rªºµô°Å¯x§Î½d³ò¡A¨£¤W±¥ª¤U¹Ïªº»¡©ú¡Fµøµ¡À˵øªºI´º«h¬O°£¤Fµô°Å¯x§Î¥H¥~ªº¨ä¥L³¡¥÷ )¡CNMTVCUSTOMDRAW µ²ºcÅ骺²Ä¤@ÓÄæ¦ì¬O NMCUSTOMDRAW¡A¥¦¬O¥t¤@Óµ²ºcÅé¡A¨ä¦UÄæ¦ì¬O¡G
NMCUSTOMDRAW STRUCT hdr NMHDR <> dwDrawStage DWORD ? hdc DWORD ? rc RECT <> dwItemSpec DWORD ? uItemState DWORD ? lItemlParam DWORD ? NMCUSTOMDRAW ENDS
hdrµ²ºcÅé¤w¦b«e±¤w¸g´£¹L¡A¦¹³B¦A¦C¤@¹M¡A¥¦Ì¬O¡G
NMHDR STRUC hwndFrom HWND ? ;µo¥X WM_NOTIFY ªº±±¨î¶µ¥N½X idFrom DWORD ? ;µo¥X WM_NOTIFY ªº±±¨î¶µÃѧO½X code DWORD ? ;³qª¾½X ( notification ) NMHDR ENDS
NMCUSTOMDRAW µ²ºcÅ骺 hdc ¬O¾ðª¬±±¥óªº³]³Æ¤º®e¥N½X¡Crc ¬O§Y±Nø»sªº¯x§Î°Ï°ì¥u¦³ CDDS_ITEMPREPAINT¡BCDDS_PREPAINT ¶¥¬q¤~¦³®Ä ( CDDS_ ¬O«ü custom draw draw stage ¤§·N¡A¤¤¤å¬O¡u«È»s¤ÆªºÃ¸»s¶¥¬q¡v¡A³o¬O¥»³¹ªº«¶bÀ¸¡Aµy«á¦A¸Ôz )¡CdwItemSpec ¦b¾ðª¬À˵ø¤¤¡A¦pªGø»s¶¥¬q¬° CDDS_ITEM¡¯ ®É¡AdwItemSpec ªí¥Ü§Y±Nø»s©ÎÀ¿°£ªº¶µ¥Ø¥N½X¡F¦b²M³æÀ˵ø¤¤¡A¬°§Y±Nø»s©ÎÀ¿°£ªº¶µ¥Ø¯Á¤Þ¡ClItemParam ¬O¥Ñµ{¦¡¦Û¦æ©w¸qªº¼ÆÈ¡CuItemState ªí¥Ü¶µ¥Øª¬ºA¡A¥i¥H¬O¤U±´XºØ±¡§Î¡G
ª¬ºA | ¼ÆÈ | »¡¡@¡@©ú |
CDIS_CHECKED | 8 | ³B©ó³Q®Ö¿ïª¬ºA |
CDIS_DEFAULT | 20H | ¤º©wª¬ºA |
CDIS_DISABLED | 4 | ³B©ó¸T¤îª¬ºA |
CDIS_FOCUS | 10H | ¨ã¦³µJÂI |
CDIS_DISABLED | 2 | ³B©ó¦Ç¦âª¬ºA |
CDIS_HOT | 40H | ·Æ¹«´å¼Ð°±¯d¦b³oÓ¶µ¥Ø¤W |
CDIS_SELECTED | 1 | ³Q¿ï¤¤ª¬ºA |
CDIS_INDETERMINATE | 100H | |
CDIS_MARKED | 80H | |
CDIS_SHOWKEYBOARDCUES | 200H | |
CDIS_NEARHOT | 400H | |
CDIS_OTHERSIDEHOT | 800H | |
CDIS_DROPHILITED | 1000H | ¦b©ì¦²¹Lµ{¤¤¡A¦¹¶µ¥Ø³B©ó©ì¦²¥Ø¼Ðª¬ºA¤U |
©³¤Un»¡©ú¥»³¹«¶bÀ¸¡u«È»s¤ÆªºÃ¸»s¶¥¬q¡v¤F¡A¥¦¬O NMCUSTOMDRAW µ²ºcÅ骺¤@ÓÄæ¦ì¡AdwDrawStage¡A¬O«ü¨t²Î§Y±Nø»s¾ðª¬À˵ø®É©Ò³Bªº¶¥¬q¡A¥i¥H¬O¤U±¤@ºØ¼ÆÈ¡G
¦b¨t²Î§â¾ðª¬À˵øÅã¥Ü¦b¿Ã¹õ¤W®É¡A¾ú¸g¥|Ó¶¥¬q¡Gø»s«e¡÷À¿¥h«e¡÷À¿¥h«á¡÷ø»s«á¡A¥ç§Y CDDS_PREPAINT¡÷CDDS_PREERASE¡÷CDDS_POSTERASE¡÷CDDS_POSTPAINT¡C³oùتº«ä¦ÒÅÞ¿è¬O§â¡uÀ¿¥h¡v¤]·í¦¨¬Oø»sªº¤@³¡¥÷¡C¸Õ·Q¦pªG¨t²Înø»s¤@±±¥ó¡A«K¥ß§Y¶i¤Jø»s«e¶¥¬q¡AµM«á¨t²ÎnÀ¿¥hì¥ý¹Ï®×¡A©ó¬O²Ä¤GÓ¶¥¬q¬OÀ¿¥h«e¡A±µµÛ¨t²Î°õ¦æÀ¿¥h¹Ï®×ªº¨BÆJ¡A±µµÛ¶i¤JÀ¿¥h«á¶¥¬q¡AµM«áÀ³¸Ó¬O¨t²Îø»s¡A§¹¦¨«á´N¬Oø»s±±¥ó¤§«áªº¶¥¬q¡C¦Ó¨t²Îø»s¾ãÓ±±¥ó®É¡A¤]·|¹ï¨CÓ¶µ¥Ø¶i¦æø»s¡C¨C¤@Ó¶µ¥Øø»s®É¤]¾ú¸g¥|Ó¶¥¬q¡Gø»s«e¡÷À¿¥h«e¡÷À¿¥h«á¡÷ø»s«á¡A¥ç§Y CDDS_ITEMPREPAINT¡÷CDDS_ITEMPREERASE¡÷CDDS_ITEMPOSTERASE¡÷CDDS_ITEMPOSTPAINT¡C«äºû¤è¦¡¤@¦p¤W±Ã¸»s¾ãÓ±±¥ó¡C¦]¦¹¡A·í¨t²Î¶i¦æø»s±±¥ó®É¡A±±¥ó·|¤£Â_ªº¹ï¤÷µøµ¡µo¥XÄâ±a NM_CUSTOMDRAW ³qª¾½Xªº WM_NOTIFY °T®§¡A¦¹ WM_NOTIFY °T®§ªº lParam °Ñ¼Æ©Ò«üµ²ºcÅ餤ªº dwDrawStage Äæ¦ì¡A«K·|¬O¤W±¨º¤KÓø»s¶¥¬qªº¬Y¤@Ó¡C
«e±»¡¹L¡A¨Ï¥Î custom draw ®É¡A¥i¥H«D±`¦³¼u©Ê¡Aµ{¦¡¥i¥H¥ut³dø»s¤@¤p³¡¥÷¡A¤]¥i¥Ht³dø»s¤j³¡¤À¡A©Î¬O¥þ³¡¥Ñµ{¦¡t³d¡C¨ä¤¤ªºÃöÁä¦b©ó·í³B©ó¦UºØø»s¶¥¬q®É¡A¥²¶·³]©w¾A·íªºªð¦^È¡A¨º»ò±±¥ó´N¯à¨Ì¾Úªð¦^Èø»s¸Óµe¥Xªº³¡¥÷¡C·í dwDrawStage ¬° CDDS_PREPAINT ®É¡A¥²¶·«ü©w¤U±ªº¤@Ó¼ÆȩμÆÓ¼ÆȪºÁp¶°°µ¬°ªð¦^È¡G
ªð¦^È | ¤Q¤»¶i¦ì ¼ÆÈ | »¡¡@¡@©ú |
CDRF_DODEFAULT | 0 | ±±¥ó¤£¦Aµo¥X NM_CUSTOMDRAW ³qª¾½X¡A¨t²Î³B²z©Ò¦³ªºÃ¸»s¹Lµ{¡CCDRF_DODEFAULT ¤£¥i»P¨ä¥¦ªð¦^ÈÁp¶°¨Ï¥Î¡C |
CDRF_DOERASE | 08H | ¨t²Î¶È¶Èt³dø»sI´º¡A¨ä¾l³¡¥÷¥²¶·¥Ñµ{¦¡¦Û¦æø»s¡CWindows Vista ¤Î¨ä¥H«áªº¨t²Î¤~¯à¨Ï¥Î¡C |
CDRF_SKIPDEFAULT | 04H | ¦b©Ò¦³Ã¸»s¶¥¬q¡A±±¥ó³£·|µo¥X NM_CUSTOMDRAW ³qª¾½X¡A¥Ñµ{¦¡t³dø»s±±¥ó©Ò¦³³¡¥÷¡A¨t²Î¤£Ã¸»s¥ô¦ó¶¥¬q¡C |
CDRF_NOTIFYPOSTERASE | 40H | ¦bÀ¿¥h¬YÓ¶µ¥Ø¤§«á¡A±±¥óµo¥X NM_CUSTOMDRAW ³qª¾½X¡C |
CDRF_NOTIFYPOSTPAINT | 10H | ¦b¨t²Î§¹¦¨Ã¸»s¾ãÓ±±¥ó«á¡A¹ï¤÷µøµ¡µo¥X NM_CUSTOMDRAW ³qª¾½X¡C |
CDRF_NOTIFYITEMDRAW | 20H | ¦b¨t²Îø»s¬YÓ¶µ¥Ø¤§«e©Îø»s¤§«á¡A¹ï¤÷µøµ¡µo¥X NM_CUSTOMDRAW ³qª¾½X¡C |
CDRF_SKIPPOSTPAINT | 100H | ¨t²Î¤£Ã¸»s³Q¿ï¤¤¶µ¥Ø¯x§Î°Ï°ì¡A»Ý¥Ñµ{¦¡Ã¸»s¡C |
©³¤U»¡©ú´XÓ±¡§Î¡J
¦¹³B¯S§Onª`·Nªº¬O¡Aø»s¶¥¬qªºªð¦^È¥²¶·©I¥s SetWindowLong¡A³o¼Ë¤~¯à¶Ç¦^µ¹¨t²Î¡A¦p¤U¡J
INVOKE SetWindowLong,hDlg,DWL_MSGRESULT,CDRF_NOTIFYITEMDRAW
·Ó¤p¤ì°¸ªº¸gÅç¡AÁöµM±±¥óªºÃ¸»s¦³¥|Ó¶¥¬q¡A¦ý¬O¦ü¥G¥u¦³ CDDS_PREPAINT ³Ì¬°±`¥Î¡ACDDS_POSTPAINT ¦¸¤§¡ACDDS_PREERASE »P CDDS_POSTERASE ´X¥G«Ü¤Ö¥Î¡C°£«D¬Oªð¦^ CDRF_SKIPDEFAULT¡A±zªºµ{¦¡¤~¯à±µºÞ³o¨âÓø»s¶¥¬q¡A¦ý¬O¦b³o¨âÓø»s¶¥¬q¯à°µªº¨Æ¡A¦ü¥G¤]¤£¦h¡C
»¡¤F³o»ò¦h¡A©³¤U¨Ó¬Ý¬Ý¹ê»Úªº½d¨Ò¡C¥ý¬Ý TVCD.RC ªºì©l½X¡C
1 2 3 4
5 6 7 8
9
10 11 12 13
14 15 16 17
18 19 20 21
22 23 24 25
26 27 28 29
30 31 32 33
34 35 36 37
38 39 40 41
42 43 44 45
46 47 48 49
50 51 52 53
54 55 56 57
58 59 60 61
62 63 64 65 |
#include "c:\masm32\include\resource.h"
#define RT_MANIFEST 24
#define IDM_DRVA 6001
#define IDC_TREEVIEW 1600
#define IDM_PMingLiU 5000
#define IDM_MSJhengHe 5001
#define IDM_CourierNew 5002
#define IDM_TNR 5003
#define IDM_TEN 5004
#define IDM_TWELVE 5005
#define IDM_FOURTEEN 5006
#define IDM_WHITE 5007
#define IDM_GRADIENT 5008
#define IDM_INTERLOCK 5009
#define IDM_LADY 5010
#define IDM_Exit 5011
TVCustomDraw ICON folder2.ico
TVCustomDraw DIALOG 100,100,200,150
STYLE WS_CAPTION|WS_VISIBLE|WS_SYSMENU
FONT 10,"·s²Ó©úÅé"
CAPTION "¾ðª¬À˵ø«È»s¤Æø»s"
MENU FLST
BEGIN
CONTROL "",IDC_TREEVIEW,"SysTreeView32",WS_BORDER|TVS_HASBUTTONS|TVS_NOTOOLTIPS|
TVS_HASLINES|TVS_LINESATROOT|TVS_INFOTIP,5,5,190,140
END
FLST MENU
BEGIN
MENUITEM "Â÷¶}",IDM_Exit
POPUP "ºÏºÐ¾÷"
{
MENUITEM "A:",IDM_DRVA
}
POPUP "À˵ø"
{
POPUP "¦r«¬"
{
MENUITEM "·s²Ó©úÅé",IDM_PMingLiU
MENUITEM "·L³n¥¿¶ÂÅé",IDM_MSJhengHe
MENUITEM "Courier New",IDM_CourierNew
MENUITEM "Times New Roman",IDM_TNR
MENUITEM SEPARATOR
MENUITEM "10",IDM_TEN
MENUITEM "12",IDM_TWELVE
MENUITEM "14",IDM_FOURTEEN
}
POPUP "I´º"
{
MENUITEM "¥Õ¦â",IDM_WHITE
MENUITEM "¶À¬õº¥¶i",IDM_GRADIENT
MENUITEM "¶À¥Õ¥æ¿ù",IDM_INTERLOCK
MENUITEM "I´º¡G¬ü¤k¹Ï",IDM_LADY
}
}
END
1 RT_MANIFEST MOVEABLE PURE "TVCD.EXE.MANIFEST"
Lady BITMAP lady.bmp
Expand BITMAP add.bmp
Collapse BITMAP sub.bmp
|
¨ä¥LÁÙ¦³ lady.bmp¡Badd.bmp¡Bsub.bmp¡Bfolder2.ico µ¥¥|ӹϧÎÀɮסA¤p¤ì°¸±N¥¦À£ÁY¨ì³oÓÀÉ®×ùØ¡A½ÐÂIÀ»¤U¸ü¡C
1 2 3 4
5 6 7 8
9 10 11 12
13 14 |
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
<dependency>
<dependentAssembly>
<assemblyIdentity type='win32'
name='Microsoft.Windows.Common-Controls'
version='6.0.0.0'
processorArchitecture='*'
publicKeyToken='6595b64144ccf1df'
language='*'
/>
</dependentAssembly>
</dependency>
</assembly> |
1 2 3 4
5 6 7 8
9
10 11 12 13
14 15 16 17
18 19 20 21
22 23 24 25
26 27 28 29
30 31 32 33
34 35 36 37
38 39 40 41
42 43 44 45
46 47 48 49
50 51 52 53
54 55 56 57
58 59 60 61
62 63 64 65
66 67 68 69
70 71 72 73
74 75 76 77
78 79 80 81
82 83 84 85
86 87 88 89
90 91 92 93
94 95 96 97
98 99
100 101 102 103
104 105 106 107
108 109 110 111
112 113 114 115
116 117 118 119
120 121 122 123
124 125 126 127
128 129 130 131
132 133 134 135
136 137 138 139
140 141 142 143
144 145 146 147
148 149 150 151
152 153 154 155
156 157 158 159
160 161 162 163
164 165 166 167
168 169 170 171
172 173 174 175
176 177 178 179
180 181 182 183
184 185 186 187
188 189 190 191
192 193 194 195
196 197 198 199
200 201 202 203
204 205 206 207
208 209 210 211
212 213 214 215
216 217 218 219
220 221 222 223
224 225 226 227
228 229 230 231
232 233 234 235
236 237 238 239
240 241 242 243
244 245 246 247
248 249 250 251
252 253 254 255
256 257 258 259
260 261 262 263
264 265 266 267
268 269 270 271
272 273 274 275
276 277 278 279
280 281 282 283
284 285 286 287
288 289 290 291
292 293 294 295
296 297 298 299
300 301 302 303
304 305 306 307
308 309 310 311
312 313 314 315
316 317 318 319
320 321 322 323
324 325 326 327
328 329 330 331
332 333 334 335
336 337 338 339
340 341 342 343
344 345 346 347
348 349 350 351
352 353 354 355
356 357 358 359
360 361 362 363
364 365 366 367
368 369 370 371
372 373 374 375
376 377 378 379
380 381 382 383
384 385 386 387
388 389 390 391
392 393 394 395
396 397 398 399
400 401 402 403
404 405 406 407
408 409 410 411
412 413 414 415
416 417 418 419
420 421 422 423
424 425 426 427
428 429 430 431
432 433 434 435
436 437 438 439
440 441 442 443
444 445 446 447
448 449 450 451
452 453 454 455
456 457 458 459
460 461 462 463
464 465 466 467
468 469 470 471
472 473 474 475
476 477 478 479
480 481 482 483
484 485 486 487
488 489 490 491
492 493 494 495
496 497 498 499
500 501 502 503
504 505 506 507
508 509 510 511
512 513 514 515
516 517 518 519
520 521 522 523
524 525 526 527
528 529 530 531
532 533 534 535
536 537 538 539
540 541 542 543
544 545 546 547
548 549 550 551
552 553 554 555
556 557 558 559
560 561 |
.586
.MODEL FLAT,STDCALL
OPTION CASEMAP:NONE
INCLUDE WINDOWS.INC
INCLUDE COMCTL32.INC
INCLUDE GDI32.INC
INCLUDE KERNEL32.INC
INCLUDE MSIMG32.INC
INCLUDE USER32.INC
INCLUDELIB COMCTL32.LIB
INCLUDELIB GDI32.LIB
INCLUDELIB KERNEL32.LIB
INCLUDELIB MSIMG32.LIB
INCLUDELIB USER32.LIB
IDC_TREEVIEW EQU 1600
IDM_PMingLiU EQU 5000
IDM_MSJhengHe EQU 5001
IDM_CourierNew EQU 5002
IDM_TNR EQU 5003
IDM_TEN EQU 5004
IDM_TWELVE EQU 5005
IDM_FOURTEEN EQU 5006
IDM_WHITE EQU 5007
IDM_GRADIENT EQU 5008
IDM_INTERLOCK EQU 5009
IDM_LADY EQU 5010
IDM_Exit EQU 5011
IDM_DRVA EQU 6000
TVINSERTSTRUCT STRUC
hParent HANDLE ?
hInsertAfter HANDLE ?
UNION
itemex TVITEMEX <>
item TVITEM <>
ENDS
TVINSERTSTRUCT ENDS
;***************************************************************************************************
.CONST
szDlgName DB "TVCustomDraw",0
szIconName DB "TVCustomDraw",0
szLogicalDrv DB "E:\",0
szPMingLiU DB "·s²Ó©úÅé",0
szMSJhengHe DB "·L³n¥¿¶ÂÅé",0
szCourierNew DB "Courier New",0
szTNR DB "Times New Roman",0
arypFont LPSTR OFFSET szPMingLiU,OFFSET szMSJhengHe,OFFSET szCourierNew,OFFSET szTNR
szLady DB "Lady",0 ;¬ü¤k¹Ïªº¦WºÙ
szCollapse DB "Collapse",0 ;´î¸¹¡Aªí¥Ü¥i¥H®i¶}
szExpand DB "Expand",0 ;¥[¸¹¡Aªí¥Ü¥i¥H¦¬Ãl
;***************************************************************************************************
.DATA
hInstance HINSTANCE ?
hTreeView HANDLE ?
hbrWhite HBRUSH ? ;¥Õ¦âµe¨ê
hbrYellow HBRUSH ? ;¶À¦âµe¨ê
hbmpLady HBITMAP ?
hbmpExpand HBITMAP ? ;¦¬Ãl®Éªº²Å¸¹¡A¥[¸¹
hbmpCollapse HBITMAP ? ;®i¶}«áªº²Å¸¹¡A´î¸¹
cxLady DWORD ? ;¡uLady¡v¹Ïªº¼e«×
cyLady DWORD ? ;¡uLady¡v¹Ïªº°ª«×
cxExpand DWORD ? ;¡uExpand¡v¹Ïªº¼e«×
cyExpand DWORD ? ;¡uExpand¡v¹Ïªº°ª«×
hMainMenu HMENU ? ;¥D¿ï³æ¥N½X
hDrvMenu HMENU ? ;¿ï¾ÜºÏºÐ¾÷ªº¤l¿ï³æ¥N½X
hViewMenu HMENU ? ;¡uÀ˵ø¡v¤l¿ï³æ¥N½X¡A¤U¦³¦r§Î¡BI´º¨âÓ¤l¿ï³æ
hViewFontMenu HMENU ? ;¡u¦r§Î¡v¤l¿ï³æ¥N½X
hViewBgMenu HMENU ? ;¡uI´º¡v¤l¿ï³æ¥N½X
hTreeRootItem HTREEITEM ?
dwBk DWORD 0 ;¾ðª¬À˵øªºI´º¡G0¡Ð¥Õ¦â¡F1¡Ð¬õ¶Àº¥¶i¡F2¡Ð¶À¥Õ¥æ¿ù¡F3¡Ð¬ü¤k¹Ï
dwFont DWORD 0 ;¦r§Î¡G0¡Ð·s²Ó©úÅé¡F1¡Ð·L³n¥¿¶ÂÅé¡F2¡Ð"Courier New"¡F3¡Ð"Times New Roman"
dwFontSize DWORD 1 ;¦r§Î¤j¤p¡G0¡Ð10ÂI¡F1¡Ð12ÂI¡F2¡Ð14ÂI
dwDrv DWORD 2 ;ºÏºÐ¾÷¡G0¡ÐA:¡F1¡ÐB:¡F2¡ÐC:¡F3¡ÐD:¡L¡L¡L
nLogDrv DWORD 1 ;°O¿ýÅÞ¿èºÏºÐӼơA¥H°µ¬°§R°£¤l¶µ¥Ø¤§¥Î
rcTreeView RECT <> ;¾ðª¬À˵ø¤u§@°Ï¤j¤p
dwIndent DWORD ? ;¤l¶µ¥Ø»P¤÷¶µ¥Ø¤ºÁY¦h¤ÖÂI
ary_tvt TRIVERTEX <0,0,0ffffh,0,0,0>,<?,?,0ffffh,0ffffh,0,0>
grect GRADIENT_RECT <0,1>
xScroll DWORD 0 ;±²¶b¾ÞÁa±ìªº¤ô¥¦ì¸m
yScroll DWORD 0 ;±²¶b¾ÞÁa±ìªº¹]««¦ì¸m
;***************************************************************************************************
.CODE
;---------------------------------------------------------------------------------------------------
;¦b¾ðª¬À˵øªºI´º¤¤¡Aµe¥X¥Ñ¬õº¥¶iÅܶÀ¦âªºI´º¹Ï
gradient PROC
ASSUME ebx:PTR NMTVCUSTOMDRAW
;LOCAL hdcMem:HDC,hbmMem:HBITMAP
;INVOKE CreateCompatibleDC,[ebx].nmcd.hdc
;mov hdcMem,eax
;INVOKE CreateCompatibleBitmap,[ebx].nmcd.hdc,[ebx].nmcd.rc.right,[ebx].nmcd.rc.bottom
;mov hbmMem,eax
;INVOKE SelectObject,hdcMem,eax
mov edx,SIZEOF TRIVERTEX
mov eax,[ebx].nmcd.rc.right
mov ecx,[ebx].nmcd.rc.bottom
mov ary_tvt[edx].x,eax
mov ary_tvt[edx].y,ecx
INVOKE GradientFill,[ebx].nmcd.hdc,OFFSET ary_tvt,2,OFFSET grect,1,GRADIENT_FILL_RECT_H
;INVOKE BitBlt,[ebx].nmcd.hdc,0,0,[ebx].nmcd.rc.right,[ebx].nmcd.rc.bottom,hdcMem,0,0,SRCCOPY
;INVOKE DeleteDC,hdcMem
;INVOKE DeleteObject,hbmMem
ASSUME ebx:NOTHING
ret
gradient ENDP
;---------------------------------------------------------------------------------------------------
;¨ú±oÅÞ¿èºÏºÐªº®Ú¥Ø¿ý¤Î¨ä©Ò¦³ÀɮצWºÙ¡B¤l¥Ø¿ý¦WºÙ¡A§@¬°¾ðª¬À˵øªº¶µ¥Ø
;¿é¤J¡GhTreeCtrl¡Ð¾ðª¬À˵ø¥N½X
; nLogHD¡ÐÅÞ¿èºÏºÐ¦WºÙ
;¿é¥X¡GEAX¡Ð®Ú¶µ¥Ø¥N½X
GetFileAsItem PROC USES esi edi hTreeCtrl:DWORD,nLogHD:DWORD
LOCAL szRootDir[8]:BYTE ;¡uX:\*.*0¡v¦r¦ê
LOCAL w32fd:WIN32_FIND_DATA
LOCAL tvis:TVINSERTSTRUCT
LOCAL hSearch:HANDLE
LOCAL hRootItem:HTREEITEM
mov tvis.hParent,TVI_ROOT
mov tvis.hInsertAfter,TVI_FIRST
mov tvis.item.imask,TVIF_CHILDREN or TVIF_TEXT
lea edi,szRootDir
mov eax,nLogHD
mov edx,edi
add eax,'A'
stosb
mov eax,2e2a5c3ah
stosd
mov ax,2ah
stosw
mov tvis.item.pszText,edx
mov tvis.item.cChildren,1
INVOKE SendMessage,hTreeCtrl,TVM_INSERTITEM,0,ADDR tvis
mov hRootItem,eax
INVOKE FindFirstFile,ADDR szRootDir,ADDR w32fd
mov hSearch,eax
cmp eax,INVALID_HANDLE_VALUE
je finish
.WHILE eax!=0
mov ecx,hRootItem
mov tvis.hParent,ecx
mov tvis.hInsertAfter,TVI_LAST
mov tvis.itemex.imask,TVIF_CHILDREN or TVIF_TEXT or TVIF_IMAGE or TVIF_SELECTEDIMAGE
lea edx,w32fd.cFileName
mov tvis.itemex.cChildren,0
mov tvis.itemex.pszText,edx
mov ecx,3
test w32fd.dwFileAttributes,FILE_ATTRIBUTE_DIRECTORY
jz @f
mov ecx,2
@@: mov tvis.itemex.iImage,ecx
mov tvis.itemex.iSelectedImage,ecx
INVOKE SendMessage,hTreeCtrl,TVM_INSERTITEM,0,ADDR tvis
INVOKE FindNextFile,hSearch,ADDR w32fd
.ENDW
finish: INVOKE FindClose,hSearch
mov eax,hRootItem
ret
GetFileAsItem ENDP
;---------------------------------------------------------------------------------------------------
;I´º¥Ñ¥Õ¦â»P¶À¦â¥æ¿ù¦Ó¦¨
interlock PROC
LOCAL rcExtItem:RECT
LOCAL dwItemHight,nItem,n:DWORD
INVOKE SendMessage,hTreeView,TVM_GETITEMHEIGHT,0,0
mov ecx,eax
sub edx,edx
mov eax,rcTreeView.bottom
div ecx
mov dwItemHight,ecx
mov nItem,eax
mov n,0
mov edx,rcTreeView.right
mov rcExtItem.left,0
mov rcExtItem.right,edx
mov rcExtItem.top,0
mov rcExtItem.bottom,ecx
.WHILE nItem>0
mov ecx,hbrWhite
test n,1
jz @f
mov ecx,hbrYellow
ASSUME ebx:PTR NMTVCUSTOMDRAW
@@: INVOKE FillRect,[ebx].nmcd.hdc,ADDR rcExtItem,ecx
ASSUME ebx:NOTHING
mov ecx,dwItemHight
add rcExtItem.bottom,ecx
add rcExtItem.top,ecx
inc n
dec nItem
.ENDW
ret
interlock ENDP
;---------------------------------------------------------------------------------------------------
;¨Ì¾ÚdwFont¡BdwFontSize¤§È¡A³]©w¦r§Î¤Î¨ä¤j¤p
set_font PROC
ASSUME ebx:PTR NMTVCUSTOMDRAW
mov ecx,dwFont
mov eax,dwFontSize
shl ecx,2
shl eax,1
add ecx,OFFSET arypFont
add eax,10
mov edx,[ecx]
INVOKE CreateFont,eax,0,0,0,FW_NORMAL,0,0,0,ANSI_CHARSET,OUT_DEFAULT_PRECIS,\
CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH or FF_DONTCARE,edx
INVOKE SelectObject,[ebx].nmcd.hdc,eax
INVOKE DeleteObject,eax
ret
set_font ENDP
;---------------------------------------------------------------------------------------------------
;¦¹°Æµ{¦¡µe¥X¦U¶µ¥Ø¤§«eªºµê½u
draw_line PROC
LOCAL x,y,cyItem,counter:DWORD ;µe¥X¶µ¥Ø«eªºµê½u®É¨Ï¥ÎªºÅܼÆ
INVOKE SendMessage,hTreeView,TVM_GETITEMHEIGHT,0,0
;µe¥X¶µ¥Ø©Ò¦b¯x§Î¤ºªº««ª½µê½u
mov cyItem,eax
shr eax,1
mov counter,eax
mov ecx,[ebx].nmcd.rc.top
dec ecx
mov x,26
mov y,ecx
;Àˬd¬O§_¬°³Ì«á¤@Ó¶µ¥Ø¡AY¬O¡AEAX¡×0
INVOKE SendMessage,hTreeView,TVM_GETNEXTITEM,TVGN_NEXT,[ebx].nmcd.dwItemSpec
.IF eax==0
shr counter,1
inc counter
.ENDIF
.WHILE counter!=0
INVOKE SetPixel,[ebx].nmcd.hdc,x,y,99a8ach
add y,2
dec counter
.ENDW
;µe¥X¶µ¥Ø©Ò¦b¯x§Î¤ºªº¤ô¥µê½u
mov eax,cyItem
shr eax,1
add eax,[ebx].nmcd.rc.top
dec eax
mov x,28
mov y,eax
mov counter,4
.WHILE counter!=0
INVOKE SetPixel,[ebx].nmcd.hdc,x,y,99a8ach
add x,2
dec counter
.ENDW
ASSUME ebx:NOTHING
ret
draw_line ENDP
;---------------------------------------------------------------------------------------------------
DlgProc PROC hDlg:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
LOCAL buffer[MAX_PATH]:BYTE
LOCAL sLogDrvStr[4*26]:BYTE
LOCAL rcDlgOrItm:RECT ;¹ï¸Ü²°µøµ¡¯x§Î©Î¶µ¥Ø°Åµô¯x§Î
LOCAL hdcMem:HDC
LOCAL mii:MENUITEMINFO
LOCAL bm:BITMAP,tvi:TVITEM
.IF uMsg==WM_NOTIFY
ASSUME ebx:PTR NM_TREEVIEW
push ebx
mov ebx,lParam
mov eax,[ebx].hdr.hwndFrom ;EAX¡×µo¥XWM_NOTIFYªº±±¨î¶µ¥N½X
.IF eax==hTreeView
.IF [ebx].hdr.code==NM_CUSTOMDRAW
ASSUME ebx:PTR NMTVCUSTOMDRAW
.IF [ebx].nmcd.dwDrawStage==CDDS_PREPAINT
.IF dwBk==1 ;I´º¬°¬õ¦âº¥¶iÅܬ°¶À¦â
call gradient
.ELSEIF dwBk==2 ;I´º¬°¶À¥Õ¥æ¿ù
call interlock
.ELSEIF dwBk==3 ;I´º¬°¬ü¤k¹Ï
INVOKE CreateCompatibleDC,[ebx].nmcd.hdc
mov hdcMem,eax
INVOKE SelectObject,hdcMem,hbmpLady ;¿ï©w¨Ó·½³]³Æ¤º®eªº¦ì¤¸¹Ï
INVOKE BitBlt,[ebx].nmcd.hdc,0,0,cxLady,cyLady,hdcMem,0,0,SRCCOPY ;¶Ç°e¦ì¤¸¹Ï¨ìµøµ¡ªº³]³Æ¤º®e
INVOKE DeleteDC,hdcMem
.ENDIF
INVOKE SetWindowLong,hDlg,DWL_MSGRESULT,CDRF_NOTIFYITEMDRAW OR CDRF_NOTIFYPOSTPAINT
.ELSEIF [ebx].nmcd.dwDrawStage==CDDS_ITEMPREPAINT
call set_font ;¨Ì¾ÚdwFont¡BdwFontSize³]©w¤å¦r¦r§Î»P¦rÅé¤j¤p
.IF dwBk==0 ;I´º¬°¥Õ¦â
mov edx,CDRF_DODEFAULT
.ELSEIF (dwBk==1)||(dwBk==3);I´º¬°¬ü¤k¹Ï©Î¬õ¶Àº¥¶i¦â
INVOKE SetBkMode,[ebx].nmcd.hdc,TRANSPARENT
;¨ú±o¶µ¥Ø¸ê®Æ¡A¥]§t¦WºÙ¡Bª¬ºA¡B¦³µL¤l¶µ¥Ø
mov eax,[ebx].nmcd.dwItemSpec
lea ecx,buffer
mov tvi.imask,TVIF_TEXT or TVIF_STATE or TVIF_CHILDREN
mov tvi.pszText,ecx
mov tvi.hItem,eax
mov tvi.cchTextMax,SIZEOF buffer
INVOKE SendMessage,hTreeView,TVM_GETITEM,0,ADDR tvi
cmp [ebx].iLevel,0 ;Àˬd¬O§_¬°®Ú¶µ¥Ø¡A®Ú¶µ¥Ø¤£µe½u
jz print_icon
call draw_line ;µe¥Xµê½u
print_icon: ;¦L¥X¡u+¡v¡u-¡v¹Ï¥Ü¡A¥Nªí¦³¤l¶µ¥Øªº¶µ¥Ø¡A³B©ó¡u¦¬Ãl¡v©Î¡u®i¶}¡vª¬ºA
.IF tvi.cChildren>=1
INVOKE CreateCompatibleDC,[ebx].nmcd.hdc
mov hdcMem,eax
mov ecx,hbmpCollapse
test tvi.state,TVIS_EXPANDED
jnz print_it
mov ecx,hbmpExpand
print_it: INVOKE SelectObject,hdcMem,ecx
INVOKE BitBlt,[ebx].nmcd.hdc,8,2,cxExpand,cyExpand,hdcMem,0,0,SRCCOPY
INVOKE DeleteDC,hdcMem
.ENDIF
;¶µ¥Ø¦WºÙ¦bÁY±ÆÂI¼Æ¡Ñ(²Ä´X¶¥+1)¤§«á
mov eax,dwIndent
sub edx,edx
mov ecx,[ebx].iLevel
inc ecx
mul ecx
add eax,[ebx].nmcd.rc.left
mov ecx,[ebx].nmcd.rc.top
mov rcDlgOrItm.left,eax
mov rcDlgOrItm.top,ecx
INVOKE DrawText,[ebx].nmcd.hdc,ADDR buffer,-1,ADDR rcDlgOrItm,DT_CALCRECT or DT_SINGLELINE
test tvi.state,TVIS_SELECTED
jz transparent
INVOKE GetSysColor,COLOR_HIGHLIGHT
INVOKE CreateSolidBrush,eax
push eax
INVOKE FillRect,[ebx].nmcd.hdc,ADDR rcDlgOrItm,eax
call DeleteObject
;¦L¥X¶µ¥Ø¦WºÙ
transparent: INVOKE DrawText,[ebx].nmcd.hdc,ADDR buffer,-1,ADDR rcDlgOrItm,DT_VCENTER
mov edx,CDRF_SKIPDEFAULT
.ELSEIF dwBk==2 ;I´º¬°¶À¥Õ¥æ¿ù
INVOKE GetSysColor,COLOR_HIGHLIGHT
mov [ebx].clrTextBk,eax ;³Q¿ï©wªº¶µ¥Ø¤å¦rI´ºÃC¦â
INVOKE GetSysColor,COLOR_HIGHLIGHTTEXT
mov [ebx].clrText,eax ;³Q¿ï©wªº¶µ¥Ø¤å¦rÃC¦â
test [ebx].nmcd.uItemState,CDIS_SELECTED ;Àˬd¬O§_³Q¿ï©w¡A¬Oªº¸ÜNZ
jnz @f
INVOKE SendMessage,hTreeView,TVM_GETITEMHEIGHT,0,0
mov ecx,eax ;·í¤Unø»sªº¯x§Î°Ï°ì®y¼Ð(¦s©ó[ebx].nmcd.rc.top)
sub edx,edx ;°£¥H¨C¦C°ª«×(¥HTVM_GETITEMHIGH±o¨ì)¡A§Y¬°²Ä´X¦C
mov eax,[ebx].nmcd.rc.top
mov [ebx].clrText,edx ;¥¼³Q¿ï©wªº¤å¦r¬°¶Â¦â
mov [ebx].clrTextBk,0ffffffh;°¸¼Æ¦Cªº¤å¦rI´º¬°¥Õ¦â
div ecx
test eax,1
jz @f
mov [ebx].clrTextBk,0ffffh ;©_¼Æ¦Cªº¤å¦rI´º¬°¶À¦â
@@: mov edx,CDRF_NOTIFYITEMDRAW
.ENDIF
INVOKE SetWindowLong,hDlg,DWL_MSGRESULT,edx
.ELSEIF [ebx].nmcd.dwDrawStage==CDDS_POSTPAINT
INVOKE GetScrollPos,hTreeView,SB_HORZ
.IF eax!=xScroll
mov xScroll,eax
jmp redraw
.ENDIF
INVOKE GetScrollPos,hTreeView,SB_VERT
.IF eax!=yScroll
mov yScroll,eax
redraw: INVOKE InvalidateRect,hTreeView,0,FALSE
.ENDIF
.ENDIF
.ENDIF
.ENDIF
ASSUME ebx:NOTHING
pop ebx
.ELSEIF uMsg==WM_COMMAND
.IF lParam==0
mov eax,wParam
mov mii.cbSize,SIZEOF mii
mov mii.fMask,MIIM_STATE
mov mii.fState,MFS_UNCHECKED
and eax,0ffffh ;EAX¡×¿ï³æÃѧO½X
.IF eax==IDM_Exit
jmp exit
.ELSEIF (eax==IDM_PMingLiU)||(eax==IDM_MSJhengHe)||(eax==IDM_CourierNew)||(eax==IDM_TNR)
;¥H¤U³B²z¦r§Î
sub eax,IDM_PMingLiU ;EAX¡×²{¦b³Q¿ï©wªºI´º¿ï¶µÃѧO½X¦A´î¥hIDM_PMingLiU
mov ecx,dwFont ;ECX¡×ì¨Ó³Q¤Ä¿ïªºI´º¿ï¶µÃѧO½X¦A´î¥hIDM_PMingLiU
.IF eax!=ecx ;Y¬Ûµ¥¡Aªí¥Ü¿ï¨ìì¥ý´N¤w¤Ä¿ïªº¿ï¶µ
add ecx,IDM_PMingLiU
mov dwFont,eax
INVOKE SetMenuItemInfo,hViewFontMenu,ecx,FALSE,ADDR mii ;§âì¨Ó¿ï¶µ³]¬°¥¼¿ï©w
mov mii.fState,MFS_CHECKED
INVOKE SetMenuItemInfo,hViewFontMenu,wParam,FALSE,ADDR mii ;³]©w·sªº¿ï©w¿ï¶µ
INVOKE InvalidateRect,hTreeView,0,TRUE
.ENDIF
.ELSEIF (eax==IDM_TEN)||(eax==IDM_TWELVE)||(eax==IDM_FOURTEEN)
;¥H¤U³B²z¦rÅé¤j¤p
sub eax,IDM_TEN
mov ecx,dwFontSize
.IF eax!=ecx
add ecx,IDM_TEN
mov dwFontSize,eax
INVOKE SetMenuItemInfo,hViewFontMenu,ecx,FALSE,ADDR mii
mov mii.fState,MFS_CHECKED
INVOKE SetMenuItemInfo,hViewFontMenu,wParam,FALSE,ADDR mii
INVOKE InvalidateRect,hTreeView,0,TRUE
.ENDIF
.ELSEIF (eax==IDM_WHITE)||(eax==IDM_GRADIENT)||(eax==IDM_INTERLOCK)||(eax==IDM_LADY)
;¥H¤U³B²zI´º
sub eax,IDM_WHITE
mov ecx,dwBk
.IF eax!=ecx
add ecx,IDM_WHITE
mov dwBk,eax
INVOKE SetMenuItemInfo,hViewBgMenu,ecx,FALSE,ADDR mii
mov mii.fState,MFS_CHECKED
INVOKE SetMenuItemInfo,hViewBgMenu,wParam,FALSE,ADDR mii
INVOKE InvalidateRect,hTreeView,0,TRUE
.ENDIF
.ELSEIF eax>=IDM_DRVA
;¥H¤U³B²zºÏºÐ¾÷
sub eax,IDM_DRVA
mov ecx,dwDrv
.IF eax!=ecx
add ecx,IDM_DRVA
mov dwDrv,eax
INVOKE SetMenuItemInfo,hDrvMenu,ecx,FALSE,ADDR mii
mov mii.fState,MFS_CHECKED
INVOKE SetMenuItemInfo,hDrvMenu,wParam,FALSE,ADDR mii
INVOKE SendMessage,hTreeView,TVM_DELETEITEM,0,hTreeRootItem ;§R°£ì¥ý®Ú¶µ¥Ø
INVOKE GetFileAsItem,hTreeView,dwDrv ;´¡¤J·sªº®Ú¶µ¥Ø¤Î¨ä¤l¶µ¥Ø
mov hTreeRootItem,eax
INVOKE InvalidateRect,hTreeView,0,TRUE
.ENDIF
.ENDIF
.ENDIF
.ELSEIF uMsg==WM_MENUSELECT
mov eax,wParam
mov ecx,eax
shr eax,10h
and ecx,0ffffh
and eax,MF_POPUP
.IF ecx==1 ;ECX¡×¥D¿ï³æ¤ºªº²Ä1ӿﶵ¡A§Y¡uºÏºÐ¾÷¡v¼u¥X¿ï³æ
.IF eax==MF_POPUP ;Åã¥Ü¡uºÏºÐ¾÷¡v¼u¥X¿ï³æ
INVOKE GetLogicalDriveStrings,SIZEOF sLogDrvStr,ADDR sLogDrvStr
;§R°£ì¦³ªº¡uºÏºÐ¾÷¡v¼u¥X¿ï¶µ©Ò¥X²{ªº¤l¿ï³æ¤ºªº©Ò¦³¿ï¶µ¡A³o¬O¦]¬°¦³¥i¯à¨Ï¥ÎªÌ
;·s´¡¤J©Î©Þ¥XÀH¨ºÐ¡A¦Ó³y¦¨ÅÞ¿èºÏºÐ¾÷§ïÅÜ¡A©Ò¥H¥ý§R°£¦A«·sÀò±oÅÞ¿èºÏºÐ
.WHILE nLogDrv!=0
;¨C¦¸§R°£²Ä¹sÓ¶µ¥Ø®É¡A¤U¤@Ó¶µ¥Ø´NÅܦ¨²Ä¹sÓ¤F
INVOKE DeleteMenu,hDrvMenu,0,MF_BYPOSITION
dec nLogDrv
.ENDW
;§âÅÞ¿èºÏºÐ¾÷¦WºÙ¥[¤J¨ì¡uºÏºÐ¾÷¡v¼u¥X¿ï³æ¤º
push esi
mov mii.cbSize,SIZEOF mii
mov mii.fMask,MIIM_ID or MIIM_TYPE
lea esi,sLogDrvStr
mov mii.fType,MFT_STRING
.WHILE BYTE PTR [esi]!=0
movzx edx,BYTE PTR [esi]
sub edx,41h
mov mii.dwTypeData,esi
add edx,IDM_DRVA
mov mii.cch,4
mov mii.wID,edx ;A:¡BB:¡BC:¡K¡K¿ï¶µID¤À§O¬O6000¡B6001¡B6002¡B6003¡K¡K
INVOKE InsertMenuItem,hDrvMenu,edx,TRUE,ADDR mii
add esi,4
inc nLogDrv
.ENDW
mov mii.fMask,MIIM_STATE
mov ecx,dwDrv
mov mii.fState,MFS_CHECKED
add ecx,IDM_DRVA
INVOKE SetMenuItemInfo,hDrvMenu,ecx,FALSE,ADDR mii
pop esi
.ENDIF
.ENDIF
.ELSEIF uMsg==WM_INITDIALOG
;§â¹ï¸Ü²°²¾¦Ü¿Ã¹õ¤¤¥¡
INVOKE GetWindowRect,hDlg,ADDR rcDlgOrItm
mov edx,rcDlgOrItm.left
mov ecx,rcDlgOrItm.top
sub rcDlgOrItm.right,edx
sub rcDlgOrItm.bottom,ecx
INVOKE GetSystemMetrics,SM_CXSCREEN
sub eax,rcDlgOrItm.right
shr eax,1
push eax
INVOKE GetSystemMetrics,SM_CYSCREEN
sub eax,rcDlgOrItm.bottom
pop edx
shr eax,1
INVOKE MoveWindow,hDlg,edx,eax,rcDlgOrItm.right,rcDlgOrItm.bottom,TRUE
;¨ú±o¥D¿ï³æ¤Î¤l¿ï³æ¥N½X
INVOKE GetMenu,hDlg
mov hMainMenu,eax ;¥D¿ï³æ¥N½X
INVOKE GetSubMenu,eax,1
mov hDrvMenu,eax ;¡uºÏºÐ¾÷¡v¤l¿ï³æ¥N½X
INVOKE GetSubMenu,hMainMenu,2
mov hViewMenu,eax ;¡uÀ˵ø¡v¤l¿ï³æ¥N½X
INVOKE GetSubMenu,hViewMenu,0
mov hViewFontMenu,eax ;¡u¦r§Î¡v¤l¿ï³æ¥N½X
INVOKE GetSubMenu,hViewMenu,1
mov hViewBgMenu,eax ;¡uI´º¡v¤l¿ï³æ¥N½X
;³]©w¤º©wªº¦r§Î¤ÎÃC¦â
mov mii.cbSize,SIZEOF mii
mov mii.fMask,MIIM_STATE
mov mii.fState,MFS_CHECKED
INVOKE SetMenuItemInfo,hViewBgMenu,IDM_WHITE,FALSE,ADDR mii
INVOKE SetMenuItemInfo,hViewFontMenu,IDM_PMingLiU,FALSE,ADDR mii
INVOKE SetMenuItemInfo,hViewFontMenu,IDM_TWELVE,FALSE,ADDR mii
;³]©w¹Ï¥Ü
INVOKE LoadIcon,hInstance,OFFSET szIconName
INVOKE SendMessage,hDlg,WM_SETICON,ICON_SMALL,eax
;¨ú±o¾ðª¬À˵ø¥N½X
INVOKE GetDlgItem,hDlg,IDC_TREEVIEW
mov hTreeView,eax
;´¡¤JÅÞ¿èºÏºÐ¡uC:\¡v
INVOKE GetFileAsItem,eax,dwDrv
mov hTreeRootItem,eax
;¨ú±o¡uLady¡v¡B¡uExpand¡v¡B¡uCollapse¡v¦ì¤¸¹Ïªº¥N½X
INVOKE LoadBitmap,hInstance,OFFSET szLady
mov hbmpLady,eax
INVOKE LoadBitmap,hInstance,OFFSET szExpand
mov hbmpExpand,eax
INVOKE LoadBitmap,hInstance,OFFSET szCollapse
mov hbmpCollapse,eax
;¨ú±o¡uLady¡v¹Ïªº¼e«×»P°ª«×
INVOKE GetObject,hbmpLady,SIZEOF BITMAP,ADDR bm
mov ecx,bm.bmWidth
mov edx,bm.bmHeight
mov cxLady,ecx
mov cyLady,edx
INVOKE GetObject,hbmpExpand,SIZEOF BITMAP,ADDR bm
mov ecx,bm.bmWidth
mov edx,bm.bmHeight
mov cxExpand,ecx
mov cyExpand,edx
;«Ø¥ß¶À¡B¥Õ¦âµe¨ê
INVOKE CreateSolidBrush,0ffffh
mov hbrYellow,eax
INVOKE CreateSolidBrush,0ffffffh
mov hbrWhite,eax
;¨ú±o¾ðª¬À˵øªº¤u§@°Ï¤j¤p
INVOKE GetClientRect,hTreeView,OFFSET rcTreeView
;¨ú±o¾ðª¬À˵ø¶µ¥ØÁY±Æ¦h¤Ö¹Ï¯À
INVOKE SendMessage,hTreeView,TVM_GETINDENT,0,0
mov dwIndent,eax
.ELSEIF uMsg==WM_CLOSE
exit: INVOKE EndDialog,hDlg,NULL
;¨ä¥L°T®§
.ELSE
mov eax,FALSE
ret
.ENDIF
mov eax,TRUE
ret
DlgProc ENDP
;---------------------------------------------------------------------------------------------------
START: INVOKE GetModuleHandle,NULL
mov hInstance,eax
INVOKE DialogBoxParam,hInstance,OFFSET szDlgName,NULL,OFFSET DlgProc,NULL
INVOKE ExitProcess,eax
INVOKE InitCommonControls
;***************************************************************************************************
END START |
§â TVCD.ASM¡BTVCD.RC¡BTVCD.EXE.MANIFEST¡BADD.BMP¡BSUB.BMP¡BLADY.BMP¡BFOLDER2.ICO ¤CÓÀɮ׳£©ñ¦b¦P¤@¤l¥Ø¿ýùØ¡AµM«á«ö¤U±¤è¦¡²ÕĶ¡B³sµ²§Y¥i±o¨ì TVCD.EXE¡J
E:\HomePage\SOURCE\Win32\TVCD>rc tvcd.rc E:\HomePage\SOURCE\Win32\TVCD>ml tvcd.asm /link tvcd.res Microsoft (R) Macro Assembler Version 6.14.8444 Copyright (C) Microsoft Corp 1981-1997. All rights reserved. Assembling: tvcd.asm *********** ASCII build *********** Microsoft (R) Incremental Linker Version 5.12.8078 Copyright (C) Microsoft Corp 1992-1998. All rights reserved. /SUBSYSTEM:WINDOWS "tvcd.obj" "/OUT:tvcd.exe" "tvcd.res" E:\HomePage\SOURCE\Win32\TVCD>
»¡¤F³o»ò¦h¡A©³¤U¨Ó¬Ý¬Ý TVCD ªºµøµ¡¨ç¦¡¦p¦ó³B²z NM_CUSTOMDRAW ³qª¾½X¡C¤p¤ì°¸¥Î¤TÓÅÜ¼Æ dwBk¡BdwFont¡BdwFontSize ¤À§Oªí¥ÜI´º¡B¦r§Î¡B¦rÅé¤j¤p¡A¦p¤U¡J
72 73 74 |
dwBk DWORD 0 ;¾ðª¬À˵øªºI´º¡G0¡Ð¥Õ¦â¡F1¡Ð¬õ¶Àº¥¶i¡F2¡Ð¶À¥Õ¥æ¿ù¡F3¡Ð¬ü¤k¹Ï
dwFont DWORD 0 ;¦r§Î¡G0¡Ð·s²Ó©úÅé¡F1¡Ð·L³n¥¿¶ÂÅé¡F2¡Ð"Courier New"¡F3¡Ð"Times New Roman"
dwFontSize DWORD 1 ;¦rÅé¤j¤p¡G0¡Ð10ÂI¡F1¡Ð12ÂI¡F2¡Ð14ÂI |
©³¤Uªºµ{¦¡¤ù¬q¬O WM_NOTIFY °T®§ªº³B²z¹Lµ{¡A¦ý¥u¦C¥X¤jPµ²ºc¡C©³¤U²Ä 6 ¦æ¡A§PÂ_ WM_NOTIFY ¬O§_¬°¾ðª¬À˵ø¡AhTreeView¡A©Òµo¥Xªº¡A¦pªG¬O«h°õ¦æ²Ä 6 ¦æ¨ì 34 ¦æ¤ºªºµ{¦¡¡C²Ä¤C¦æ«h§PÂ_³qª¾½X¬O§_¬° NM_CUSTOMDRAW¡A¦pªG¬O¡A«h°õ¦æ²Ä 7 ¦æ¨ì²Ä 33 ¦æªºµ{¦¡¡C±µ¤U¨Ó«K¬O«ÂI¤F¡A²Ä 9¡B18¡B30 ¦æ¡A¨Ì·Óø»s¶¥¬q¡A¤À¤ä°õ¦æ¦U¬ÛÃöµ{¦¡¡C
258 259 260
261 262 263 264
265 266 267 268
269 270 271 272¡ã276
277 278 279 280
281 282 283 284¡ã327
328 329 330¡ã345 346
347 348 349 350¡ã359
360 361 362 363
364 |
.IF uMsg==WM_NOTIFY
ASSUME ebx:PTR NM_TREEVIEW
push ebx
mov ebx,lParam
mov eax,[ebx].hdr.hwndFrom ;EAX¡×µo¥XWM_NOTIFYªº±±¨î¶µ¥N½X
.IF eax==hTreeView
.IF [ebx].hdr.code==NM_CUSTOMDRAW
ASSUME ebx:PTR NMTVCUSTOMDRAW
.IF [ebx].nmcd.dwDrawStage==CDDS_PREPAINT
.IF dwBk==1
;¦¹³Bµe¥X¾ðª¬À˵øI´º¬°¶À¦âº¥¶iÅܬ°¬õ¦â
.ELSEIF dwBk==2
;¦¹³Bµe¥X¾ðª¬À˵øI´º¬°¶À¡B¥Õ¥æ¿ù
.ELSEIF dwBk==3
;¦¹³Bµe¥X¾ðª¬À˵øI´º¬°¬ü¤k¹Ï
.ENDIF
INVOKE SetWindowLong,hDlg,DWL_MSGRESULT,CDRF_NOTIFYITEMDRAW OR CDRF_NOTIFYPOSTPAINT
.ELSEIF [ebx].nmcd.dwDrawStage==CDDS_ITEMPREPAINT
call set_font ;;¨Ì¾ÚdwFont¡BdwFontSize³]©w¤å¦r¦r§Î»P¦rÅé¤j¤p
.IF dwBk==0 ;I´º¬°¥Õ¦â
mov edx,CDRF_DODEFAULT
.ELSEIF (dwBk==1)||(dwBk==3);I´º¬°¬ü¤k¹Ï©Î¬õ¶Àº¥¶i¦â
;¦¹³Bµe¥X¶µ¥Ø¡A¥]§t¶µ¥Ø¦WºÙ¡B½u¡Kµ¥µ¥
mov edx,CDRF_SKIPDEFAULT
.ELSEIF dwBk==2 ;I´º¬°¶À¥Õ¥æ¿ù
;¦¹³Bµe¥X¶µ¥Ø¡A¥]§t¶µ¥Ø¦WºÙ¡Kµ¥µ¥
@@: mov edx,CDRF_NOTIFYITEMDRAW
.ENDIF
INVOKE SetWindowLong,hDlg,DWL_MSGRESULT,edx
.ELSEIF [ebx].nmcd.dwDrawStage==CDDS_POSTPAINT
;¦¹³Bø»sµ²§ô¡A»Ý³B²z±²°Ê®É¯d¤U´Ý¼vªº°ÝÃD
.ENDIF
.ENDIF
.ENDIF
ASSUME ebx:NOTHING
pop ebx
|
©³¤U»¡©ú¦p¦ó³B²z NM_CUSTOMDRAW ªº¦UÓø»s¶¥¬q ( ¨ä¹ê¥u¦³¤TÓ )¡A±z¥i¥H¤ñ·Ó¤W±ªºµ{¦¡¤ù¬q¥[¥H¹ï·Ó¡C
¦pªG¬O¦b CDDS_PREPAINT ø»s¶¥¬q¡An°µªº¨Æ¬O¥ý¨Ì·Ó dwBk ¤ºªº¼ÆÈ¡Aµe¥XI´º¡A³oÓI´º¬O«ü¾ðª¬À˵øªºI´º¡C³Ì«á¦b²Ä 278 ¦æªð¦^ CDRF_NOTIFYITEMDRAW OR CDRF_NOTIFYPOSTPAINT¡A«ü¥Ü¾ðª¬À˵ø¦bø»s¨CÓ¶µ¥Ø¤§«e¡A¤]´N¬O CDDS_ITEMPREPAINT ¶¥¬q¡A¥²¶·µo°e NM_CUSTOMDRAW ³qª¾½Xµ¹¤÷µøµ¡¡F°£¦¹¤§¥~¡A¦bø»s§¹¦¨©Ò¦³¾ðª¬À˵ø¤§«á¡A¤]´N¬O CDDS_POSTPAINT ¶¥¬q¡A¤]nµo°e NM_CUSTOMDRAW ³qª¾½Xµ¹¤÷µøµ¡¡C
¦]¬°¦b CDDS_PREPAINT ø»s¶¥¬qªð¦^È¥]§t¤F CDRF_NOTIFYITEMDRAW¡A¦]¦¹¤÷µøµ¡ªºµøµ¡¨ç¦¡¤~¯à±µ¦¬¨ìø»s¶¥¬q¬° CDDS_ITEMPREPAINT ªº NM_CUSTOMDRAW ³qª¾½X¡C¦b³B²z CDDS_ITEMPREPAINT ®É¡A¤p¤ì°¸§â¦r§Î»PI´º¤À¶}¨Ó³B²z¡A¥ý³B²z¦r§Î¡C³B²z¦r§Îªºµ{¦¡¦b²Ä 280 ¦æ¡A©I¥s set_font °Æµ{¦¡¡A³oӰƵ{¦¡¨Ì¾Ú dwFont¡BdwFontSize «Ø¥ßÅÞ¿è¦r§Î¡AµM«á¿ï¤J [ebx].nmcd.hdc ùØ¡A´Nºâ§¹¦¨¤F¡C³B²zI´ºªº¤è¦¡¬O¨Ì¾Ú dwBk ¨M©w¡Aȱo¤@´£ªº¬O¡A¦¹³BªºI´º¨ä¹ê¬O«ü¶µ¥Ø¦WºÙ¤å¦rªºµô°Å¯x§Î¤º¡A¦©°£¤å¦r¥»¨¥H¥~ªº½d³ò¡A¥ç§Y¤å¦rI´º¤£¬O¾ðª¬À˵øªºI´º¡C¦pªG¬O¥Õ¦âI´º¡A¨Æ¹ê¤W´N¬O¾ðª¬À˵øªº¤º©wÈ¡A¦]¦¹¤£¶·³B²z¡Aª½±µ¥æµ¹¨t²Î¥hø»s¡A¬Gªð¦^ CDRF_DODEFAULT¡A¨£²Ä 282 ¦æ¡C
¦pªG dwBk ¬O 1 ©Î 3¡Aªí¥ÜI´º¬O¬õ¦âº¥¶i¬°¶À¦â¤Î¬ü¤k¹Ï¡A³o¨âºØ±¡§Î¡A³Ì¦n¯à¨Ï¶µ¥Ø¦WºÙªº¤å¦rI´º¬O³z©úªº¡A³o¼Ë¸û¬°¦n¬Ý¡A¹³¥kÃ䪺¹Ï¤ù´N¬O¤£³z©úªº±¡§Î¡C¦pªGn¨Ï¤å¦rI´º³z©ú¡A«K¤£¯à¥æ¥Ñ¨t²Îø»s¡A¥²¶·¥þ³¡¥Ñµ{¦¡¦Û¦æø»s¡A¥]¬A¶µ¥Ø¦WºÙ¡B®Ú¶µ¥Ø«eªº®i¶}«ö¶s ( ©Î )¡B¶µ¥Ø«eªº³s±µµê½u¡B³Q¿ï©wªº¶µ¥ØI´º¡C©Ò¥Hªð¦^ CDRF_SKIPDEFAULT¡A¨£²Ä 328 ¦æ¡C¦pªG dwBk ¬° 2¡Aªí¥ÜI´º¬O¶À¥Õ¦â¤¬¬Û¥æ¿ù¡A¥»¨Ó¤]¥i¥H¤ñ·Ó¬ü¤k¹Ï©Î¬õ¦âº¥¶i¬°¶À¦âªº³B²z¤è¦¡¡A¦ý¬O¬°¤F¥Ü½d¥t¤@ºØªð¦^È¡A¦P®É¬°¤F¤è«K¡A©Ò¥H¥t¥~¿W¥ß¥X¨Ó¡C³oùةҿתº¡u¤è«K¡v¬O«üªð¦^ CDRF_NOTIFYITEMDRAW ¥i¥HÅý¨t²Îø»s¶µ¥Ø¦WºÙ¡B®Ú¶µ¥Ø«eªº®i¶}«ö¶s ( ©Î )¡B¶µ¥Ø«eªº³s±µµê½u¡C¦Óµ{¦¡n°µªº¨Æ¡A¶È¶È¬O¦b NMTVCUSTOMDRAW µ²ºcÅ骺 clrText¡BclrTextBk ¶ñ¤J¾A·íªºÃC¦â´N¥i¥H¤F¡C
¦pªG¬O¦b CDDS_POSTPAINT ¶¥¬q¡A»Ýn³B²zªº¬O±²°Ê©Ò±a¨Ó´Ý¼vªº°ÝÃD¡A³o¬qµ{¦¡½X¦b 350¡ã359 ¦æ¡C¬°¤Fn¯à³B²z CDDS_POSTPAINT¡A¥²¶·¦b CDDS_PREPAINT ø»s¶¥¬qªð¦^È¥]§t¤F CDRF_NOTIFYPOSTPAINT¡C
¦b CDDS_PREPAINT ø»s¶¥¬qnµe¥X¶À¦âº¥¶iÅܬ°¬õ¦âªºI´º¡A¬O°õ¦æ²Ä 268 ¦æªº¡ucall gradient¡v¡Agradient °Æµ{¦¡¦b²Ä 85¡ã106 ¦æ¡Aµ{¦¡½X¦p¤U¡C¨ä¤¤¦Ç¦âªº³¡¥÷¬O²£¥Í¬Û®eªº³]³Æ¤º®e¡A¥ý¦b¦¹³]³Æ¤º®eùصe¥X¹Ï§Î¡A¦A±N¥¦«þ¨©¨ìì¨Óªº³]³Æ¤º®eùØ¡A¥H¨¾¤î°{°Ê¡A¦ý¦ü¥G¦¨®Ä¤£¹ü¡A©Ò¥H¶È¶È¦C¥X¨Ã¨S¦³²ÕĶ¦¨µ{¦¡½X¡C°£¥h³o¨Ç¨¾¤î°{°Êªºµ{¦¡½X¤§«á¡A·í¥iµo²{¡Agradient °Æµ{¦¡ªº®Ö¤ß¬O GradientFill API¡C
;¦b¾ðª¬À˵øªºI´º¤¤¡Aµe¥X¥Ñ¬õº¥¶iÅܶÀ¦âªºI´º¹Ï gradient PROC ASSUME ebx:PTR NMTVCUSTOMDRAW ;LOCAL hdcMem:HDC,hbmMem:HBITMAP ;INVOKE CreateCompatibleDC,[ebx].nmcd.hdc ;mov hdcMem,eax ;INVOKE CreateCompatibleBitmap,[ebx].nmcd.hdc,[ebx].nmcd.rc.right,[ebx].nmcd.rc.bottom ;mov hbmMem,eax ;INVOKE SelectObject,hdcMem,eax mov edx,SIZEOF TRIVERTEX mov eax,[ebx].nmcd.rc.right mov ecx,[ebx].nmcd.rc.bottom mov ary_tvt[edx].x,eax mov ary_tvt[edx].y,ecx INVOKE GradientFill,[ebx].nmcd.hdc,OFFSET ary_tvt,2,OFFSET grect,1,GRADIENT_FILL_RECT_H ;INVOKE BitBlt,[ebx].nmcd.hdc,0,0,[ebx].nmcd.rc.right,[ebx].nmcd.rc.bottom,hdcMem,0,0,SRCCOPY ;INVOKE DeleteDC,hdcMem ;INVOKE DeleteObject,hbmMem ASSUME ebx:NOTHING ret gradient ENDP
GradientFill API ¬O¥Îº¥ÅÜÃC¦â¥hµeº¡¯x§Î°Ï°ì©ÎªÌ¤T¨¤§Î°Ï°ì¡C¦]¬° GradientFill ¦b MSIMG32.DLL ¤º³¡¡A¦]¦¹n©I¥s³oÓ API¡A¥²¶·¥]§t MSIMG32.INC »P MSIMG32.LIB¡C¥¦ªºì«¬¬O¡G
BOOL GradientFill( HDC hdc, // handle to DC PTRIVERTEX pVertex, // array of vertices ULONG dwNumVertex, // number of vertices PVOID pMesh, // array of gradients ULONG dwNumMesh, // size of gradient array ULONG dwMode // gradient fill mode );
RadientFill ¥i¥H¦P®Éµeº¡¼ÆÓ¯x§Î©Î¼ÆÓ¤T¨¤§Î¡A¨Ì¾Ú pVertex¡BdwNumVertex¡BpMesh¡BdwNumMesh ¨Ó¨M©w¡A¦Ó©Òµeªº¬O¯x§ÎÁÙ¬O¤T¨¤§Î¡A¥Ñ dwMode ¨M©w¡C©³¤U¬O RadientFill °Ñ¼Æªº»¡©ú¡G
TRIVERTEX STRUCT x DD ? y DD ? Red DW ? Green DW ? Blue DW ? Alpha DW ? TRIVERTEX ENDS«Ü©úÅ㪺¡A¨C¤@Ó TRIVERTEX µ²ºcÅé¥NªíµÛ¤@ÓÂI¡Ax¡By ¤À§O¬O¨ä¾î®y¼Ð»PÁa®y¼Ð¡ARed¡BGreen¡BBlue ¤À§O¥Nªí¤Tì¦â¡AAlpha ¬O³z©ú«×¡C GradientFill ©Òµe¥X¨ÓªºÃC¦âº¥¶i§ïÅܪº¯x§Î¡A¥u¯à¬O¥¿¥ßÂ\©ñªº¡A¥ç§Y¦³¨âÓ¹ïÃä¬O¤ô¥¡A¥t¨âÓ¹ïÃä¬O¹]««ªº¡A©Ò¥H¥u»Ýn¨âÓ TRIVERTEX¡A¤À§O¥Nªí¯x§Î¥ª¤W¨¤¤Î¥k¤U¨¤ªº®y¼Ð¡A³o¨âÓ TRIVERTEX µ²ºcÅé´N²Õ¦¨§t¦³¨âÓ¤¸¯Àªº°}¦C¡F¦pªGnµe¥X¤@Ó¤T¨¤§Î¡A´N»Ýn¤TÓ TRIVERTEX¡A¤À§O¥Nªí¤TÓ³»ÂI¡A³o¤TÓ TRIVERTEX ´N²Õ¦¨§t¦³¤TÓ¤¸¯Àªº°}¦C¡C
GRADIENT_RECT STRUCT UpperLeft DD ? LowerRight DD ? GRADIENT_RECT ENDS |
GRADIENT_TRIANGLE STRUCT Vertex1 DD ? Vertex2 DD ? Vertex3 DD ? GRADIENT_TRIANGLE ENDS |
¶ñ¥R¤è¦¡ | ¼ÆÈ | »¡¡@¡@©ú |
GRADIENT_FILL_RECT_H | 0 | ¥Ñ¥ªÃ䪺ÃC¦âº¥¶iÅܬ°¥kÃ䪺ÃC¦â |
GRADIENT_FILL_RECT_V | 1 | ¥Ñ¤W±ªºÃC¦âº¥¶iÅܬ°¤U±ªºÃC¦â |
GRADIENT_FILL_TRIANGLE | 2 | ¶ñ¥R¤T¨¤§Î |
Á¿¤F³o»ò¦h GradientFill ªº¥Îªk¡A¤£¬Ý¤@¨Ç¨Ò¤l¡A¬OµLªk¤F¸Ñªº¡C³oÓ¨Ò¤l³Ì«nªº´N¬O pVertex ©Ò«üªº TRIVERTEX °}¦C¦p¦ó»P pMesh ©Ò«ü°}¦C¬Û°t¦X¡C©³¤Uªºµ{¦¡½X©Ò°µ¥X¨Óªº®ÄªG¦p¥k¹Ï©Ò¥Ü ( ¹Ï¤¤ªº¶ÂÂI»P®y¼Ð¬O¤p¤ì°¸¥[¤Wªºµù¸Ñ )¡J
ary_tvt TRIVERTEX <0,0,0ffffh,0,0,0>,<0,50,0ffffh,0ffffh,0,0>,<50,50,0ff00h,0ff00h,0,0> TRIVERTEX <100,100,0,0,0ffffh,0>,<0,100,0,0ffffh,0,0>,<50,100,0ffffh,0,0ffffh,0> ary_gt GRADIENT_TRIANGLE <0,1,2>,<1,4,5> INVOKE GradientFill,hDC,OFFSET ary_tvt,6,OFFSET ary_gt,2,GRADIENT_FILL_TRIANGLE
³oÓ¨Ò¤lùØ¡A¤p¤ì°¸µe¥X¨âÓ¤T¨¤§Î¡A©Ò¥H dwNumMesh ¬° 2¡A¦]¬°¨âÓ¤T¨¤§Î¦³ 6 Ó³»ÂI¡A©Ò¥H dwNumVertex ¬° 6¡C¤S¦]¬°¬Oµe¤T¨¤§Î¡A©Ò¥H dwMode ¬° GRADIENT_FILL_TRIANGLE¡A·í¨t²Î¦¬¨ì GRADIENT_FILL_TRIANGLE «á¡A´N·|§â pMesh ·í¦¨¬O GRADIENT_TRIANGLE µ²ºcÅé©Ò²Õ¦¨ªº°}¦C¡C¤@Ó¤T¨¤§Î¥Ñþ¨Ç³»ÂI²Õ¦¨¡A¥Ñ pMesh ©Ò«üªº GRADIENT_TRIANGLE µ²ºcÅé°}¦C«ü©w¡C²Ä¤@Ó GRADIENT_TRIANGLE ¬° <0,1,2>¡Aªí¥Ü¦b pVertex ©Ò«üªºµ²ºcÅé°}¦C¤¤ªº²Ä 0¡B1¡B2 Óµ²ºcÅéºc¦¨¦¹¤T¨¤§Î¤TÓ³»ÂI¡F²Ä¤GÓ GRADIENT_TRIANGLE ¬° <1,4,5>¡Aªí¥Ü¦b pVertex ©Ò«üªºµ²ºcÅé°}¦C¤¤ªº²Ä 1¡B4¡B5 Óµ²ºcÅé§Î¦¨²Ä¤GÓ¤T¨¤§Î¡C
¦b CDDS_PREPAINT ø»s¶¥¬qnµe¥X¶À¡B¥Õ¦â¥æ¿ùªº¯x§Î§@¬°I´º¡A¦¹³BªºI´º¬O«ü¾ðª¬À˵ø¤¤¡A¤u§@°ÏªºI´º¡Cµe¥X¶À¥Õ¥æ¿ùªº¤èªk¬O§â¨CÓ¶µ¥Ø©Ò¦b¤§³B¡A¬Ý¦¨¬O¤@Ó¤@Óªºªø±øª¬¯x§Î¡A¥Ñ¾ðª¬À˵ø¤u§@°Ïªº³Ì¥ªÃ䩵¦ù¨ì³Ì¥kÃä¡A¨Ã¥B¨Ï¨CÓ¯x§Î¬Û¶¡¶îº¡¶À¦â©Î¥Õ¦â¡C¹ê»Úªºµ{¦¡½X¬O°õ¦æ²Ä 270 ¦æªº¡ucall interlock¡v¡Ainterlock °Æµ{¦¡¦b²Ä 160¡ã192 ¦æ¡Aµ{¦¡½X¦p¤U¡G
160 161 162
163 164 165 166
167 168 169 170
171 172 173 174
175 176 177 178
179 180 181 182
183 184 185 186
187 188 189 190
191 192 |
;I´º¥Ñ¥Õ¦â»P¶À¦â¥æ¿ù¦Ó¦¨
interlock PROC
LOCAL rcExtItem:RECT
LOCAL dwItemHight,nItem,n:DWORD
INVOKE SendMessage,hTreeView,TVM_GETITEMHEIGHT,0,0
mov ecx,eax
sub edx,edx
mov eax,rcTreeView.bottom
div ecx
mov dwItemHight,ecx
mov nItem,eax
mov n,0
mov edx,rcTreeView.right
mov rcExtItem.left,0
mov rcExtItem.right,edx
mov rcExtItem.top,0
mov rcExtItem.bottom,ecx
.WHILE nItem>0
mov ecx,hbrWhite
test n,1
jz @f
mov ecx,hbrYellow
ASSUME ebx:PTR NMTVCUSTOMDRAW
@@: INVOKE FillRect,[ebx].nmcd.hdc,ADDR rcExtItem,ecx
ASSUME ebx:NOTHING
mov ecx,dwItemHight
add rcExtItem.bottom,ecx
add rcExtItem.top,ecx
inc n
dec nItem
.ENDW
ret
interlock ENDP |
²Ä 164 ¦æ¨ú±o¨CÓ¶µ¥Øªº°ª«× ( ¦³´XÓÂI¡Apixel )¡A¦s©ó ECX ùØ¡AµM«á§â¾ðª¬À˵øªº°ª«×°£¥H ECX¡A´N¥i¥H±o¨ì¾ðª¬À˵ø¤¤¥i¥H¬Ý¨ì´XÓ¶µ¥Ø¡A§â¥¦¦s©ó nItem ( ²Ä 170 ¦æ )¡C²Ä 171 ¦æ¡A§â°Ï°ìÅܼơAn¡A³]¬° 0¡A³oÓÅܼƱN¦b©³¤U²Ä 177¡ã190 ¦æ°j°é¤¤¡A¥Ñ¹s»¼¼W¡Cµ{¦¡¦b²Ä 179 ¦æÀˬd n ¤§¼ÆÈ¡AY¬°°¸¼Æ¡A«h¨Ï¯x§Îµeº¡¥Õ¦â¡A¥ç§Y¨Ï¥Î¥Õ¦âµe¨ê¡F¤Ï¤§«h¨Ï¥Î¶À¦âµe¨ê¡C§â¯x§Î¶î¤WÃC¦âªº¤èªk¬O©I¥s FillRect¡A¦pªG±z¥J²ÓÆ[¹î¡AÀ³·í¥i¥Hµo²{¡A¨CÓ¯x§Î¥ª¤W¨¤¤Î¥k¤U¨¤ªº¾î®y¼Ð¨Ã¤£·|§ïÅÜ¡A¥u¦³Áa®y¼Ð·|¤ñ¤WÓ¯x§Î¦h¤F¶µ¥Øªº°ª«×¡A²Ä 185¡ã187 ¦æªºµ{¦¡½X´N¬O¹ê²{³]©w¤U¤@Ó¯x§Îªº½d³ò¡C¦Ü©ó¾î®y¼Ð»PÁa®y¼Ðªºªì©lÈ¡A¦b²Ä 172¡ã176 ¦æ³]©w¡A¤§«á¡A¾î®y¼Ð¤§È¤£§ïÅÜ¡C
¦b CDDS_PREPAINT ø»s¶¥¬qnµe¥X¬ü¤k¹ÏI´º¡Aµ{¦¡½X¦b²Ä 271¡ã276 ¦æ¡C³o¬qµ{¦¡½XÀ³¸Ó¬O«Ü²³æªº¡Aì²z¦b²Ä 13 ³¹¡A½Ð¦Û¦æ°Ñ¦Ò¡C³o±i¬ü¤k¹Ï¡A¤w¦s¦b¸ê·½ÀÉùØ¡A¥Dnªº¨BÆJ¬Oº¥ý¦b°O¾ÐÅ餤¥Î CreateCompatibleDC ¥t¥~¦A«Ø¥ß»P¾ðª¬À˵øªº³]³Æ¤º®e¤@¼Ò¤@¼Ëªº³]³Æ¤º®e¡A±µµÛ§â¬ü¤k¹Ï¿ï¤J°O¾ÐÅ餺ªº³]³Æ¤º®e¡A³Ì«á¦A¸g¥Ñ BitBlt ½Æ»s¨ì¾ðª¬À˵øªº³]³Æ¤º®e¡C
271 272 273
274 275 276 |
.ELSEIF dwBk==3 ;I´º¬°¬ü¤k¹Ï
INVOKE CreateCompatibleDC,[ebx].nmcd.hdc
mov hdcMem,eax
INVOKE SelectObject,hdcMem,hbmpLady ;¿ï©w¨Ó·½³]³Æ¤º®eªº¦ì¤¸¹Ï
INVOKE BitBlt,[ebx].nmcd.hdc,0,0,cxLady,cyLady,hdcMem,0,0,SRCCOPY ;¶Ç°e¦ì¤¸¹Ï¨ìµøµ¡ªº³]³Æ¤º®e
INVOKE DeleteDC,hdcMem |
¦pªGI´º¬°¶À¦âº¥Åܬ°¬õ¦â©Î¬ü¤k¹Ï¡A¦b³B²z CDDS_ITEMPREPAINT ®É¡A¦]¬°n¨Ï±o¶µ¥Ø¦WºÙªº¤å¦rI´º¬°³z©úªº¡A¤~¯àÅã²{I´º¹Ï®×¡Cn¹F¨ì³oӮĪG¡Aµ{¦¡´N±o¶i¦æ¥þ³¡¨Æ±¡ªºÃ¸»s¡A¥]§t¶µ¥Ø¦WºÙ¡B®Ú¶µ¥Ø«eªº®i¶}«ö¶s ( ©Î )¡B¶µ¥Ø«eªº³s±µµê½u¡B³Q¿ï©wªº¶µ¥ØI´º¡C³Ì«áªð¦^®É¡Aªð¦^Ȭ° CDRF_SKIPDEFAULT¡C³o¬q¹Lµ{©Ò¦³ªºµ{¦¡½X¦b²Ä 283¡ã328 ¦æ¡C©Ò¥H³oºØ±¡§Îªºªð¦^Ȭ° CDRF_SKIPDEFAULT¡C©³¤U¤@¬q¤@¬q¸Ñ»¡¡Cµ{¦¡²Ä 284 ¦æ¬O¥ý³]©w¤å¦rI´º¬°³z©úªº¡A¤èªk¬O©I¥s SetBkMode API¡CSetBkMode API ¬O¥Î¨Ó³]©w¤å¦rªºI´º¡B«D PS_SOLID µeµ§¡B¬Y¨Çµe¨ê¤¤I´ºªº¼Ò¦¡¡C¬Y¨Çµeµ§ ( ¨Ò¦pµê½uµeµ§ ) ©Îµe¨ê ( ±×½u¹Ï®× ) ¬O¥i¥H¦³I´ºªº¡A¤å¦r¤]¬O¦³I´ºªº¡ASetBkMode ¥i¥HÅã³o¨ÇI´º ( §Y¤£³z©ú )©Î¬O¤£Åã¥Ü ( §Y³z©ú )¡CSetBkMode 쫬¬°¡G
int SetBkMode( HDC hdc, // handle of device context int iBkMode // flag specifying background mode );
iBkMode ¥i¥H¦³¨âºØ¿ï¾Ü¡A¤@¬O OPAQUE ¬°¤£³z©úªº¡A¥ç§YÅã¥Ü¤å¦r¡B«D PS_SOLID µeµ§¡B¬Y¨Çµe¨ê¤¤I´ºÃC¦â¡A³o¼Ë´N¬Ý¤£¨£¾ðª¬À˵øªºI´º¹Ï®×¤F¡C²Ä¤G¬O TRANSPARENT¡A¤£Åã¥Ü¤å¦r¡B«D PS_SOLID µeµ§¡B¬Y¨Çµe¨ê¤¤I´ºÃC¦â¡A³o¼Ë¯à¬Ý¨£¾ðª¬À˵øªºI´º¹Ï®×¤F¡C
µ{¦¡²Ä 385¡ã292 ¦æ¥Dn¬O©I¥s SendMessage¡A§â TVM_GETITEM ¶Çµ¹¾ðª¬À˵ø¡A¥HÀò±o¶µ¥Øªº¸ê®Æ¡A¥]§t¶µ¥Ø¦WºÙ¡Bª¬ºA¡B¬O§_¦³¤l¶µ¥Ø¡Aµy«á§Y±Nn¥Î¨ì³o¨Ç¸ê®Æ¡C²Ä 293¡ã295 ¦æ¡AÀˬd¬O§_¬°®Ú¶µ¥Ø¡A¦pªG¤£¬O¤~nµe¥X¶µ¥Ø«eªºµê½u¡Cµe¥X¶µ¥Ø«eªºµê½uªº°Æµ{¦¡¬° draw_line¡A¦bµ{¦¡²Ä 211¡ã249 ¦æ¡A¨Ã¤£·|¤ÓÃø¡A¤p¤ì°¸¤£¸Ñ»¡¡C¤£ºÞ¬O§_¬°®Ú¶µ¥Ø¡A³£·|°õ¦æ¨ì²Ä 296 ¦æªº¡uprint_icon:¡v¡A±q²Ä 296 ¦æ¨ì²Ä 307 ¦æ¡A§PÂ_¬O§_¦³¤l¶µ¥Ø¡A¦pªG¨S¦³¤l¶µ¥Ø«hª½±µ¸õ¨ì²Ä 308 ¦æ¡F¦pªG¦³¤l¶µ¥Ø¡A«h¥²¶·§PÂ_nµe¥X ÁÙ¬O ¹Ï®×¡A³o¨â±i BITMAP ¹Ï®×³£¤w¦s¦b¸ê·½ÀÉùؤF¡A©Ò¥H¨ä¨BÆJ»Pµe¥X¬ü¤k¹ÏI´º¬O¤@¼Ëªº¡C¦Ü©óµe¥Xþ¤@Ó¡A«hµø¸Ó¶µ¥Øªºª¬ºA¬O§_¬°®i¶}¨Ó¨M©w ( ²Ä 301¡ã302 ¦æ )¡Cµe¥X¹Ï®×ªºµ{¦¡½X¦b²Ä 304¡ã306 ¦æ¡C
±µ¤U¨Óªº²Ä 308¡ã318 ¦æ«h¬Oµe¥X¶µ¥Ø¦WºÙ¡A¤èªk¬O©I¥s DrawText¡C¶µ¥Ø¦WºÙ©Ò¦bªº°Åµô¯x§Î¦b NMCUSTOMDRAW ªº rc Äæ¦ìùؤw¦³¤F¤jPªº¦ì¸m¡A¦ý¬On¦Ò¼{¨ì¤l¶µ¥ØªºÁY±Æ¡A¥²¶·½Õ¾ã¥ª¤W¨¤ªº¾î®y¼Ð¡CÁ`¦@ÁY±Æ´XÂI ( pixel ) »P¶µ¥Ø¦b²Ä´X¼h¦³Ãö¡A¦b NMTVCUSTOMDRAW µ²ºcÅ骺 iLevel Äæ¦ìùØ°O¸üµÛ¶µ¥Ø©Ò¦b¼h¼Æ¡A§â¥¦¼¥H¨CÓ¶µ¥ØÁY±ÆÂI¼Æ´N¥i¥HÀò±oÁ`¦@nÁY±Æ´XÂI¡C¦ý¬O¦Ò¼{¨ì®Ú¶µ¥Ø¬O²Ä¹s¼h¡A©Ò¥H¥ý§â iLevel ¥[¤@¡A¦A¼¥H¨CÓ¶µ¥ØÁY±ÆÂI¼Æ¡C¨CÓ¶µ¥ØÁY±ÆªºÂI¼Æ¦b²Ä 540¡ã541 ¦æÀò±o¡C±o¨ìÁ`¦@ÁY±Æ´XÂI«á¡A¥[¤Wì¥ý¦b NMCUSTOMDRAW ªº rc ùتº¥ª¤W¨¤ªº¾î®y¼Ð´N¬O°Åµô¯x§Îªº¥ª¤W¨¤¾î®y¼Ð¡A¥ª¤W¨¤ªºÁa®y¼Ð¥Ñ NMTVCUSTOMDRAW µ²ºcÅ骺 rc.top ¨ú±o¡AµM«á³]©w DT_CALCRECT¡A©I¥s DrawText¡A¥i¥Hpºâ¥X°Åµô¯x§Î¡C²Ä 319¡ã322 ¦æ¬O¥Î¨Ó§PÂ_¸Ó¶µ¥Ø¬O§_³Q¿ï¤¤¡A¦pªG¤£¬Oª½±µ©I¥s DrawText ¦L¥X¶µ¥Ø¦WºÙ¡F¦pªG³Q¿ï¤¤¡A«h¥ý§â°Åµô¯x§Î¶î¤W°ª«G«×ªºI´º¦â¡AµM«á¦A¦L¥X¶µ¥Ø¦WºÙ¡C
³Ì«áªð¦^®É¡Aªð¦^ CDRF_SKIPDEFAULT¡A³o¬O¦]¬°I´º¬°¶À¦âº¥Åܬ°¬õ¦â©Î¬ü¤k¹Ï¡Aµ{¦¡¥²¶·µe¥X©Ò¦³ªºµe±¡C
·íI´º¬°¶À¥Õ¦â¥æ¿ù®É¡A¥u»Ýn¦b NMTVCUSTOMDRAW µ²ºcÅ骺 clrText¡BclrTextBk ¨âÓÄæ¦ì¤¤¶ñ¤J¾A·íªºÃC¦âÈ¡A¨t²Î´N¯àÀ°§Ú̶¶µ¥Ø¦WºÙ¤å¦rªº°Åµô¯x§Î¡A¥H¤Î¤å¦rÃC¦â¡C¦@¤À¨âºØ±¡§Î¡G
¦pªG¾ðª¬À˵ø±²°Ê®É¡A¥]§t¨Ï¥ÎªÌÂà°Ê·Æ¹«¤Wªººu½ü¡B¨Ï¥ÎªÌ²¾°Ê±²¶b¡Kµ¥µ¥¡A³£·|³y¦¨I´º¹Ï®×ÅܽաA³o¬O±²°Ê®É©Ò³y¦¨ªº´Ý¼v¡C¸Ñ¨M³oÓ°ÝÃDªº¤èªk«Ü²³æ¡A¥un©I¥s InvalidateRect¡A«·sµe¤@¹M§Y¥i¡C¤£¹L¾ðª¬À˵ø±²°Ê®É¡A¤£·|²£¥Í³qª¾½X¡A¨º»ò¦p¦ó±oª¾±²°Ê¨Æ¥ó©O¡H³oÓ°ÝÃD§xÂZ¤p¤ì°¸«Ü¤[¡AÁÙ¦n³Ì«á¸Ñ¨M¤F¡C¤p¤ì°¸¨Ï¥Îªº¤èªk¬O©I¥s GetScrollPos¡AÀˬd±²¶b¾ÞÁa±ìªº¦ì¸m¡A¦pªG»P¤§«e¤£¦P¡Aªí¥Üµo¥Í±²°Ê¨Æ¥ó¡A³o®É´N©I¥s InvalidateRect «·sµe¥X¾ðª¬À˵ø¡CÀˬd±²¶bªº¾ÞÁa±ì¡A¥²¶·¤ô¥±²¶b»P¹]««±²¶b¦UÀˬd¤@¦¸¡C¨£²Ä 349¡ã360 ¦æ¡C
349 350 351
352 353 354 355
356 357 358 359
360 |
.ELSEIF [ebx].nmcd.dwDrawStage==CDDS_POSTPAINT
INVOKE GetScrollPos,hTreeView,SB_HORZ
.IF eax!=xScroll
mov xScroll,eax
jmp redraw
.ENDIF
INVOKE GetScrollPos,hTreeView,SB_VERT
.IF eax!=yScroll
mov yScroll,eax
redraw: INVOKE InvalidateRect,hTreeView,0,FALSE
.ENDIF
.ENDIF |
GetScrollPos ªºì«¬¬O¡G
int GetScrollPos ( HWND hWnd, int nBar );
GetScrollPos ªº¥\¥Î¬O¶Ç¦^±²¶b¾ÞÁa±ìªº¦ì¸m¡A¦pªG©I¥s¦¨¥\¶Ç¦^ȧY¬°¾ÞÁa±ì¦ì¸m¡F§_«hªð¦^ 0¡CÁöµM·L³n«Øij¥H GetScrollInfo ¨ú¥N GetScrollPos¡A¦ý¬O¦Ü¤Ö¦b Windows 7¤¤¡AÁÙ¥i¥H¨Ï¥Î¡A©³¤U»¡©ú GetScrollPos ¥Îªk¡ChWnd ¬O±²¶b±±¨î¶µ¥N½X©Î¬O¾Ö¦³¼Ð·Ç±²¶bªºµøµ¡¥N½X¡AnBar ¬O«ü©w¶Ç¦^þ¤@Ó±²¶b¾ÞÁa±ìªº¦ì¸m¡A¥i¥H¬O©³¤Uªº¨ä¤¤¤@Ó¡G
ºX¼Ð | ¼ÆÈ | »¡¡@©ú |
SB_HORZ | 0 | ¨ú±o¤ô¥±²¶bªº¦ì¸m¡A¥Î©ó¾Ö¦³¼Ð·Ç±²¶bªºµøµ¡ |
SB_VERT | 1 | ¨ú±o««ª½±²¶bªº¦ì¸m¡A¥Î©ó¾Ö¦³¼Ð·Ç±²¶bªºµøµ¡ |
SB_CTL | 2 | ¨ú±o±²¶b±±¨î¶µªº¦ì¸m¡C¦pªG¦¹®É hWnd ¤£¬O±²¶b±±¨î¶µ¥N½X¡A¨º»ò¦¹µøµ¡·|¦¬¨ì SBM_GETPOS °T®§¡A¦pªG¤£³B²z¥¦¡AGetScrollPos ´N·|²£¥Í¿ù»~ |
¨£¤W±²Ä 350 ¦æ¡A¥H SB_HORZ ©I¥s GetScrollPos «á¡A§â¶Ç¦^È»P xScroll ¤ñ¸û¡A¦pªG¤£¦Pªí¥Ü¾ÞÁa±ì¦ì¸m§ïÅÜ¡A§â·sªº¦ì¸m¦s¨ì xScroll ùØ¡A¦P®É¸õ¨ì redraw: ¼Ð¸¹³B©I¥s InvalidateRect¡C¦pªG¬Û¦P¡A«hÀˬd««ª½±²¶bªº¾ÞÁa±ì¦ì¸m¡A¨BÆJ»Pèè¬Û¦P¡A¤p¤ì°¸´N¤£¦A´yz¤F¡C
¦b¤j³¡¤ÀªºÀ³¥Îµ{¦¡ùØ¡A±`¦bµ{¦¡¶}©l°õ¦æ®É´N¤w½T©w¤FºÏºÐ¾÷ªº¦h¹è¥H¤ÎºÏºÐ¾÷½s¸¹ ( A:\¡BB:\¡BC:\¡Kµ¥ºÙ¬°ºÏºÐ¾÷½s¸¹ )¡C¤£¹LÀHµÛÀH¨ºÐªº¨Ï¥Î¡A¥i¼ö´¡©ÞªºÀx¦s¸Ë¸m¶V¨Ó¶V¬y¦æ¡A¦³¥i¯àÀ³¥Îµ{¦¡¤w¸g°õ¦æ¤@¬q®É¶¡¡A¨Ï¥ÎªÌ¤~´¡¤J USB ÀH¨ºÐ¡A¦]¦¹¤£©y¦b WM_CREATE ©Î WM_INITDIALOG °T®§³B²z¤¤¨M©wºÏºÐ¾÷¦h¹è¡CTVCD.ASM µ{¦¡¬O¦b³B²z WM_MENUSELECT °T®§®É¡A¤~§Y®É¨ú±oºÏºÐ¾÷¦h¹è¡C·í¨Ï¥ÎªÌ¿ï¾Ü¿ï³æ¤¤ªº¬Yӿﶵ®É¡AWindows ¨t²Î·|¹ï¸Óµøµ¡µo¥X WM_MENUSELECT °T®§¡Aµ{¦¡¥i¥H¦b¸Óµøµ¡ªºµøµ¡¨ç¦¡¤¤°µ¤@¨Ç¨Æ±¡¡C·í Windows ¨t²Îµo¥X WM_MENUSELECT °T®§®É¡A¨ä©ÒÄâ±aªº lParam ¬O³Q¿ï©wªº¿ï³æ¥N½X¡AwParam ¸û°ªªº 16 ¦ì¤¸¬O¤Uªí¤¤ªº¤@өάO¼ÆÓªºÁp¶°¡G
ºX¼Ð | ¼ÆÈ | »¡¡@©ú |
MF_BITMAP | 04H | ¦¹¿ï¶µ¬OÂI°}¹Ï |
MF_CHECKED | 8H | ¦¹¿ï¶µ«e¦³¤Ä¿ï°O¸¹ |
MF_DISABLED | 2H | ¦¹¿ï¶µ¬O³Q¸T¥Î |
MF_GRAYED | 1H | ¦¹¿ï¶µ§e²{¦Ç¦â |
MF_HILITE | 80H | ¦¹¿ï¶µ¬O³Q¿ï©wªº |
MF_MOUSESELECT | 8000H | ¦¹¿ï¶µ³Q·Æ¹«¿ï©w |
MF_OWNERDRAW | 100H | ¦¹¿ï¶µ¬° owner-drawn |
MF_POPUP | 10H | ¦¹¿ï¶µ¬°¼u¥X¿ï¶µ¡A·|Åã¥Ü¤@Ó¤l¿ï³æ |
MF_SYSMENU | 2000H | ¦¹¿ï¶µ¥]§t¦b¨t²Î¿ï³æ¤º |
wParam ¸û§Cªº 16 ¦ì¤¸¬O¿ï¶µÃѧO½X©Î¤l¿ï³æ¥N½X¡C¦pªG³Q¿ï©wªº¶µ¥Ø¬O¤@¯ë¿ï¶µ¡A¨º wParam ¸û§Cªº 16 ¦ì¤¸¬O³Q¿ï©wªº¿ï¶µÃѧO½X¡F¦pªG¬O¼u¥X¿ï¶µ¡A¨º wParam ¸û§Cªº 16 ¦ì¤¸¬O³Q¿ï©wªº¿ï¶µ¯Á¤Þ ( §Y¿ï¶µªº¦ì¸m )¡A¥Ñ 0 ¶}©l¡C
TVCD.ASM ªº²Ä 429¡ã436 ¦æ¦b³B²z WM_MENUSELECT ®É¡A¨Ï ECX ¬° wParam ªº§C¤Q¤»¦ì¤¸¡AEAX ¬°°ª¤Q¤»¦ì¤¸¡C¦b 435¡B436 ¦æÀˬd¨Ï¥ÎªÌ¬O§_¿ï¾Ü²Ä¤@Ó¦ì¸m ( §Y¡uºÏºÐ¾÷¡v¿ï¶µ )¡A¦AÀˬd¬O§_¬° MF_POPUP¡A¦pªG³£²Å¦X¡A«h¶i¦æ¼u¥X¿ï³æªº§ó·s¡C¨£¤U±µ{¦¡½X¡C
429 430 431
432 433 434 435
436 | .ELSEIF uMsg==WM_MENUSELECT
mov eax,wParam
mov ecx,eax
shr eax,10h
and ecx,0ffffh
and eax,MF_POPUP
.IF ecx==1 ;ECX¡×¥D¿ï³æ¤ºªº²Ä1ӿﶵ¡A§Y¡uºÏºÐ¾÷¡v¼u¥X¿ï³æ
.IF eax==MF_POPUP ;Åã¥Ü¡uºÏºÐ¾÷¡v¼u¥X¿ï³æ |
§ó·s¼u¥X¿ï³æªº¤èªk¬O¥ý§R°£ì¦³ªº¡uºÏºÐ¾÷¡v¼u¥X¿ï³æ©Ò¥X²{ªº¤l¿ï³æ¤ºªº©Ò¦³¿ï¶µ¡AµM«á¦A©I¥s GetLogicalDriveStrings ¨ú±o²{¦b©Ò¦³ªºÅÞ¿èºÏºÐ¾÷¡A¦A§â³o¨ÇÅÞ¿èºÏºÐ¾÷¥[¤J¼u¥X¿ï³æùØ¡C³o¬qµ{¦¡¤£Ãø¡A©Ò¥H¤]¤£¸Ô²Ó¸ÑÄÀ¤F¡C