Ch 21 ³q¥Î±±¨î¶µ(1)¡G¼ÐÅÒ±±¨î¶µ


¤°»ò¬O³q¥Î±±¨î¶µ ( Common Controls )¡H

¦b Windows 1.0 ªº®É¥N¡A¨t²Î¤¤´N¤w¸g¨Ï¥Î«ö¶s¡B½s¿è®Ø¡B½Æ¦X®Øµ¥±±¨î¶µ ( ¤]ºÙ¬°¨Ï¥ÎªÌ±±¨î¶µ )¡A¨Ó¥[±j¨Ï¥ÎªÌ¬É­±¡AÅý¹q¸£ªº¨Ï¥Î¤£¦A¬O§N¦B¦Bªº¾÷¾¹¡A¼W¶i¤F¤£¤Ö¿Ë©M¤O¡C·íµM¶i¤J Windows 95 ¦~®É¡A³o¨Ç¨Ï¥ÎªÌ±±¨î¶µ¤´«O¯dÄ~Äò¨Ï¥Î¡A¦b²Ä 8¡ã12 ³¹¡A¤p¤ì°¸¤w²³æ¤¶²Ð¤F¦b Win 32 ¨t²Î¤¤ªº¨Ï¥ÎªÌ±±¨î¶µ¡C

°£¤F³o¨Ç¨Ï¥Î¸ûÀWÁcªº¨Ï¥ÎªÌ±±¨î¶µ¤§¥~¡AÁÙ¦³¥t¥~¤@Ãþ¬O¦b Windows 95 ¤§«á¡A¤~¥[¤Jªº±±¨î¶µ¡AºÙ¬°³q¥Î±±¨î¶µ¡A¥]§t TreeView¡BListView¡BTab¡BToolbar¡BStatusBar¡BTabStrip¡BSlider µ¥±±¨î¶µ¡C³B²z³o¨Ç±±¨î¶µªº API ³£¥]§t¦b COMCTL32.DLL ùØ¡A¨äª©¥»¬O 4.00 ª©¡AÀHµÛ Windows 95/NT 4.0 ­ìª©¥úºÐ³c°â¡CÀH®É¶¡¬y³u¡A¨Cµo§G·sª©¥»ªº IE ©Î·sª©¥»ªº Windows ¡ACOMCTL32.DLL ¤]ÀH¤§·s¼W¡A¨C¦¸¼W¥[·sªº³q¥Î±±¨î¶µ¡A¤]³£·|¦Ò¼{¨Ïªº±±¨î¶µ¬Û®e¡C¸g¹L¾ú¦~¨Ó³vº¥¼W¥[¡A¨ì Windows XP ®É¤w¸g¼W¬°¬ù 23 ­Ó³q¥Î±±¨î¶µ¤F ( °Ñ¦Ò¿àºa¼Ï¥ý¥Íªº Windows XP µ{¦¡³]­p·§½× )¡Aª©¥»¬° 6.00 ª©¡C§Y¨Ï³o¨Ç³q¥Î±±¨î¶µ¤§¶¡ªº¥~Æ[»P¥\¥Î¬Û®t¤Q¸U¤K¤d¨½¡A¦ý±qµ{¦¡³]­p®vªº²´¥ú¬Ý¨Ó¡A³q¥Î±±¨î¶µ©M¨Ï¥ÎªÌ±±¨î¶µ¤@¼Ë¡A³£¬O¤@ºØ¤lµøµ¡¡A¥u¬O¤£¦Pªº±±¨î¶µ¦³¤@¨Ç¯S®íªº­·®æ ( style )¡B°T®§ ( message ) »P³qª¾½X ( notification )¡C©³¤U¬O¤@¨Ç±`¨£ªº³q¥Î±±¨î¶µ¡G



¸ü¤J³q¥Î±±¨î¶µ

¦p«e©Ò­z¡A³B²z»P³q¥Î±±¨î¶µ¦³Ãöªº API ¬O©ñ¦b¡uC:\WINDOWS\SYSTEM32\COMCTL32.DLL¡vùØ¡A¥Ñ©ó³q¥Î±±¨î¶µªº¼Æ¶q¤Ó¦h¡A°²¦p¨t²Î¤@±Ò°Ê¡A´N§â©Ò¦³ªº³q¥Î±±¨î¶µ¸ü¤J¨Ãµù¥U¡A¬O«D±`®ö¶O°O¾ÐÅ骺¡A©Ò¥H·L³n¨Ã¨S¦³³o¼Ë°µ¡C³o·N¨ýµÛ¡A­n¨Ï¥Î¥¦­Ì¤§«e¡A¥²¶·¥ý½T©w¬O§_¤w¸g¸ü¤J°O¾ÐÅé¡Cµ{¦¡¥i¥H©I¥s InitCommonControls ©Î InitCommonControlsEx¡A¥¦­Ìªº­ì«¬¬O¡G

void InitCommonControls(VOID);

BOOL InitCommonControlsEx(
    const  LPINITCOMMONCONTROLSEX lpInitCtrls
);

InitCommonControls ¨S¦³°Ñ¼Æ¡A¦]¦¹¥u­n°õ¦æ¤F InitCommonControls ´N·|§â©Ò¦³ªº³q¥Î±±¨î¶µ¸ü¤J¡CInitCommonControlsEx ¦³¤@­Ó°Ñ¼Æ¡A¦¹°Ñ¼Æ¬O¤@­Ó¦ì§}«ü¼Ð¡A«ü¦VºÙ¬° INITCOMMONCONTROLSEX µ²ºcÅ骺¦ì§}¡A¦¨­û¦p¤U¡G

INITCOMMONCONTROLSEX    STRUC
dwSize                  DWORD   ?
dwICC                   DWORD   ?
INITCOMMONCONTROLSEX    ENDS

INITCOMMONCONTROLSEX ªº²Ä¤@­Ó°Ñ¼Æ¡AdwSize ¬O¦¹µ²ºcÅé¤j¤p¡A¥H¦ì¤¸²Õ¬°³æ¦ì¡A¥²¶·¦b©I¥s InitCommonControlsEx API ¤§«e´N¶ñ¤J¾A·íªº¤j¤p¡A¨t²ÎÂǦ¹¤À¿ëª©¥»¡CdwICC ¬O«ü­nªì©l¤Æªº³q¥Î±±¨î¶µ¡A¥i¥H¬O¤Uªí¤¤¡A³Ì¥kÃ䪺¨º¤@Äæ¡G

±±¨î¶µ»¡©ú µøµ¡Ãþ§O­·®ædwICC ­È
°Êµe±±¨î¶µ
animate control
³q±`¥Î©ó«þ¨©Àɮ׮ɪº°Êµe¡A¦p¤W¹Ï¥ª°¼¤Uªºµøµ¡¤¤¡A¥H¬õ¦â®Ø°_¨Óªº±±¨î¶µ´N¬O°Êµe±±¨î¶µ SysAnimate32ACS_ICC_ANIMATE_CLASS
¤é´Á®É¶¡±±¨î¶µ
date and time picker
¥Î©ó¬D¿ï¤é´Á¡A¦p¤W¹Ï¥k°¼¤Wµøµ¡¤¤¡A¥H¤ÑªÅ¦â®Ø¦íªº±±¨î¶µ SysDateTimePick32DTS_ICC_DATE_CLASSES
¼ÐÃDÄæ
header control
±`¥Î¦b¡u²M³æÀ˵ø¡v±±¨î¶µùتº¼ÐÃD¡A¦]¦¹¤]±`±`»P¨ä¦P®É¸ü¤J¡A¦p¤W¹Ï¥ª°¼¤¤ªºµøµ¡ùØ¡A¥H²Hºñ¦â®Ø¦íªº±±¨î¶µ SysHeader32HDS_ICC_LISTVIEW_CLASSES
§Ö±¶Áä
hot key control
msctls_hotkey32 ICC_HOTKEY_CLASS
IP ±±¨î¶µ
IP address control
Ãþ¦ü½s¿è®Ø¡A¦ý¨ä¤º¦³¤T­Ó¤p¼ÆÂI¤À¹j¦¨¥|Äæ¡A§@¬°¿é¤J IP ¦ì§}¤§¥Î SysIPAddress32 ICC_INTERNET_CLASSES
¶W³sµ²±±¨î¶µ
hyperlink control
¦p¦Pºô­¶¤Wªº¶W³sµ²¡A¥i¨Ñ¨Ï¥ÎªÌ«ö¤U«á³s±µ¨ì¤@­Óºô­¶¤W¡C¦p¥k°¼¤U¹Ï¡A¥H¯»¬õ¦â®Ø¦íªº±±¨î¶µ HyperlinkDemoICC_LINK_CLASS
²M³æÀ˵ø
list-view control
³q±`¦b¤@¯x§Î°Ï°ì¦³¼Æ­Ó¶µ¥Ø¡A¥i¯à¬O¹Ï¥Ü©Î¤å¦r¡A¤]¥i¯à¨âªÌ¬Ò¦³¡A¥i¨Ñ¨Ï¥ÎªÌÂI¿ï¡C¦p¤W¹Ï¥ª°¼¤¤ªºµøµ¡ùØ¡A¥HÂŦâ®Ø°_¨Óªº´N¬O list-view ±±¨î¶µ SysListView32LVS_ICC_LISTVIEW_CLASSES

rebar control
³q±` rebar ±±¨î¶µ¬O¥i¥H¥]§t¨ä¥L±±¨î¶µªº±±¨î¶µ¡A¨Ã¥B¥i¥HÅý¨Ï¥ÎªÌ«ö¦í·Æ¹«²¾°Ê¨ä¦ì¸m¡A¦p¤W¹Ï¥ª°¼¤Wªºµøµ¡¡A¥Î²Hºñ¦â®Ø®Ø³ò°_¨Óªº±±¨î¶µ ReBarWindow32RBS_ICC_COOL_CLASSES
¾ðª¬À˵ø
tree-view control
³q±`¥Î¨ÓÀ˵øºÏºÐ¥Ø¿ý¡Bµn¿ýÀɾ÷½X¡A¦p¤W¹Ï¥ª°¼¤¤µøµ¡ùØ¡A¥H¤ÑªÅ¦â®Ø¦íªº±±¨î¶µ´N¬O tree-view ±±¨î¶µ SysTreeView32TVS_ICC_TREEVIEW_CLASSES

native font control
³o¬O¤@­Ó¬Ý¤£¨£ªº±±¨î¶µ¡A¥¦¯à¦b­I¦aùؤu§@¡AÅý¹ï¸Ü²°ªº±±¨î¶µ¥H²{¦bªº»y¨tÅã¥Ü¤å¦r NativeFontCtlNFS_ICC_NATIVEFNTCTL_CLASS

pager control
³q±`¤u¨ã¦C¤Ó¯¶®É¡A¦b¨ä¨â°¼ªº½b¸¹¡A¦³ÂI¹³±²¶b¡A¥i¨Ñ¨Ï¥ÎªÌ±²°Ê¤u¨ã¦C¡C¦p¤W¹Ï¥ª°¼¤Wªºµøµ¡¡A¥H¬õ®Ø³ò¦íªº´N¬O pager ±±¨î¶µ SysPagerPGS_ICC_PAGESCROLLER_CLASS
¶i«×¦C
progress bar
³q±`¥Î¦b»Ý­n¹q¸£ªá¶O«Ü¦h®É¶¡³B²zªº¨Æª«®É¡AÅã¥Ü³B²z¶i«×ªº±±¨î¶µ¡A¦p¤W¹Ï¥ª°¼¤Uªºµøµ¡ùØ¥ÎÂŦâ®Ø°_¨Óªº±±¨î¶µ msctls_progress32PBS_ICC_PROGRESS_CLASS
ª¬ºA¦C
status bar
³q±`¦bµøµ¡ªº³Ì©³¤U¡AÅã¥Ü¨Ï¥Îª¬ºA¡C¦p¤W¹Ï¥ª°¼¤¤ªºµøµ¡¡A¥H¯»¬õ¦â®Ø¦íªº´N¬Oª¬ºA¦C msctls_statusbar32SBARS_ICC_BAR_CLASSES
¼ÐÅÒ
tab control
³q±`¦b¹ï¸Ü²°¤W¤è¡A¦³¦n´X­¶¥i¨Ñ¨Ï¥ÎªÌ¿ï¾Ü¡A¦p¤W¹Ï¥k°¼¤WÃ䪺µøµ¡ùØ¡A¨ä¤¤¡u¤é´Á®É¶¡¡v¡B¡u®É°Ï¡v¡B¡uºô»Úºô¸ô®É¶¡¡v´N¬O¼ÐÅÒ±±¨î¶µ¡C SysTabControl32TCS_ICC_TAB_CLASSES
¤u¨ã¦C
toolbar control
³q±`¦b¿ï³æ¤U¤è¡A¥\¯àÃþ¦ü¿ï³æ¡A¨Ñ¨Ï¥ÎªÌ§Ö³t¿ï¾Ü¬Y¨Ç¥\¯à¡A¦p¤W¹Ï¥ª°¼¤Wªºµøµ¡ùØ¡A¥Î¯»¬õ¦â®Ø¦íªº´N¬O¤u¨ã¦C ToolbarWindow32TBSTYLE_ICC_BAR_CLASSES
¤u¨ã´£¥Ü
tooltip control
·Æ¹«°±¯d¦b¬Y³B¤@¬q®É¶¡¥X²{ªº¤lµøµ¡¡A¦p¤W¹Ï¥ª°¼¤¤ªºµøµ¡ùØ¡A¡u³Ì¤p¤Æ¡v´N¬O¤u¨ã´£¥Ü Tooltips_class32TTS_ICC_TAB_CLASSES ©Î
ICC_BAR_CLASSES ©Î
ICC_TREEVIEW_CLASSES
·Æ°Ê¶b±±¨î¶µ
trackbar control
Ãþ¦ü±²¶b¡A¥i¥H¨Ñ¨Ï¥ÎªÌ¥Î¦b¾ÞÁa±ì¤W¡A«ö¦í·Æ¹«¥ªÁ䤣©ñ¡A©ì°Ê¥¦¡A¦p¤W¹Ï¥k°¼¤Uªºµøµ¡©Ò¥Ü¡A¥Î¬õ¦â®Ø½u³ò¦íªº´N¬O msctls_trackbar32TBS_ICC_BAR_CLASSES
¤W¤U±±¨î¶µ
up-down control
¦p¤W¹Ï¥k°¼¤Wªºµøµ¡ùØ¡A¥Î¯»¬õ¦â®Ø¦íªº¨â­Ó¤W¤U½bÀY´N¬O¡uup-down¡v±±¨î¶µ¡A¥i¥HÅý¨Ï¥ÎªÌ¼W¥[©Î´î¤Ö¯S©w¼Æ­È msctls_updown32UDS_ICC_UPDOWN_CLASS

ComboBoxEx
¤ñ½Æ¦X®Ø¦h¤F¹ï¡u¹Ï¹³²M³æ¡v( image list ) ªº¤ä´© ÂX®i½Æ¦X®Ø
ComboBoxEx32
CBS_ICC_USEREX_CLASSES

¥t¥~¡AdwICC ¤]¥i¥H¬O ICC_STANDARD_CLASSES¡BICC_WIN95_CLASSES ¨âºØ¡A«eªÌ¬O¸ü¤J©T¦³ªº¨Ï¥ÎªÌ±±¨î¶µ¡A¥]§t«ö¶s¡B½s¿è®Ø¡BÀRºA±±¥ó¡B²M³æ±±¥ó¡B½Æ¦X®Ø¡B±²¶b±±¥ó¡A«áªÌ¬O¸ü¤J°Êµe¡B¼ÐÃDÄæ¡B§Ö±¶Áä¡B²M³æÀ˵ø¡B¶i«×¦C¡Bª¬ºA¦C¡B¼ÐÅÒ¡B¤u¨ã´£¥Ü¡B¤u¨ã¦C¡Btrackbar¡B¾ðª¬À˵ø©M¤W¤U±±¨î¶µ¡C

InitCommonControlsEx ¨ã¦³²Ö¿n©Ê¡A·N«ä¬O¦pªG²Ä¤@¦¸ dwICC °Ñ¼Æ¬O ICC_ANIMATE_CLASS ©I¥s InitCommonControlsEx¡A²Ä¤G¦¸¥H ICC_PROGRESS_CLASS ©I¥s¡A³Ì«á¨t²Î·|¸ü¤J°Êµe±±¨î¶µ»P¶i«×¦C±±¨î¶µ¡C¥t¥~¤Wªí¤¤¡A¦³¨Ç dwICC °Ñ¼Æ­È·|¸ü¤J¨â­Ó©Î¨â­Ó¥H¤Wªº³q¥Î±±¨î¶µ¡A¨Ò¦p ICC_TAB_CLASSES ·|¸ü¤J¡u¼ÐÅÒ¡v»P¡u¤u¨ã´£¥Ü¡v¨âºØ±±¨î¶µ¡C

Rebar controls¡B¤é´Á®É¶¡±±¨î¶µ¡BIP ±±¨î¶µ¡BPager Controls¡BÂX®i½Æ¦X®Ø³o¤­­Ó³q¥Î±±¨î¶µ¡A¥²¶·¥Ñ InitCommonControlsEx ¸ü¤J¡A¦ÓµLªk¥Ñ InitCommonControls ¸ü¤J¡C

WM_NOTIFY °T®§

¤@¯ëªº¨Ï¥ÎªÌ±±¨î¶µ¡A¦p«ö¶s¡B½s¿è®Ø¡B½Æ¦X®Øµ¥·|µo¥X WM_COMMAND °T®§¡A¨Ã±N¦¹°T®§¶Çµ¹¤÷µøµ¡ªºµøµ¡¨ç¦¡¡A¥H¨Ïµ{¦¡³B²z³o¨Ç°T®§¡C¦ý¬O³q¥Î±±¨î¶µ©Òµo¥X¨Óªº°T®§»P¸ê®Æ¤Ó¦h¤F¡AWM_COMMAND µLªk§¹¥þ®e¯Ç¡A©Ò¥H§ïµo¥X WM_NOTIFY °T®§¡CWM_NOTIFY °T®§¤¤ªº wParam ¬Oµo¥X WM_NOTIFY ªº³q¥Î±±¨î¶µÃѧO½X¡A¤£¹LÃѧO½X¥i¥H­«½Æ¡A¦]¦¹³Ì¦nÁÙ¬O­nÀˬdµo¥X WM_NOTIFY ªº±±¨î¶µ¥N½X¤~¦n¡ClParam ¬O¤@­Ó«ü¼Ð¡A«ü¦V NMHDR µ²ºcÅé¡A¥¦ªº¤º®e¬O¡G

NMHDR       STRUC
hwndFrom    HWND    ?
idFrom      DWORD   ?
code        DWORD   ?
NMHDR       ENDS

NMHDR ¦¨­û¤¤ªº hwndFrom¡BidFrom ¤À§O¬O«üµo¥X WM_NOTIFY ªº±±¨î¶µ¥N½X¤ÎÃѧO½X¡Acode ¬O¸Ó±±¨î¶µ¦]À³¨Ï¥ÎªÌ°Ê§@©Òµo¥Xªº³qª¾½X ( notification )¡C¤£¦Pªº³q¥Î±±¨î¶µ¡A¥i¯à¦³¤£¦Pªº³qª¾½X¡A¦ý¬O©³¤Uªº¤KºØ³qª¾½X¬O¨C¤@ºØ³q¥Î±±¨î¶µ³£·|µo¥Xªº¡G

³qª¾½X»¡©ú
NM_CLICK¨Ï¥ÎªÌ¦b³q¥Î±±¨î¶µ«ö¤UÃP¶}·Æ¹«¥ªÁä
NM_DBLCLK¨Ï¥ÎªÌ¦b³q¥Î±±¨î¶µ³sÄò¨â¦¸«ö¤UÃP¶}·Æ¹«¥ªÁä
NM_RCLICK¨Ï¥ÎªÌ¦b³q¥Î±±¨î¶µ«ö¤UÃP¶}·Æ¹«¥kÁä
NM_RDBLCLK¨Ï¥ÎªÌ¦b³q¥Î±±¨î¶µ³sÄò¨â¦¸«ö¤UÃP¶}·Æ¹«¥kÁä
NM_RETURN¨Ï¥ÎªÌ¦b³q¥Î±±¨î¶µ¾Ö¦³¿é¤JµJÂI®É¡A«ö¤UÁä½L¤Wªº¡uEnter¡vÁä
NM_SETFOCUS³q¥Î±±¨î¶µÀò±o¿é¤JµJÂI
NM_KILLFOCUS³q¥Î±±¨î¶µ¥¢¥h¿é¤JµJÂI
NM_OUTOFMEMORY¨S¦³¨¬°÷ªº°O¾ÐÅé¾Þ§@³q¥Î±±¨î¶µ

³o¤K­Ó³qª¾½X³B²z§¹²¦¡Aªð¦^®É¡A­Yªð¦^­È¤£¬°¹s¡A«h¨t²Î¤£·|¦A¥H¤º©w¤è¦¡³B²z¡F­Yªð¦^­È¬°¹s¡A¨t²Î·|¥H¤º©w¤è¦¡¦A¦æ³B²z¤@¦¸¡C¤W­±¥u¬O²³æ»¡©ú WM_NOTIFY °T®§¡A¹ê»Ú¤W¤£¦Pªº³q¥Î±±¨î¶µ¡Aµo°e WM_NOTIFY °T®§µ¹¤÷µøµ¡®É¡AlParam ©Ò«üªºµ²ºcÅé¬O¤£¦Pªº¡A¦ý¬O¸Óµ²ºcÅ骺²Ä¤@­Ó¦¨­û¥²©w¬O NMHDR µ²ºcÅé¡C¦]¦¹¤W­±¤~»¡ WM_NOTIFY °T®§ªº lParam ¬O«ü¦V NMHDR µ²ºcÅé¡C¨Ò¦p¦b¡u²M³æÀ˵ø¡v±±¨î¶µ¤ºÂI¿ï¤@­Ó¶µ¥Ø®É¡Aµo¥Xªº WM_NOTIFY °T®§¤¤ªº lParam ©Ò«üªºµ²ºcÅ鬰 NMLISTVIEW¡A¤º®e¬°¡G

NMLISTVIEW      STRUCT
hdr             NMHDR   <?>
iItem           DWORD   ?
iSubItem        DWORD   ?
uNewState       DWORD   ?
uOldState       DWORD   ?
uChanged        DWORD   ?
ptAction        POINT   <?>
lParam          LPARAM  ?
NMLISTVIEW      ENDS

NMLISTVIEW µ²ºcÅ骺²Ä¤@­Ó¦¨­û¬O NMHDR µ²ºcÅé¡C¥ç§Y WM_NOTIFY °T®§¤¤ªº lParam °Ñ¼Æ©Ò«ü¦ì§}ªº¤º®e¬° NMHDR µ²ºcÅé¡A¦Ó NMHDR µ²ºcÅé¤]¥i¯à¬O¥t¤@­Ó§ó¤j§ó½ÆÂøªºµ²ºcÅ餤ªº²Ä¤@­Ó¦¨­û¡C

WM_NOTIFY ªºªð¦^­È¨Ã¤£¤@©w¡A»P³qª¾½X¦³Ãö¡A¤j³¡¤Àªº±¡§Î¡A·|³Q¨t²Î©¿²¤¡C¦pªG WM_NOTIFY ¬Oµo°e¨ì¹ï¸Ü²°ªºµøµ¡¨ç¦¡¡A¨º»òªð¦^­È¥²¶·©I¥s SetWindowLong API ³]©w¡A­ì«¬¬°¡G

SetWindowLong   PROTO   hDlg,DWL_MSGRESULT,dwReturnValue

hDlg ¬O¹ï¸Ü²°¥N½X¡AdwRetureValue ¬°ªð¦^­È¡C©³¤U¡A¤p¤ì°¸­n¤¶²Ðªº²Ä¤@­Ó³q¥Î±±¨î¶µ¬O¼ÐÅÒ±±¨î¶µ ( Tab Control )¡C


¼ÐÅÒ±±¨î¶µ ( Tab Control )

¼ÐÅÒ±±¨î¶µ¦U³¡¦WºÙ

¤U¹Ï¬O Windows XP ½Õ¾ã¤é´Á®É¶¡ªº¹ï¸Ü²°¡A¦¹¹ï¸Ü²°¬°¥iºÙ¬°¡u¥D¹ï¸Ü²°¡v¡A¥¦¬O¤@­Ó¼Ò¦¡¹ï¸Ü²°¡A¤@¯ë¥H DialogBoxParam «Ø¥ß¡C¨ä¤º§t¦³¤@­Ó¼ÐÅÒ±±¨î¶µ¥H¤Î¤T­Ó«ö¶s ( ½T©w¡B¨ú®ø¡B®M¥Î )¡C¼ÐÅÒ±±¨î¶µªº¤W·|¦³¦n´X­Ó¿ï¶µ ( ¹Ï¤¤¥H¬õ®Ø³ò¦í )¡AºÙ¤§¬°¡u¶µ¥Ø¡v( item¡A¤]¥s¼ÐÅÒ¡Atab¡A¤£¹L¥»¤å³£¥s¥¦¬°¶µ¥Ø )¡A¥i¥H¨Ñ¨Ï¥ÎªÌ¿ï¾Ü¡A¨C­Ó¶µ¥Ø¥H¤@­Ó¼Æ­Èªí¥Ü¡A¦¹¼Æ­ÈºÙ¬°¯Á¤Þ¡A¥Ñ 0 ¶}©l¡A¨C­Ó¶µ¥Ø¤W¦³¶µ¥Ø¤å¦r ( label ) ©Î¹Ï¥Ü¡C¦¹¥~¼ÐÅÒ±±¨î¶µÁÙ¥]§t¤@­ÓÅã¥Ü°Ï°ì ( diaplay area¡A¹Ï¤¤¥HÂŮسò¦í )¡C¨Ï¥ÎªÌ¿ï¤£¦Pªº¶µ¥Ø¡A·|¬Ý¨ìÅã¥Ü°Ï°ì¦³¤£¦Pªºµe­±¡C¥H Windows XP ªº¡u¤é´Á®É¶¡¤º®e¡v¨Ó»¡©ú¡A¥¦ªº¶µ¥Ø¦³¡u¤é´Á®É¶¡¡v¡B¡u®É°Ï¡v¡B¡uºô»Úºô¸ô®É¶¡¡v¤T¶µ¡C¡u¤é´Á®É¶¡¡v¶µ¥Ø«h¦³¡u¤é´Á¡v¡B¡u®É¶¡¡v«ö¶s¡B¡u¤@¤ë¡v½Æ¦X®Ø¡B¡u2012¡v¤W¤U±±¨î¶µµ¥µ¥¡C

¦p¤W­±©Ò»¡¡A¦b¼ÐÅÒ±±¨î¶µùØ¡A¨C¤@­Ó¶µ¥Ø³£¦³¤£¦Pªºµe­±¡A¤W­±¤S¦U¦Û¦³¤£¦Pªº±±¨î¶µ¡A³o¬O¦p¦ó¿ì¨ìªº©O¡H­ì¨Ó¨C¤@­Ó¶µ¥Ø¦bÅã¥Ü°Ï°ìùØÅã¥Üªº¨ä¹ê³£¬O¤@­Ó¨S¦³¼ÐÃDÄ檺«D¼Ò¦¡¹ï¸Ü²°¡A¦pªG¦³¤T­Ó¶µ¥Ø¡A´N±o·Ç³Æ¤T­Ó¹ï¸Ü²°¡C¦Ó³o¤T­Ó¹ï¸Ü²°³£¥²¶·¥]§t WS_CHILD ­·®æ¡A·í©I¥s CreateDialogParam ¤T¦¸¡A¤À§O«Ø¥ß°_³o¤T­Ó¹ï¸Ü²°®É¡A§¡«ü©w¤÷µøµ¡¬°¼ÐÅÒ±±¨î¶µ¡A¦P®É¤]«ü©w¦U¹ï¸Ü²°ªºµøµ¡¨ç¦¡¡C³o¼Ë¤@¨Ó¡A§Ú­Ì´N¥i¥H§Q¥Î¦U¹ï¸Ü²°ªºµøµ¡¨ç¦¡³B²z¦U¹ï¸Ü²°ªº°T®§¡A¦P®É³o¤T­Ó¹ï¸Ü²°¤]¬O¼ÐÅÒ±±¨î¶µªº¤lµøµ¡¡C

«Ø¥ß¼ÐÅÒ±±¨î¶µ

«Ø¥ß¼ÐÅÒ±±¨î¶µªº¤èªk¸ò¨ä¥L±±¨î¶µ¨Ã¨S¦³¤°»ò¤£¦P¡A¤£¥~¥G¬O¦b¸ê·½´y­zÀɤ¤ªº¹ï¸Ü²°­±ªOùØ©w¸q©ÎªÌ¬O¦bµ{¦¡¤¤©I¥s CreateWindowEx «Ø¥ß¡A¤£½×¬O­þ¤@ºØ¤èªk¡A©Ò¨Ï¥Îªºµøµ¡Ãþ§O³£¬O¡uSysTabControl32¡v¡C«Ø¥ß¼ÐÅÒ±±¨î¶µ¥i¥H¨Ï¥Î¤U­±ªº­·®æ¡G

­·®æ»¡©ú
TCS_BOTTOM ¶µ¥Ø¦bÅã¥Ü°Ï°ìªº¤U¤è¡ACOMCTL32.DLL ¥²¶·¦b 4.70 ª©¥»¤Î¨ä¥H«á¥H¤W¤~¦³¦¹­·®æ¡C( µù¤@ )
TCS_BUTTONS¶µ¥Ø·|¥H«ö¶sªº¥~Æ[Åã¥Ü¡A¥BÅã¥Ü°Ï°ì¨S¦³®Ø½u
TCS_FIXEDWIDTH©Ò¦³ªº¶µ¥Ø¼e«×¬Û¦P
TCS_FLATBUTTONS¶µ¥Ø·|¥H¥­ªº«ö¶s¥~Æ[Åã¥Ü¡A¶··f°t TCS_BUTTONS ¨Ï¥Î¡A¦b COMCTL32.DLL 4.71 ¤Î¨ä¥H«áª©¥»¤è¦³¦¹­·®æ
TCS_FOCUSNEVER¨Ï¥ÎªÌ¿ï«ö®É¡A¼ÐÅÒ¤£±µ¦¬¿é¤JµJÂI
TCS_FOCUSONBUTTONDOWN¨Ï¥ÎªÌ¿ï«ö®É¡A¼ÐÅÒ±µ¦¬¿é¤JµJÂI
TCS_FORCEICONLEFT¶µ¥Ø¹Ï¥Ü¾a¥ª¹ï»ô¡A¶··f°t TCS_FIXEDWIDTH ¨Ï¥Î
TCS_FORCELABELLEFT¶µ¥Ø¤å¦r¾a¥ª¹ï»ô¡A¶··f°t TCS_FIXEDWIDTH ¨Ï¥Î¡A¨Ã¥B·t¥Ü TCS_FORCEICONLEFT
TCS_HOTTRACK·í·Æ¹«²¾¨ì¶µ¥Ø¤W®É¡A¶µ¥Ø·|¥H°ª«G«×Åã¥Ü¡A¶·¦b 4.70 ª©ªº COMMCTL.DLL ¤~¦³¦¹­·®æ¡C
TCS_MULTILINE
TCS_MULTISELECT
TCS_OWNERDRAWFIXED¾Ö¦³ªÌ¦Û¦æø»s¼ÐÅÒ
TCS_RAGGEDRIGHT
TCS_RIGHTCOMCTL32.DLL 4.70 ª©¤~¦³¦¹­·®æ¡A¶··f°t TCS_VERTICAL ­·®æ¨Ï¥Î¡CTCS_RIGHT ·|¨Ï¼ÐÅÒ±±¨î¶µªº¶µ¥Ø««ª½Åã¥Ü¦bÅã¥Ü°Ï°ìªº¥k°¼
TCS_RIGHTJUSTIFY
TCS_SCROLLOPPOSITE
TCS_SINGLELINE¶µ¥Ø¶È¤@¦C±Æ¦C¡A¤º©wªº­·®æ
TCS_TABSÅã¥Ü¶µ¥Ø¡B®Ø½u¡A¤º©wªº­·®æ
TCS_TOOLTIPS¼ÐÅÒ±±¨î¶µ¨ã¦³¤u¨ã´£¥Ü
TCS_VERTICAL¶µ¥ØÅã¥Ü¦bÅã¥Ü°Ï°ì¥ªÃä¡ACOMCTL32.DLL ¶· 4.70 ª©©Î¥H«áªºª©¥»

¦b¼ÐÅÒ±±¨î¶µ¼W²K¶µ¥Ø

·s«Ø¥ß¦nªº¼ÐÅÒ±±¨î¶µ¨Ã¨S¦³¶µ¥Ø¡A»Ý­n¹ï¼ÐÅÒ±±¨î¶µµo¥X TCM_INSERTITEM °T®§¼W²K¤~¦æ¡A¤èªk¬O©I¥s SendMessage¡A¦p¤U¡G

INVOKE  SendMessage,hTabCtrl,TCM_INSERTITEM,wParam,lParam

¨Æ¹ê¤Wµ{¦¡¥i¥H¹ï¼ÐÅÒ±±¨î¶µµo¥X³\¦h°T®§¡A°£¤F¼W²K¶µ¥Ø¥~¡AÁÙ¥i¹ï¼ÐÅÒ±±¨î¶µ°µ¤£¦Pªº°Ê§@¡A¨Ò¦p¨ú±o¶µ¥Ø­Ó¼Æ¡B§R°£¬Y¨Ç¶µ¥Ø¡B³]©w¤u¨ã´£¥Ü¡K¡Kµ¥µ¥¡C¤£ºÞ­þ¤@ºØ°T®§¡AhTabCtrl °Ñ¼Æ¬O¼ÐÅÒ±±¨î¶µªº¥N½X¡F¦ý¬O¤£¦Pªº°T®§¡AwParam »P lParam °Ñ¼Æ©Òªí¥Üªº·N¸q¤]¤£¦P¡C¹ï TCM_INSERTITEM °T®§¦Ó¨¥¡AwParam ¬O¶µ¥Ø¯Á¤Þ¡A¥Ñ¹s¶}©l¡Aªí¥Ü´¡¤J¶µ¥Ø«á¡A¸Ó¶µ¥Øªº¯Á¤Þ­È¡FlParam ¬O«ü¦V TCITEM µ²ºcÅé ( ¤]ºÙ¬° TC_ITEM ) ªº«ü¼Ð¡Aµ²ºcÅ餤«ü©w¤F¶µ¥Øªº¤å¦r©Î¹Ï¥Ü¡CTCITEM µ²ºcÅ骺¦¨­û¬O¡G

TCITEM  STRUC
  mask          DWORD   ?
  dwState       DWORD   ?
  dwStateMask   DWORD   ?
  pszText       LPTSTR  ?   
  cchTextMax    DWORD   ?   
  iImage        DWORD   ?   
  lParam        LPARAM  ? 
TCITEM  ENDS

¦¨­û¤¤ªº mask ¬O³]©w³o¦¸©Ò­nµo¥Xªº°T®§¤¤­þ¨ÇÄæ¦ì¬O¥i¥Îªº¡A¥i¥H¦³¤U­±´XºØ¿ï¾Ü¡G

Äæ¦ì»¡©ú
TCIF_IMAGEiImage ¶·¶ñ¤W¦b ImageList ªº¹Ï¤ù¯Á¤Þ
TCIF_PARAMlParam ¶·¶ñ¤W°T®§¡C·í¶µ¥Ø¥[¤J¼ÐÅҮɡA·|¹ïµ{¦¡µo¥X¦¹°T®§
TCIF_RTLREADING¤å¦r¥Ñ¥k¦Ü¥ª¡A¥u¦³§Æ§B¨Ó»Pªü©Ô§B»y¨t¤~¯à¥Î
TCIF_STATEdwState ¶·¶ñ¤W¼ÐÅÒ±±¨î¶µªºª¬ºA¡A¤£¹L¹ï¼ÐÅÒµo°e TCM_INSERTITEM ®É¡A¨t²Î·|©¿²¤ dwState
TCIF_TEXTpszText ¶·¶ñ¤W¤@­Óµ²§À¬°¹sªº¦r¦ê«ü¼Ð¡A³o­Ó¦r¦ê·|Åã¥Ü¦b¶µ¥Ø¤W

Åã¥Ü°Ï°ì»P¨ä¤ºªº¹ï¸Ü²°

¬°¤FÅý¼ÐÅÒ¤º¨C­Ó¶µ¥ØªºÅã¥Ü°Ï°ì¦³¤£¦Pªºµe­±¡A¤@¯ë°µªk¬O¦b¨C­Ó¶µ¥Ø¤ºªºÅã¥Ü°Ï°ìÅã¥Ü¤£¦Pªº«D¼Ò¦¡¹ï¸Ü²°¡A¦¹«D¼Ò¦¡¹ï¸Ü²°¬O¨S¦³¼ÐÃDªº¡A¦Ó¨ä¤j¤p«ê¦n¬OÅã¥Ü°Ï°ìªº¤j¤p¡C°ÝÃD¬OÅã¥Ü°Ï°ìªº¤j¤p¦p¦ó¨ú±o©O¡H§Ú­Ìª¾¹D±±¨î¶µ¨ä¹ê¤]¬O­Óµøµ¡¡A§Ú­Ì¥i¥H©I¥s GetWindowRect ¨ú±oµøµ¡ªº¤j¤p¡AGetWindowRect ­ì«¬¬O¡G

GetWindowRect(
    HWND    hWnd,   // handle of window
    LPRECT  lpRect  // address of structure for window coordinates
);

¨ä¤¤ hWnd ¬Oµøµ¡¥N½X¡AlpRect ¬O«ü¦V RECT µ²ºcÅé¦ì§}ªº«ü¼Ð¡A¶Ç¦^¨Óªº RECT ¬O¬Û¹ï©ó¿Ã¹õ®y¼Ð¡A¥ç§Y¥H¿Ã¹õ¥ª¤W¨¤¬°®y¼Ð­ìÂI¡C­Y hWnd °Ñ¼Æ¬°¼ÐÅÒ±±¨î¶µªº¥N½X¡A©I¥s GetWindowRect «á©Ò¶Ç¦^¨Óªº¯x§Î¬O¾ã­Ó¼ÐÅÒ±±¨î¶µªº¤j¤p¡A¥]§t¤F¶µ¥Ø¤Î®Ø½uªº¤j¤p¡A¨Ã¥B¬Û¹ï©ó¿Ã¹õ¥ª¤W¨¤¦ì¸m¡C³o®É¡Aµ{¦¡¥²¶·¦A¥H TCM_ADJUSTRECT ¬°°Ñ¼Æ¡A©I¥s SendMessage¡A¨äµ{¦¡½X¬°

INVOKE  SendMessage,hTabCtrl,TCM_ADJUSTRECT,fLarger,lpRect

¤W­±ªº lParam °Ñ¼Æ¡AlpRect ¬O«ü¦V RECT µ²ºcÅé¦ì§}ªº«ü¼Ð¡A¥ç§Y©I¥s GetWindowRect «áªº RECT ¦ì§}¡FwParam °Ñ¼Æ¡AfLarger ¬O«ü¦p¦ó½Õ¾ã RECT¡A¦³¨âºØ¿ï¾Ü¡GFALSE ©Î TRUE¡C°²¦p fLarger ¬° FALSE¡A¨t²Î·|§â lpRect ©Ò«üªº¯x§Î¦©°£¶µ¥Ø¤Î®Ø½uªº¤j¤p¡A³o¼Ë´N¥i¥H±o¨ì¥H¿Ã¹õ¥ª¤W¨¤¬°­ìÂIªºÅã¥Ü°Ï°ìªº¯x§Î¤j¤p¡C¦pªG fLarger ¬° TRUE¡A¨t²Î«h·|¥[¤W¶µ¥Ø¤Î®Ø½uªº¤j¤p¡A³oºØ±¡§Î¤£±`¥Î¤]¥s¤£²Å¦X§Ú­Ìªº»Ý¨D¡C¦³¤FÅã¥Ü°Ï°ì¬Û¹ï©ó¿Ã¹õ¥ª¤W¨¤ªº¦ì¸m¡A¥u­n¦A©I¥s MoveWindow ´N¥i¥H²¾°Ê¹ï¸Ü²°¨ì¾A·í¦ì¸m¡C

±`¥Îªº¼ÐÅÒ±±¨î¶µ°T®§

¹ï¼ÐÅÒ±±¨î¶µµo¥Xªº°T®§¡A°£¤F TCM_INSERTITEM ©M TCM_ADJUSTRECT ¤§¥~¡AÁÙ¦³«Ü¦h¨ä¥L°T®§¡A©³¤U¤¶²Ð´XºØ±`¥Îªº¡G

°T®§wParam lParam»¡©ú
TCM_ADJUSTRECTfLarger lpRect½Õ¾ã¯x§Î¤j¤p¡A¨Ï¨ä¾A¦XÅã¥Ü°Ï°ì¡ClpRcet ¬O«ü¦V RECT µ²ºcÅé¦ì§}¡AfLarger ¬O«ü¦p¦ó½Õ¾ã
TCM_DELETEALLITEMS0 0§R°£¼ÐÅÒ±±¨î¶µªº©Ò¦³¶µ¥Ø¡AwParam »P lParam ¥²¶·§¡¬° 0
TCM_DELETEITEMiItem 0§R°£¬Y­Ó¶µ¥Ø¡AiItem ¬O­n§R°£¶µ¥Øªº¯Á¤Þ­È¡C°²¦p§R°£ªº¶µ¥Ø¤§«áÁÙ¦³¶µ¥Ø¡A¨º»ò¦b³Q§R°£ªº¶µ¥Ø«áªº¨C­Ó¶µ¥Øªº¯Á¤Þ­È·|´î¤@¡C
TCM_GETCURSEL0 0¨ú±o²{¦b³Q¿ï¾Üªº¶µ¥Ø¡C­Y©I¥s¦¨¥\¡Aªð¦^­È¬°¶µ¥Øªº¯Á¤Þ­È¡F­Y¥¢±Ñ¶Ç¦^ -1
TCM_GETIMAGELIST0 0¨ú±o»P¼ÐÅÒ³sµ²ªº¹Ï¤ù²M³æ¥N½X¡A¦pªG©I¥s¦¨¥\¡AEAX ªð¦^ ImageList ¥N½X¡F§_«h EAX ¬° NULL
TCM_GETITEMiItem pitem¨ú±o¼ÐÅÒ±±¨î¶µªº¶µ¥Ø¸ê®Æ¡AiItem ¬O¶µ¥Øªº¯Á¤Þ­È¡Apitem ¬O«ü¦V TCITEM µ²ºcÅé¦ì§}ªº«ü¼Ð¡C¦b©I¥s SendMessage «e¡A¶·«ü©w TCITEM ¦¨­û¤¤ªº mask Äæ¦ì¤Î¬ÛÃö¸ê®Æ¡A¥H«ü©w­n¨ú±o­þ¤@¶µ¸ê®Æ¡C¨Ò¦p­n¨ú±o¶µ¥Øªº¼ÐÅÒ¤å¦r¡Amask ­n¶ñ¤J TCIF_TEXT¡ApszText ¶ñ¤J¦r¦ê¦s©ñ¦ì§}¡AcchTextMax ¶ñ¤JÀò±o´X­Ó¦r¤¸¡A³o¼Ëªð¦^«á pszText ´N·|¦³¼ÐÅÒ¤å¦r¤F
TCM_GETITEMCOUNT0 0¨ú±o¼ÐÅÒªº¶µ¥ØÁ`¼Æ
TCM_GETITEMRECTiItem lpRect¨ú±o¶µ¥Ø¤j¤p¡AiItem ¬O­n¨ú±o¤j¤pªº¶µ¥Ø¯Á¤Þ¡AlpRect ¬O«ü¦V RECT µ²ºcÅé¦ì§}ªº«ü¼Ð¡Aªð¦^«á¦¹ RECT µ²ºcÅé·|¦s¦³¶µ¥Ø¯x§Î¡A¦¹¯x§Î¥H¼ÐÅÒ±±¨î¶µªº¥ª¤W¨¤¬°­ìÂI
TCM_INSERTITEMiItem pitem´¡¤J¤@­Ó¶µ¥Ø¡AiItem ¬O­n´¡¤Jªº¶µ¥Ø¯Á¤Þ¡Apitem ¬O«ü¦V TCITEM µ²ºcÅé¦ì§}ªº«ü¼Ð
TCM_REMOVEIMAGEiImage 0±q¼ÐÅÒ±±¨î¶µªº ImageList ¤¤§R°£¤@­Ó¦ì¤¸¹Ï©Î¹Ï¥Ü¡AiImage ¬O¦b¼ÐÅÒ±±¨î¶µªº ImageList ¤¤¡A­n§R°£ªº¦ì¤¸¹Ï©Î¹Ï¥Ü¯Á¤Þ­È
TCM_SETCURSELiItem 0³]©w³Q¿ï¾Üªº¶µ¥Ø¡C­Y©I¥s¦¨¥\¡Aªð¦^­È¬°«e¤@­Ó³Q¿ï¾Ü¶µ¥Øªº¯Á¤Þ­È¡F­Y¥¢±Ñ¶Ç¦^ -1
TCM_SETIMAGELIST0 himl³]©w¼ÐÅÒ±±¨î¶µªº ImageList¡Ahiml ´N¬O ImageList ¥N½X
TCM_SETITEMiItem pitem³]©wÅÒ±±¨î¶µªº¶µ¥Ø¸ê®Æ¡AiItem ¬O­n³]©wªº¶µ¥Ø¯Á¤Þ¡Apitem ¬O«ü¦V TCITEM µ²ºcÅé¦ì§}ªº«ü¼Ð¡A¨Ï¥Î¤èªk¸ò TCM_GETITEM ®t¤£¦h
TCM_SETITEMSIZE0 cy_cx¦b¨ã¦³ TCS_OWNERDRAWFIXED ©Î TCS_FIXEDWIDTH ­·®æªº¼ÐÅÒ³]©w¼e«×»P°ª«×¡AlParam ¤¤ªº§C¦r²Õ¬°¼e«×¡A°ª¦r²Õ¬°°ª«×
TCM_SETPADDING0 cy_cx¦b¶µ¥Ø¥|©P³]©wªÅ¥Õ°Ï°ì¡AlParam ¤¤ªº§C¦r²Õ¬°ªÅ¥Õ¼e«×¡A°ª¦r²Õ¬°ªÅ¥Õ°ª«×

ÁÙ¦³¤@¨Ç¥i¥Hµo°eµ¹¼ÐÅÒ±±¨î¶µªº°T®§¨Ã¨S¦³¦C¦b¤Wªí¡A½Ð¦Û¦æ°Ñ¦Ò MSDN¡C

¼ÐÅÒ±±¨î¶µ±`¥Îªº³qª¾½X

·í¨Ï¥ÎªÌ¹ï¼ÐÅÒ±±¨î¶µ°µ¬Y¨Ç°Ê§@¡A¨Ò¦p¨Ï¥ÎªÌ¿ï¾Ü¥t¤@­Ó¶µ¥Ø¡B¨Ï¥ÎªÌ¦b¶µ¥Ø¤W«ö¤@¦¸·Æ¹«¥ªÁä¡B¨Ï¥ÎªÌ¦b¶µ¥Ø¤W³s«ö¨â¦¸·Æ¹«¥ªÁäµ¥µ¥¡A¼ÐÅÒ±±¨î¶µ³£·|µo¥X WM_NOTIFY °T®§µ¹¤÷µøµ¡¡C¦Ó WM_NOTIFY °T®§¤¤¡AlParam °Ñ¼Æ¬°¤@«ü¼Ð¡A©Ò«ü¦ì§}¬°¬Y­Óµ²ºcÅé¡A¦¹µ²ºcÅ骺²Ä¤@­Ó¦¨­û¬O NMHDR¡ANMHDR ¦¨­û¤¤ªº code ¬°³qª¾½X ( notifications )¡C³qª¾½X°O¿ýµÛ¨Ï¥ÎªÌ¹ï¼ÐÅÒ±±¨î¶µ©Ò°µªº°Ê§@¡Aµøµ¡¨ç¦¡À³¸Ó¹ï¬Y¨Ç³qª¾½X°µ¾A·íªº¦^À³¡C±`¨£ªº³qª¾½X¦p¤U¡G

³qª¾½X»¡©ú
TCN_FOCUSCHANGE¨ã¦³ TCS_BUTTONS ­·®æªº¼ÐÅÒ±±¨î¶µ¿é¤JµJÂI§ïÅܤF
TCN_KEYDOWNÁä½L¤Wªº«öÁä³QÀ£¤U¡A¦¹®É WM_NOTIFY ªº lParam ¬°¤@­Ó«ü¼Ð¡A«ü¦V NMTCKEYDOWN µ²ºcÅé¡A¦¹µ²ºcÅ馨­û¬°
NMTCKEYDOWN     STRUCT
hdr             NMHDR   <?>
wVKey           WORD    ?
flags           UINT    ?
NMTCKEYDOWN     ENDS
NMTCKEYDOWN µ²ºcÅ骺²Ä¤@­Ó¦¨­û´N¬O NMHDR µ²ºcÅé¡A¦b³o¤§«á¦A²K¥[¨â­Ó¦¨­û¡A¤@­Ó¬OµêÀÀÁä½X¡A¥ç§Y¨Ï¥ÎªÌ«ö¤Uªº«öÁä¡F¥t¤@­Ó¬O flags °Ñ¼Æ¡A¨ä·N¸q»P WM_KEYDOWN ªº lParam ¬Û¦P¡C
TCN_SELCHANGE³qª¾¤÷µøµ¡¡A³Q¿ï©wªº¶µ¥Ø¤w¸g§ïÅܤF¡A¥ç§Y·í¨Ï¥ÎªÌ¿ï¾Ü¤£¦P¶µ¥Ø«á¡A¨t²Î§¹¥þ³Æ§´¸ê®Æ¡A§ó·s¦nµe­±¤§«á¡A¤~·|µo¥X TCN_SELCHANGE¡C
TCN_SELCHANGING³qª¾¤÷µøµ¡¡A³Q¿ï©wªº¶µ¥Ø§Y±N§ïÅܤF¡C

¹Ï¤ù²M³æ ( ImageList )

ImageList ¥i½¦¨¡u¹Ï¤ù²M³æ¡v©Î¡u¼v¹³²M³æ¡v¡A¥¦¬O¤@­ÓÀx¦s¤j¤p¬Û¦P¡BÃC¦â²`«×¬Û¦PªºÂI°}¹Ï©Î¹Ï¥Üªº²Õ¥ó¡A¨C­Ó¹Ï¤ù³£¦³¤£¦Pªº¡u¯Á¤Þ­È¡v¡A§Ú­Ì¥H¯Á¤Þ­È°Ï§O³o¨ÇÄݩʬۦPªº¹Ï¤ù¡C±z¤]¥i¥H§â¹Ï¤ù²M³æ·Q¹³¦¨¤@­Ó±Mªù¦s©ñ¹Ï¤ùªº¡u®e¾¹¡v¡A¦b³o­Ó¡u®e¾¹¡vùØ­±ªº¹Ï¤ù¤j¤p»PÃC¦â¼Æ³£¬Û¦P¡C¬Y¨Ç±±¨î¶µ¥i¥HÅã¥Ü³\¦h¹Ï¤ù¡A¨Ò¦p¼ÐÅÒ±±¨î¶µªº¨C­Ó¶µ¥Ø¤W¥i¥HÅã¥Ü¤£¦Pªº¹Ï¥Ü¡A¨ä¥LÁÙ¦³ list-view¡Btree-view µ¥±±¨î¶µ¤]¥i¥H¡C³o¨Ç±±¨î¶µ³£¥i¥H«ü©w¬Y­Ó¹Ï¤ù²M³æ¡A©ÎªÌ»¡¥i¥H«ü©w¹Ï¤ù²M³æ»P³o¨Ç±±¨î¶µ³sµ²¦b¤@°_¡C³sµ²¤§«á¡A·í³o¨Ç±±¨î¶µ­nÅã¥Ü¹Ï¤ù®É¡A¥i¥H¦b¹Ï¤ù²M³æ¤¤¡A¥H¯Á¤Þ­È¬D¿ï¡A´N¯à°÷«Ü®e©öªºÅã¥Ü¹Ï¤ù¡C§Ú­Ì³q±`©I¥s ImageList_Create «Ø¥ß·sªº¹Ï¤ù²M³æ¡G

HIMAGELIST ImageList_Create (
    int     cx,
    int     cy,
    UINT    flags,
    int     cInitial,
    int     cGrow
);

¦pªG©I¥s¦¨¥\¡A¨t²Î·|¶Ç¦^¹Ï¤ù²M³æ¥N½X¡A¥H«á¹ï³o­Ó·s«Ø¥ßªº¹Ï¤ù²M³æ¶i¦æ§R°£©Î·s¼W¬Y­Ó¹Ï¤ù¡A³£¬O¥H³o­Ó¥N½X¶i¦æ¾Þ§@¡A»PÀÉ®×¥N½XªºÆ[©À¬Û¦P¡F­Y©I¥s¥¢±Ñ¡A¶Ç¦^ NULL¡Ccx¡Bcy ¬O¹Ï¤ùªº¼e«×»P°ª«×¡Aflags ¬O¹Ï¤ùÄÝ©Ê¡A¥i¥H¬O ILC_COLOR4¡BILC_COLOR8¡BILC_COLOR16¡BILC_COLOR24¡BILC_COLOR32¡A¤À§Oªí¥Ü 16 ¦â¡B256 ¦â¡B65536 ¦â¡B224 ¦â¡B232 ¦â¡Cflags ¤]¥i¥H¬O ILC_COLOR¡Aªí¥Ü¥H¤º©wªºÃC¦â«Ø¥ß¹Ï¤ù²M³æ¡A¤@¯ë¦Ó¨¥¤º©wªºÃC¦â¬O ILC_COLOR4¡A¦ý¦³¨Ç«¬Åã¥Ü¾¹¬O ILC_COLORDDB¡CILC_COLOR ¤]¥i¥H¬O ILC_COLORDDB¡Aªí¥Ü«Ø¥ßªº¹Ï¤ù²M³æ¦s©ñ»P¸Ë¸m¬ÛÃö ( device-dependent bitmap ) ªºÂI°}¹Ï¡CILC_COLOR ¤]¥i¥H¬O ILC_MASK¡Aªí¥Ü¹Ï¤ù²M³æ°£¤F§âµ{¦¡³]­p®v¥[¤Jªº¹Ï¤ù¦s¤J¤§¥~¡AÁÙ·|¦b¹Ï¤ù²M³æ¤¤¡A¬°¨C±i¹Ï¤ù«Ø¥ß¾B¸n¹Ï¡A¨ä¹ê´N¬O¤@±i¶Â¥Õ¦ì¤¸¹Ï¡AÅã¥Üªº®É­Ô¥Î©ó¿ï¾Ü©Ê³z¹L³o±i¦ì¤¸¹ÏªºÃC¦â¡A¥Õ¦â°Ï°ìÅã¥Ü¡A¶Â¦â°Ï°ì¤£Åã¥Ü¡C¦b COMCTL32.DLL 6.0 ª©©Î¥H«áªºª©¥»¡Aflags ¤]¥i¥H¬O ILC_MIRROR¡Aªí¥Ü¹Ï¤ù·|¥ª¥k¤¬´«¡A¥H¾A¥Î©ó§Æ§B¨Ó»Pªü©Ô§B»y¨t¡CcInitial ¬Oªí¥Ü¦b«Ø¥ß¹Ï¤ù²M³æ®É¡A¹w¯dªº¹Ï¤ù¼Æ¡CcGrow ¬O«ü¦pªG­n¼W¥[¹Ï¤ù®É¡A¨C¦¸¼W¥[ªº±i¼Æ¡C

­n¦b¹Ï¤ù²M³æ¤¤¥[¤J¦ì¤¸¹Ï¡A¥i¥H©I¥s ImageList_Add¡A¨ä­ì«¬¬°¡G

int ImageList_Add (
    HIMAGELIST himl,
    HBITMAP hbmImage,
    HBITMAP hbmMask
);

himl ¬O¹Ï¤ù²M³æ¥N½X¡Aªí¥Ü­n§â¦ì¤¸¹Ï²K¥[¦b­þ­Ó¹Ï¤ù²M³æ¤¤¡ChbmImage ©M hbmMask ¤À§O¬O¦ì¤¸¹Ï¥N½X»P¾B¸n¹Ï¥N½X¡A¦pªG«Ø¥ßÀɮײM³æ®É¡A¨S¦³³]©w ILC_MASK¡AhbmMask ³]¬° NULL¡C¦pªG¦¨¥\¦a²K¥[¹Ï¤ù¡A¶Ç¦^¦ì¤¸¹Ïªº¯Á¤Þ­È¡A¦pªG¥¢±Ñ¶Ç¦^ 0¡C§â¦ì¤¸¹Ï¥[¤J¨ì¹Ï¤ù²M³æ¤§«á¡A¨t²Î´N¤w¸g¦b¹Ï¤ù²M³æùØ«þ¨©¤@¥÷¦ì¤¸¹Ï¡A©Ò¥H­ì¨Óªº¦ì¤¸¹Ï¦pªG¤£¦A»Ý­n¡A´N¥i¥H¥Î DeleteObject API §R°£¡A¤£·|¼vÅT¦b¹Ï¤ù²M³æùتº¦ì¤¸¹Ï¡C

¦pªG­n¦b¹Ï¤ù²M³æ¤¤²K¥[¹Ï¥Ü¡A¤£¯à©I¥s ImageList_Add¡A¦Ó¥²¶·©I¥s ImageList_ReplaceIcon¡CImageList_ReplaceIcon ªº­ì«¬¦p¤U¡G

int ImageList_ReplaceIcon ( 
    HIMAGELIST himl,
    int i,
    HICON hicon
);

ImageList_ReplaceIcon ¥i¥H§â himl ¹Ï¤ù²M³æ¤¤ªº²Ä i ­Ó¯Á¤Þ­Èªº¹Ï¤ù¨ú¥N¦¨¬° hicon ©Ò¥Nªíªº¹Ï¥Ü¡C¦pªG¬O¤@­Ó­è«Ø¥ß¦nªº¹Ï¤ù²M³æ¡A¨º»òùØ­±´N·|³s¤@±i¹Ï¤ù¤]¨S¦³¡A¦pªG³o®É­Ô¥H¯Á¤Þ­È¬° -1¡A©I¥s ImageList_ReplaceIcon¡A¨º»ò ImageList_ReplaceIcon ·|¦b himl ¹Ï¤ù²M³æ¤¤²K¥[ hicon ©Ò¥Nªíªº¹Ï¥Ü©Î´å¼Ð¡CImageList_ReplaceIcon ¦pªG¦¨¥\¦aªð¦^¡Aªð¦^­È¬O¯Á¤Þ­È¡A­Y¥¢±Ñ¡Aªð¦^­È¬O 0¡C

¦b¼ÐÅÒ±±¨î¶µ¤¤«ö Tab Áä

²³©Ò¬Òª¾¡A¦b¹ï¸Ü²°¤¤¡A¨Ï¥ÎªÌ¥i¥H«ö¤U Tab Áä¡A¨Ï¹ï¸Ü²°¤¤ªº¡u«öÁä¡v¡B¡u½s¿è®Ø¡v¡K¡Kµ¥¨ã¦³ WS_TABSTOP ­·®æªº±±¨î¶µ½ü¬yÀò±oÁä½L¿é¤JµJÂI¡C¦ý¬O¦b¼ÐÅÒ±±¨î¶µùتºÅã¥Ü°Ï°ì¡A¬O¤@­Ó­Ó§t¦³³\¦h±±¨î¶µªº¹ï¸Ü²°¡A³o¨Ç¹ï¸Ü²°§¡¬°¼ÐÅÒ±±¨î¶µªº¤lµøµ¡¡C¤]´N¬O»¡¡A¦b¹ï¸Ü²°ùتº±±¨î¶µÅܦ¨¼ÐÅÒ±±¨î¶µªº¡u®]¡vµøµ¡¤F¡C¤]´N¬O»¡¡A¤@¯ë­·®æµLªk¨Ï¼ÐÅÒ¤º¹ï¸Ü²°ªº¤l±±¨î¶µ¡A¥H³sÄò«ö TAB Á䪺¤è¦¡Àò±o¿é¤JµJÂI¡C

¨º¸Ó«ç»ò¿ì©O¡H¥i¥HÂǧU WS_EX_CONTROLPARENT ©µ¦ù­·®æ¡C¨ã¦³ WS_EX_CONTROLPARENT ©µ¦ù­·®æªºµøµ¡¡A¯à¦b¨Ï¥ÎªÌ«ö¤U TAB Áä®É¡A¨Ï¨ä¤lµøµ¡¤]¯à½ü¬yÀò±o¿é¤JµJÂI¡C


½d¨Ò

¤p¤ì°¸¼g¤F³o»ò¦h¡AŪªÌ¤]¬Ý¤F³o»ò¦h¡A¨Ó­ÓÁ`¾ã²z¤]¤£¿ù¡I±z­Y±`¬Ý¹q¼v¡A¥i¯à·|¹J¤W¦r¹õ©M¼v¹³µLªk¹ï¤W¡A³o®É´N¥²¶·½Õ¾ã¦r¹õÀɪº®É¶¡¤F¡C°²³]¦³¤@­Óµ{¦¡¡A¥¦¥i¥H½Õ¾ã¹q¼v¦r¹õÀɪº®É¶¡¡A©ÎªÌ±N¨â­Ó¦r¹õÀɦX¨Ö ( ¦pªG±z·Q¬Ý¤¤­^¤å¹ï·Ó )¡A°õ¦æµe­±¦p¤U¡G

¦b¥D¹ï¸Ü²°¤¤¦³¤@­Ó¼ÐÅÒ±±¨î¶µ¡A¦Ó³o­Ó¼ÐÅÒ±±¨î¶µ¨ã¦³¤T­Ó¶µ¥Ø¡A¡u®É¶¡½Õ¾ã¡v¡B¡u¦r¹õÀɦX¨Ö¡v¡B¡u»¡©ú¡v¡C³o¤T­Ó¶µ¥Ø¤À§O¦³¤T­ÓµL¼ÐÃDªº«D¼Ò¦¡¹ï¸Ü²°«ê¦n¶ñº¡¨äÅã¥Ü°Ï°ì¡C¨º§Ú­Ì¥ý¨Ó¬Ý¬Ý¸ê·½´y­zÀɤ¤ªº¹ï¸Ü²°­±ªOÀ³¸Ó«ç»ò©w¸q¡G

Subrip           DIALOG  60,20,560,350
STYLE            WS_POPUP|WS_VISIBLE|WS_CAPTION|WS_SYSMENU
CAPTION          "Subrip ¦r¹õ¤u¨ã"
FONT             8,"MS Sans Serif"
{
 CONTROL         "",    IDC_TAB, "SysTabControl32",WS_CHILD|TCS_TABS,5,5,537,313,WS_EX_CONTROLPARENT
 PUSHBUTTON      "Â÷¶}",IDC_EXIT,437,324,100, 20
}

TC_AdjTime       DIALOG  0,0,100,200
EXSTYLE          WS_EX_CONTROLPARENT
STYLE            WS_CHILD
FONT             8,"MS Sans Serif"
{
 ¦¹³B¶ñ¤J²Ä¤@­Ó¶µ¥Ø¤¤ªº±±¨î¶µ
}

TC_Merge        DIALOG  0,0,100,200
EXSTYLE         WS_EX_CONTROLPARENT
STYLE           WS_CHILD
FONT            8,"MS Sans Serif"
{
 ¦¹³B¶ñ¤J²Ä¤G­Ó¶µ¥Ø¤¤ªº±±¨î¶µ
}

TC_Help         DIALOG  0,0,100,200
STYLE           WS_CHILD
FONT            8,"MS Sans Serif"
{
 ¦¹³B¶ñ¤J²Ä¤T­Ó¶µ¥Ø¤¤ªº±±¨î¶µ
}

Subrip           ICON            SRT.ICO
Merge            ICON            M.ICO
Adjust           ICON            A.ICO
Help             ICON            H.ICO

¤p¤ì°¸§â¥D¹ï¸Ü²°©R¦W¬°¡uSubrip¡v¡A¥D¹ï¸Ü²°ùئ³¨â­Ó±±¨î¶µ¡A¤À§O¬O¤@­Ó¼ÐÅÒ±±¨î¶µ»P¤@­Ó«ö¶s¡C¼ÐÅÒ±±¨î¶µ¤£¶·¼ÐÃD¡A©Ò¥H¥H¡u""¡vªí¥Ü¡A¦¹¥~¥¦Á٨㦳 WS_EX_CONTROLPARENT ©µ¦ù­·®æ¡A¥H«K¨Ï¨ä¤lµøµ¡¤]¦b¨Ï¥ÎªÌ«ö¤U TAB Áä®ÉÀò±o¿é¤JµJÂI¡C

¦¹¼ÐÅÒ±±¨î¶µ¦³¤T­Ó¶µ¥Ø¡A¥ç§Y¦³¤T­ÓÅã¥Ü°Ï°ì¡A¤À§O¥Ñ¤T­Ó«D¼Ò¦¡¹ï¸Ü²°¶ñº¡¡A¤À§O©R¦W¬°¡uTC_AdjTime¡v¡B¡uTC_Merge¡v¡B¡uTC_Help¡v¡C³o¤T­Ó«D¼Ò¦¡¹ï¸Ü²°ªº¦ì¸m¡B¤j¤p¦b«Ø¥ß«á·|¥Ñµ{¦¡­×§ï¨ì«ê¦n¶ñº¡¼ÐÅÒªºÅã¥Ü°Ï°ì¡A¦]¦¹¦b¹ï¸Ü²°­±ªO¤¤ªº¼Æ­È¬OÀH«K¶Ã¼gªº¡A¨Ã¤£·|¼vÅTµ²ªG¡C¥t¥~¡A½Ðª`·N¡A¡uTC_AdjTime¡v¡B¡uTC_Merge¡v³o¨â­Ó¼ÐÅÒ±±¨î¶µªº¤lµøµ¡³£¨ã¦³¡uWS_EX_CONTROLPARENT¡v¡A¦Ó¡uTC_Help¡v«h¤£¨ã¦¹©µ¦ù­·®æ¡A³o¬O¦]¬°«áªÌ¶È§t¤@­ÓÀRºA±±¥ó¡A®Ú¥»¤£¶·¿é¤JµJÂI¡C©³¤U¬Ý¬Ý³¡¥÷­ì©l½X¡G

                OPTION  CASEMAP:NONE
                .586
                .MODEL  FLAT,STDCALL

INCLUDE         WINDOWS.INC
INCLUDE         COMCTL32.INC
INCLUDELIB      COMCTL32.LIB
;*******************************************************************************
.CONST
szDlgTemplate   BYTE    'Subrip',0
szTabAdjTime    BYTE    '®É¶¡½Õ¾ã',0
szTabMerge      BYTE    '¦r¹õÀɦX¨Ö',0
szTabHelp       BYTE    '»¡©ú',0
szAdjTimeTemp   BYTE    'TC_AdjTime',0  ;¡u®É¶¡½Õ¾ã¡v¹ï¸Ü²°­±ªO¦WºÙ
szMergeTemp     BYTE    'TC_Merge',0    ;¡u¦r¹õÀɦX¨Ö¡v¹ï¸Ü²°­±ªO¦WºÙ
szHelpTemp      BYTE    'TC_Help',0     ;¡u»¡©ú¡v¹ï¸Ü²°­±ªO¦WºÙ
szAdjIcon       BYTE    'Adjust',0
szMergeIcon     BYTE    'Merge',0
szHelpIcon      BYTE    'Help',0
;*******************************************************************************
.DATA
hInstance       HINSTANCE               ?
hTabCtrl        HANDLE                  ?
hImgLst         HANDLE                  ?
iccex           INITCOMMONCONTROLSEX    <?>
tci             TCITEM                  <?>
rcTab           RECT                    <?>
;*******************************************************************************
.CODE
;-------------------------------------------------------------------------------
    ;¨ä¥L°Æµ{¦¡
;-------------------------------------------------------------------------------
AdjTimeProc     PROC    hDlg:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
    ;¡u®É¶¡½Õ¾ã¡v¹ï¸Ü²°ªºµøµ¡¨ç¦¡
AdjTimeProc     ENDP
;-------------------------------------------------------------------------------
MergeProc       PROC    hDlg:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
    ;¡u¦r¹õÀɦX¨Ö¡v¹ï¸Ü²°ªºµøµ¡¨ç¦¡
MergeProc       ENDP
;-------------------------------------------------------------------------------
HelpProc        PROC    hDlg:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
    ;¡u»¡©ú¡v¹ï¸Ü²°ªºµøµ¡¨ç¦¡
HelpProc        ENDP
;-------------------------------------------------------------------------------
DlgProc         PROC    hDlg:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
                LOCAL   rcMainDlg:RECT                  ;¥D¹ï¸Ü²°­ì¨Ó¦ì¸m
                LOCAL   ptTabDisp:POINT                 ;¼ÐÅÒÅã¥Ü°Ï°ìªº¥ª¤W¨¤¦ì¸m
                LOCAL   cyBtnExit:DWORD                 ;¡uÂ÷¶}¡v«ö¶sªº°ª«×
                LOCAL   rcTabItem,rcBtnExit:RECT        ;¼ÐÅÒ¡BÂ÷¶}«ö¶sªº¦ì¸m
                LOCAL   cxTabDisp,cyTabDisp:DWORD       ;¼ÐÅÒÅã¥Ü°Ï°ìªº¼e«×¡B°ª«×
                LOCAL   cxMainDlg,cyMainDlg:DWORD       ;¥D¹ï¸Ü²°ªº¼e«×¡B°ª«×
.IF uMsg==WM_COMMAND

.ELSEIF uMsg==WM_INITDIALOG
            ;«Ø¥ßImageList
                INVOKE  GetSystemMetrics,SM_CXSMICON    ;¨ú±o¹Ï¥Ü¤j¤p
                INVOKE  ImageList_Create,eax,eax,ILC_COLOR32 or ILC_MASK,3,0
                mov     hImgLst,eax
            ;§â¤T­Ó¹Ï¥Ü¥[¤J¨ì¹Ï¤ù²M³æùØ
                INVOKE  LoadIcon,hInstance,OFFSET szAdjIcon
                INVOKE  ImageList_ReplaceIcon,hImgLst,-1,eax
                INVOKE  LoadIcon,hInstance,OFFSET szMergeIcon
                INVOKE  ImageList_ReplaceIcon,hImgLst,-1,eax
                INVOKE  LoadIcon,hInstance,OFFSET szHelpIcon
                INVOKE  ImageList_ReplaceIcon,hImgLst,-1,eax
            ;³]©w¼ÐÅÒªºImageList
                INVOKE  GetDlgItem,hDlg,IDC_TAB
                mov     hTabCtrl,eax
                INVOKE  SendMessage,eax,TCM_SETIMAGELIST,0,hImgLst
            ;¨ú±o¡u¥D¡v¹ï¸Ü²°¤u§@°Ï¤j¤p
                INVOKE  GetClientRect,hDlg,OFFSET rcDlgClient
            ;¨ú±o¡uÂ÷¶}¡v«ö¶s¤j¤p
                INVOKE  GetDlgItem,hDlg,IDC_EXIT
                mov     ecx,eax
                INVOKE  GetWindowRect,ecx,ADDR rcBtnExit        ;¨ú±o¡uÂ÷¶}¡v¤lµøµ¡ªº¯x§Î¦ì¸m¡A¬Û¹ï©ó¿Ã¹õ®y¼Ð
                mov     edx,rcBtnExit.bottom
                sub     edx,rcBtnExit.top                       ;EDX¡×¡uÂ÷¶}¡v«ö¶sªº°ª«×
                mov     cyBtnExit,edx
            ;¨ú±o¼ÐÅÒ±±¨î¶µ¥N½X¤Î¦b¼ÐÅÒ±±¨î¶µ¤¤´¡¤J¤T­Ó¶µ¥Ø¡A¡u®É¶¡½Õ¾ã¡v¶µ¥Ø¡B¡u¦r¹õÀɦX¨Ö¡v¶µ¥Ø¡B¡u»¡©ú¡v¶µ¥Ø
                mov     tci.imask,TCIF_TEXT or TCIF_IMAGE       ;¶µ¥Ø¤W¥]§t¤å¦r»P¹Ï¥Ü
                mov     tci.pszText,OFFSET szTabAdjTime
                mov     tci.iImage,0
                INVOKE  SendMessage,hTabCtrl,TCM_INSERTITEM,0,OFFSET tci
                mov     tci.pszText,OFFSET szTabMerge
                mov     tci.iImage,1
                INVOKE  SendMessage,hTabCtrl,TCM_INSERTITEM,1,OFFSET tci
                mov     tci.pszText,OFFSET szTabHelp
                mov     tci.iImage,2
                INVOKE  SendMessage,hTabCtrl,TCM_INSERTITEM,2,OFFSET tci
            ;­pºâ¼ÐÅÒ±±¨î¶µ¦ì¸m¤Î¤j¤p
                mov     ecx,rcDlgClient.bottom  ;ECX¡×¡u¦r¹õ¤u¨ã¡v¹ï¸Ü²°ªº¤u§@°Ï°ª«×
                sub     ecx,cyBtnExit           ;´î¥h¡uÂ÷¶}¡v«ö¶sªº°ª«×
                sub     ecx,PADDING*3           ;¦A´î¥h¨âªÌ(¡u¦r¹õ¤u¨ã¡v»P¡uÂ÷¶}¡v)ªºªÅ»Ø
                mov     edx,rcDlgClient.right   ;EDX¡×¡u¦r¹õ¤u¨ã¡v¹ï¸Ü²°ªº¤u§@°Ï¼e«×
                sub     edx,PADDING*2           ;´î¥h¥ª¥k¶¡»Ø
                INVOKE  MoveWindow,hTabCtrl,PADDING,PADDING,edx,ecx,FALSE
                INVOKE  GetWindowRect,hTabCtrl,OFFSET rcTab     ;¨ú±o¡u¼ÐÅÒ¡v¤lµøµ¡ªº¯x§Î¦ì¸m¡A¬Û¹ï©ó¿Ã¹õ®y¼Ð
                mov     edx,rcTab.left
                mov     ecx,rcTab.top
                mov     ptTabDisp.x,edx         ;«O¦s¡u¼ÐÅÒ¡v¤lµøµ¡¥ª¤W¨¤®y¼Ð¡A¦¹®y¼Ð¬Û¹ï©ó¿Ã¹õ®y¼Ð
                mov     ptTabDisp.y,ecx
                INVOKE  SendMessage,hTabCtrl,TCM_ADJUSTRECT,FALSE,OFFSET rcTab
                mov     edx,rcTab.left          ;rcTab¬°¡u¼ÐÅÒ¡v±±¨î¶µÅã¥Ü°Ï°ìªº®y¼Ð¡A¦¹®y¼Ð¬Û¹ï©ó¿Ã¹õ®y¼Ð
                mov     ecx,rcTab.top
                sub     edx,ptTabDisp.x
                sub     ecx,ptTabDisp.y
                mov     ptTabDisp.x,edx         ;(EDX,ECX)¡×¡u¼ÐÅÒ¡v±±¨î¶µÅã¥Ü°Ï°ìªº®y¼Ð¡A¦¹®y¼Ð­ìÂI¬°¼ÐÅÒ±±¥ó¥ª¤W¨¤
                mov     ptTabDisp.y,ecx
            ;«Ø¥ß¡u®É¶¡½Õ¾ã¡v¹ï¸Ü²°
                INVOKE  CreateDialogParam,hInstance,OFFSET szAdjTimeTemp,hTabCtrl,OFFSET AdjTimeProc,0
                mov     hDlgAdjTime,eax
                mov     edx,rcTab.right
                mov     ecx,rcTab.bottom
                sub     edx,rcTab.left
                sub     ecx,rcTab.top
                mov     cxTabDisp,edx           ;EDX¡×¡u¼ÐÅÒ¡v±±¨î¶µÅã¥Ü°Ï°ìªº¼e«×
                mov     cyTabDisp,ecx           ;EDX¡×¡u¼ÐÅÒ¡v±±¨î¶µÅã¥Ü°Ï°ìªº°ª«×
                INVOKE  MoveWindow,eax,ptTabDisp.x,ptTabDisp.y,edx,ecx,FALSE
                INVOKE  ShowWindow,hDlgAdjTime,TRUE
            ;«Ø¥ß¡u¦r¹õÀɦX¨Ö¡v¹ï¸Ü²°
                INVOKE  CreateDialogParam,hInstance,OFFSET szMergeTemp,hTabCtrl,OFFSET MergeProc,0
                mov     hDlgMerge,eax
                INVOKE  MoveWindow,eax,ptTabDisp.x,ptTabDisp.y,cxTabDisp,cyTabDisp,FALSE
                INVOKE  ShowWindow,hDlgMerge,FALSE
            ;«Ø¥ß¡u»¡©ú¡v¹ï¸Ü²°
                INVOKE  CreateDialogParam,hInstance,OFFSET szHelpTemp,hTabCtrl,OFFSET HelpProc,0
                mov     hDlgHelp,eax
                INVOKE  MoveWindow,eax,ptTabDisp.x,ptTabDisp.y,cxTabDisp,cyTabDisp,FALSE
                INVOKE  ShowWindow,hDlgHelp,FALSE

.ELSEIF uMsg==WM_COMMAND
                mov     edx,wParam
                mov     eax,edx
                shr     edx,10h         ;EDX=³qª¾½X
                and     eax,0ffffh      ;EAX=±±¨î¤¸¥óÃѧO½X
    .IF dx==BN_CLICKED
                ;³B²z«ö¶sÀ£¤Uªºµ{¦¡
    .ENDIF

.ELSEIF uMsg==WM_NOTIFY
                mov     eax,wParam
                mov     edx,lParam
                and     eax,0ffffh      ;EAX=±±¨î¤¸¥óÃѧO½X
                mov     edx,[edx+8]     ;EDX=³qª¾½X
    .IF edx==TCN_SELCHANGE
        .IF eax==IDC_TAB
                INVOKE  SendMessage,hTabCtrl,TCM_GETCURSEL,0,0
            .IF eax==0
                INVOKE  ShowWindow,hDlgAdjust,TRUE
                INVOKE  ShowWindow,hDlgMerge,FALSE
                INVOKE  ShowWindow,hDlgHelp,FALSE
            .ELSEIF eax==1
                INVOKE  ShowWindow,hDlgAdjust,FALSE
                INVOKE  ShowWindow,hDlgMerge,TRUE
                INVOKE  ShowWindow,hDlgHelp,FALSE
            .ELSEIF eax==2
                INVOKE  ShowWindow,hDlgAdjust,FALSE
                INVOKE  ShowWindow,hDlgMerge,FALSE
                INVOKE  ShowWindow,hDlgHelp,TRUE
            .ENDIF
        .ENDIF
    .ENDIF

.ELSE       ;¨ä¥L°T®§
                mov     eax,FALSE
                ret
.ENDIF
                mov     eax,TRUE
                ret
DlgProc         ENDP
;-------------------------------------------------------------------------------
START:          mov     iccex.dwSize,SIZEOF INITCOMMONCONTROLSEX
                mov     iccex.dwICC,ICC_TAB_CLASSES
                INVOKE  InitCommonControlsEx,OFFSET iccex
                INVOKE  GetModuleHandle,NULL
                mov     hInstance,eax
                INVOKE  DialogBoxParam,eax,OFFSET szDlgTemplate,NULL,OFFSET DlgProc,NULL
                INVOKE  ExitProcess,eax
;*******************************************************************************
END             START

¤W­±ªº¨Ò¤lùØ¡A·í¨Ï¥ÎªÌ¿ï©w¤£¦Pªº¼ÐÅÒ¶µ¥Ø®É¡A§Q¥Î ShowWindow ¨ÓÅã¥Ü³Q¿ï©w¶µ¥Ø¤ºªº«D¼Ò¦¡¹ï¸Ü²°¡A¨Ã¥B¨Ï¨ä¥L¹ï¸Ü²°¤£Åã¥Ü¡C±z¥i¥H¦b WM_NOTIFY °T®§¤¤¨£¨ì¡C°²¦p¼ÐÅÒ±±¨î¶µªº¶µ¥Ø«Ü¦hªº¸Ü¡A´N¤£¯à¹³¤W­±¥H¦CÁ|¤è¦¡¤@¤@³B²z¡A³o®É¥i¥H§â¨º¨Ç«D¼Ò¦¡¹ï¸Ü²°¥N½XÅܦ¨¤@­Ó°}¦C¡A³o¼Ë¥i¥H¤j´T´î¤Öµ{¦¡½X¡C

¦]¬°³o­Ó¨Ò¤lµ{¦¡½X¤Ó¤j¡A©Ò¥H¤p¤ì°¸§â¥¦À£ÁY¦¨¤@­ÓÀɮסA½Ð¨ì³o¨à¤U¸ü¡C¥ý¸ÑÀ£ÁY«á¡A¦A¨Ì¤U­±¤èªk´N¥i¥H»s³y¥X¥i°õ¦æÀÉ¡G

E:\HomePage\SOURCE\Win32\SUBRIP>rc SUBRIP.RC [Enter]

E:\HomePage\SOURCE\Win32\SUBRIP>ml SUBRIP.ASM /link SUBRIP.RES [Enter]
Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997.  All rights reserved.

 Assembling: SUBRIP.ASM
Microsoft (R) Incremental Linker Version 5.12.8078
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

/SUBSYSTEM:WINDOWS
"SUBRIP.obj"
"/OUT:SUBRIP.exe"
"SUBRIP.RES"

E:\HomePage\SOURCE\Win32\SUBRIP>

µù¤@¡G

Windows ¸g¹L³\¦h¦¸§ïª©¡A¨C¦¸§ïª©¬É­±Á`¬O¶V¨Ó¶Vº}«G¡A·íµM¦U±±¨î¶µ ( ¥]§t³q¥Î±±¨î¶µ ) ªº¥~Æ[¤]¦P¼Ëªºµo¥ÍÅܤơC¦Ó³q¥Î±±¨î¶µªº¥~Æ[¡B°T®§µ¥³£¬O¥Ñ COMCTL32.DLL ­t³d³B²z¡A¦]¦¹©³¤U©Ò¤¶²Ðªº´N¬O COMCTL32.DLL ´X¦¸­«­nªºª©¥»ÅܤơJ

  1. 4.00¡J²Ä¤@­Óª©¥»ªº Win32 §@·~¨t²Î¬O Windows 95/Windows NT 4.0¡A©Ò¨Ï¥Îªº COMCTL32.DLL ª©¥»¬O 4.00¡C¨ä¬É­±·íµM¬O¤ñ·íªì Windows 3.x ¦n¬Ý±o¦h¡C
  2. 4.70¡J­ìª©ªº Windows 95/NT 4.0 ¨Ã¨S¦³ªþ Internet Explorer ( ²ºÙ IE )¡A¦pªG±z·Q³s¤Wºô»Úºô¸ô¡A¥²¶·¦A¦w¸Ë Internet Explorer ¥H¤Î¼·±µµ{¦¡¡A±z¥i¥H§K¶O¤U¸ü IE 1.0¡ã3.0¡CCOMCTL32.DLL 4.70 ª©¥»¬OÀH Internet Exploere 3.0 ¦w¸Ëªº¡A©Ò¥H¦pªG±z¦w¸Ë¦n IE 3.x «á¡A¦P®É¦w¸Ë¦n COMCTL32.DLL 4.70 ª©¤F¡C
  3. 4.71¡JCOMCTL32.DLL 4.71 ª©¬OÀH IE 4.0 ¦w¸Ëªº¡A©Ò¥H¦pªG±z¦w¸Ë¦n IE 4.0 «á¡A¦P®É¦w¸Ë¦n COMCTL32.DLL 4.71 ª©¤F¡C
  4. 4.72¡JWindows 98 ²Ä¤@ª©ªº COMCTL32.DLL ¬O 4.72 ª©ªº¡C©ÎªÌ¬O¦w¸Ë¦n IE 4.01 «á¡A¤]¯à¤É¯Å¨ì 4.72 ª©ªº COMCTL32.DLL¡C
  5. 5.80¡JWindows 98 ²Ä¤Gª©ªº COMCTL32.DLL ¬O 5.80 ª©ªº¡A©Î¦w¸Ë¦n IE 5.0¡C
  6. 5.81¡JWindows 2000/Me ªº COMCTL32.DLL ¬O 5.81 ª©ªº¡A©Î¦w¸Ë¦n IE 5.01¡B5.5¡B6.0¡C
  7. 6.00¡JWindows XP ªº COMCTL32.DLL ¬O 6.00 ª©ªº¡C
  8. 6.10¡JWindows Vista/7 ªº COMCTL32.DLL ¬O 6.10 ª©ªº¡C

¦³Ãö COMCTL32.DLL §ó¸Ô²Óªºª©¥»¤Îºt¶i¡A¥i¥H°Ñ¾\ Geoff Chappell - Software Analyst¡C

µù¤G¡G

WM_KEYDOWN °T®§ªº lParam °Ñ¼Æªº·N¸q¦p¤U¡G

¦ì¤¸»¡©ú
0¡ã15 ¦ì¤¸¬°­«½Æ¦¸¼Æ
16¡ã23 ¦ì¤¸±½´y½X
24 ¦ì¤¸¬O§_¬°ÂX¥R«öÁä¡A¦pªG¬Oªº¸Ü¡A¦¹¦ì¤¸¬° 1¡F§_«h¬° 0¡CÂX¥R«öÁä¥]¬A¥k¤âÃ䪺 Alt Áä¡BCtrl Áäµ¥µ¥¡C
25¡ã28 ¦ì¤¸¥¼¨Ï¥Î
29 ¦ì¤¸0
30 ¦ì¤¸²{¦b«öÁ䪺ª¬ºA¡C·í WM_KEYDOWN ³Q°e¥X¤§«e¡A­Y«öÁ䤴³QÀ£¤U¡A¦¹¦ì¤¸¬° 1¡F§_«h¬° 0¡C
31 ¦ì¤¸0

¨ì²Ä¤G¤Q³¹¡A ¦^¨ì­º­¶¡A ¨ì²Ä¤G¤Q¤G³¹