¤¤¤å§â List View ±±¨î¶µÂ½Ä¶¦¨¡u²M³æÀ˵ø¡v¡A¥¦¬O¤@Ó¥i¥H¥]§t³\¦h¡u¶µ¥Ø¡v( item ) ªº³q¥Î±±¨î¶µ¡A³o¨Ç¶µ¥Ø¥i¥H¨Ñ¨Ï¥ÎªÌ¬D¿ï¡C¤U±ªº¤»±i¹Ï¬O¦P¤@Ó§t¦³ 18 Ó¶µ¥Øªº²M³æÀ˵ø±±¨î¶µ¦b¤£¦PÅã¥Ü¤è¦¡ªºµe±¡CWindows 9x/Me ´£¨Ñ¥|ºØÅã¥Ü¤è¦¡ ( view type )¡Gicon view¡Bdetails view ( ¤]¥s report view )¡Bsmall icon view¡Blist view ¡A¦Ó Windows XP ´£¨Ñ¤@ºØ·sªºÅã¥Ü¤è¦¡¡Atile view¡C
¹Ï¤W¤èªº¥ª¹ÏÅã¥Ü¤è¦¡ºÙ¬°¡uicon view¡v¡A¨CÓ¶µ¥Ø¶È¶ÈÅã¥Ü¹Ï¥Ü¤Î¶µ¥Ø¦WºÙ¡C¹Ï¤W¤èªº¤¤¹ÏÅã¥Ü¤è¦¡ºÙ¬°¡udetails view¡v¡A¤]¥s report view¡A³oºØÅã¥Ü¤è¦¡¯àÅã¥Ü³Ì¸ÔºÉ¸ê®Æ¡A¨C¤@¦C ( ¥Ñ¥ª¦Ó¥k ) ªº³Ì¥ªÃä ( ²Ä 0 Äæ ) ºÙ¬°¡u¶µ¥Ø¡v¡A¨ä¥k¥i¯à¥]§t¼ÆÓ¡u¤l¶µ¥Ø¡v¡A³o¨Ç¤l¶µ¥Ø³£¦b¤£¦PªºÄæ¦ì±Æ¦C¾ã»ô¡A¦p¦P¤@±iªí®æ¡C²Ä 0 ÓÄæ¬OÅã¥Ü¶µ¥Ø¦WºÙ¡A¤]¥u¦³²Ä 0 ÓÄæ¦ì¥i¥HÅã¥Ü¹Ï¥Ü¡F²Ä¤@ÓÄæ¦ì¥H«áªººÙ¬°¤l¶µ¥Ø¡A¶È¯àÅã¥Ü¤l¶µ¥Ø¦WºÙ¡C¹Ï¤W¤èªº¥k¹ÏÅã¥Ü¤è¦¡ºÙ¬°¡usmall icon view¡v¨CÓ¶µ¥Ø¶È¶ÈÅã¥Ü¤p¹Ï¥Ü¤Î¶µ¥Ø¦WºÙ¡C¹Ï¤U¤èªº¥ª¹ÏÅã¥Ü¤è¦¡ºÙ¬°¡ulist view¡v¡A¤]¶È¶ÈÅã¥Ü¤p¹Ï¥Ü¤Î¶µ¥Ø¦WºÙ¡C¹Ï¤U¤èªº¤¤¹ÏÅã¥Ü¤è¦¡ºÙ¬°¡utile view¡v¡A¥¦¬O¥H¤j¹Ï¥ÜÅã¥Ü¡A¦P®É®ÇÃä¥i¥H¦AÅã¥Ü´XÓÄæ¦ìªº¸ê®Æ¡C
¡@¡@
¡@¡@
¨ì¤F XP ªº®É¥N¡A¡u²M³æÀ˵ø¡v±±¨î¶µ¤]¥i¥H¥Î¡u¸s²Õ¡v¼Ò¦¡Åã¥Ü¡A¦p¹Ï¤U¤èªº¥k¹Ï¬O¡usmall icon view¡vÅã¥Ü¤è¦¡®Éªº¸s²Õ¼Ò¦¡¡C¦ý¬O¨Ã«D©Ò¦³Åã¥Ü¤è¦¡³£¥i¥H¥H¸s²Õ¼Ò¦¡Åã¥Ü¡A¡ulist view¡v´NµLªk¥H¸s²Õ¼Ò¦¡Åã¥Ü¡A¦Ó¨ä¾l¥|ºØÅã¥Ü¤è¦¡³£¥i¥H¥H¸s²Õ¼Ò¦¡Åã¥Ü¡C
n«Ø¥ß List View ±±¨î¶µ¡A¥²¶·¥ý½T»{ COMCTL32.DLL ¬O§_¸ü¤J¨ì°O¾ÐÅé¡An½T©w³oÂI¥i¥H©I¥s InitCommonControls ©Î InitCommonControlsEx¡A³oÓ¨BÆJ¦b«e¤@³¹¤w¸g±Ôz¹L¤F¡C±µ¤U¨Ó´N¬O«Ø¥ß List View ±±¨î¶µ¡A§ÚÌ¥i¥H¦b¸ê·½´yzÀɤ¤¥[¤J
CONTROL "",IDC_ListView,"SYSListView32", style, x, y, width, height, exStyle
©ÎªÌ¬O¥H¡uSYSListView32¡v¬°Ãþ§O¡A©I¥s CreateWindowEx «Ø¥ß List View ¤lµøµ¡¡C³o¨Ç¨BÆJ¸ò«e±«Ø¥ß¼ÐÅÒ±±¨î¶µ©Î¨ä¥L±±¨î¶µªº¹Lµ{¡A¨ÃµL¤£¦P¡C·í«Ø¥ß¡u²M³æÀ˵ø¡v±±¨î¶µ®É¡A·Q¥H¤W±¤ºØÅã¥Ü¤è¦¡ªº¬Y¤@ºØ¤è¦¡Åã¥Ü¶µ¥Øªº³Z¬¡A¨ä¹ê´N¬O¦b«Ø¥ß¡u²M³æÀ˵ø¡v±±¨î¶µ®É¡A±Ä¥Î¤£¦Pªº·®æ©ÒP¡C¤Uªí´N¬O³o¤ºØÅã¥Ü¤è¦¡©Ò¨Ï¥Îªº·®æ¡C
Åã¥Ü¤è¦¡ view type | ¸ê·½´yzÀÉ ¤¤ªº·®æ |
LVM_SETVIEW °T®§¤¤ªº wParam °Ñ¼Æ |
»¡¡@¡@©ú |
Icon View | LVS_ICON | LV_VIEW_ICON | ¨CÓ¶µ¥Ø¥H¹Ï¥ÜÅã¥Ü¡A¦Ó¤å¦r¼ÐÅÒ ( label ) ¦b¹Ï¥Ü¤U±¡C¨Ï¥ÎªÌ¥i¥H¦b¡u²M³æÀ˵ø¡v±±¨î¶µ¤º©ì°Ê¹Ï¥Ü¡C |
Details View | LVS_REPORT | LV_VIEW_DETAILS | ¤]¥s Report View¡C³Ì¤W±·|¦³Äæ¦ì¦WºÙ¡AÄæ¦ì¦WºÙ©³¤U«h¬O¦UÓ¶µ¥Ø¡A¨C¤@¶µ¥Ø¥H¦Cªí¤è¦¡Åã¥Ü©ó¤@¦C¤¤¡A¦Ó¨CÓ¶µ¥Ø³Ì¥ªÃ䪺¤@¦C¥]§t¹Ï¥Ü¤Î¼ÐÅÒ¤å¦r¡A¦Ó¨ä¥kÃ䪺¨C¤@¦C³£ºÙ¬°¤l¶µ¥Ø ( subitem )¡C³Ì¤W±À³¦³ |
Small Icon View | LVS_SMALLICON | LV_VIEW_SMALLICON | ¨CÓ¶µ¥Ø¥H¤p¹Ï¥ÜÅã¥Ü¡A¦Ó¤å¦r¼ÐÅÒ¦b¤p¹Ï¥Üªº¥kÃä¡C¨Ï¥ÎªÌ¥i¥H©ì°Ê¹Ï¥Ü¨ì¥ô·N¦a¤è¡C |
List View | LVS_LIST | LV_VIEW_LIST | ¨CÓ¶µ¥Ø¥H¤p¹Ï¥ÜÅã¥Ü¡A¦Ó¥B¾ã²z¦¨¤@¦æÅã¥Ü¡C¨Ï¥ÎªÌµLªk©ì°Ê¹Ï¥Ü¡C |
Tile View | ¡@ | LV_VIEW_TILE | ¥u¦³ COMCTL32.DLL 6.0 ª©¥H«á¤~´£¨ÑªºÅã¥Ü¤è¦¡¡C¨CÓ¶µ¥Ø¥H¤j¹Ï¥ÜÅã¥Ü¡A¤å¦r¼ÐÅÒ¦b¹Ï¥Ü¥kÃä¡A¦Ó¤å¦r¼ÐÅÒ©³¤U¥i¯àÁÙ¦³§ó¦hªº¸ê®Æ»¡©ú¡C |
¨Æ¹ê¤W¡A¦b¸ê·½´yzÀɤ¤³]©w¦nªº·®æ¡A¨Ã«D§¹¥þ¤£¯à§ó§ï¡C§ÚÌ¥i¥H³z¹L¨âºØ¤èªk§ïÅÜ¡u²M³æÀ˵ø¡v±±¨î¶µªºÅã¥Ü¤è¦¡¡G¤@¬O¹ï¡u²M³æÀ˵ø¡v±±¨î¶µµo¥X LVM_SETVIEW °T®§¡A¤]´N¬O©I¥s SendMessage API¡C
INVOKE SendMessage,hListView,LVM_SETVIEW,wParam,lParam
³o®ÉÔ LVM_SETVIEW °T®§¤¤ªº wParam °Ñ¼Æ´N¬O¦p¤Wªí©Ò¥Ü¡A¦Ó lParam °Ñ¼Æ¬° 0¡C¨Ò¦pì¥ý¬O¥H List View ¤è¦¡Åã¥Ü¡AnÅÜ§ó¬° Icon View¡A¨º»ò wParam °Ñ¼Æ´N¬O LV_VIEW_ICON¡CTile View ¬O XP ·s¼WªºÅã¥Ü¤è¦¡¡AµLªk¦b¸ê·½´yzÀɤ¤³]©w¡A¦ý¥i³z¹L SendMessage µo¥X±aµÛ LV_VIEW_TILE °Ñ¼Æªº LVM_SETVIEW °T®§§ïÅÜ¡C
¥t¤@ºØ¤èªk¬O§ïÅܵøµ¡ªº·®æ¡CŪªÌÌÀ³¸ÓÁÙ°O±o¡A±±¨î¶µ¨ä¹ê´N¬O¤@ºØµøµ¡¡A§óºë½Tªº»¡ªk¡A¬O¡u¤lµøµ¡¡v¡C©Ò¥H±±¨î¶µ¤]¨ã¦³µøµ¡ªº©Ê½è¡C§ÚÌ¥i¥HÂǥѩI¥s SetWindowLong ¨Ó§ïÅܵøµ¡·®æ¡C¥Ñ©ó§ÚÌ¥u§Æ±æ§ïÅÜ¡u²M³æÀ˵ø¡vªºÅã¥Ü¤è¦¡¡A¦Ó¤£§Æ±æ§ïÅܨä¥L·®æ¡A¦]¦¹³Ì¦n¬O¥ý©I¥s GetWindowLong ¨ú±o²{¦³ªº²M³æÀ˵ø·®æ¡A¦A§ó§ï¨ä¤¤ªºÅã¥Ü¤è¦¡¡CGetWindowLong ªºì«¬¬O¡G
LONG GetWindowLong ( HWND hWnd, int nIndex );
§ÚÌ¥i¥H¸g¥Ñ GetWindowLong API ¨ú±oµøµ¡ªº¸ê®Æ¡A³o¨Ç¸ê®Æ¥]§t¤Fµøµ¡·®æ¡ChWnd ¬O§ÚÌn¨ú±o¸ê®Æªºµøµ¡¥N½X¡AnIndex ¬On¨ú±oªº¸ê®Æ¡A¥i¥H¬O¤U±´XºØ±¡§Î¡G
GetWindowLong ªº nIndex °Ñ¼Æ
nIndex | »¡¡@©ú |
GWL_EXSTYLE | ¨ú±oÂX¥Rªº·®æ¡A¦¹ÂX¥R·®æ¬O©I¥s CreateWindowEx ®É²Ä¤@Ó°Ñ¼Æ dwExStyle ©Ò«ü©wªº¡C |
GWL_STYLE | ¨ú±oµøµ¡·®æ |
GWL_WNDPROC | ¨ú±oµøµ¡¨ç¦¡¦ì§}¡A¨ú±o¦¹¦ì§}«á¡A¥i¥H¥Î CallWindowProc ©I¥s¦¹¦ì§} |
GWL_HINSTANCE | ¨ú±oµøµ¡°õ¦æ¹ê¨Ò |
GWL_HWNDPARENT | ¨ú±o¤÷µøµ¡ªº¥N½X |
GWL_ID | ¨ú±oµøµ¡ÃѧO½X |
GWL_USERDATA | ±o¨ì©Mµøµ¡¬ÛÃöÁpªº 32 ¦ì¤¸¼ÆÈ¡A¨C¤@Óµøµ¡³£¦³¤@Ó¯S¦a¯dµ¹«Ø¥ßµøµ¡ªºµ{¦¡¥Îªº 32 ¦ì¤¸¼ÆÈ |
¦pªG hWnd ¬O¹ï¸Ü²°¡A¨º»ò¤]¥i¥H¨Ï¥Î¤U±ªº¼ÆȨú±o¯S©w¸ê®Æ | |
DWL_DLGPROC | ¨ú±o¹ï¸Ü®Ø¨ç¦¡¦ì§}¡A¨ú±o¦¹¦ì§}«á¡A¥i¥H¥Î CallWindowProc ©I¥s¦¹¦ì§} |
DWL_MSGRESULT | ¨ú±o¹ï¸Ü®Ø¨ç¦¡°T®§³B²zªº¶Ç¦^È |
DWL_USER | ¨ú±oµøµ¡ÃB¥~¨p¦³ªº°T®§¡A¦p«ü¼Ð©Î¥N½X |
SetWindowLong ¥Îªk©M GetWindowLong Ãþ¦ü¡A¥u¬O¥Ñ¨ú±o¸ê®ÆÅܦ¨³]©wµøµ¡ªº¸ê®Æ¡A¨ä쫬¬°¡G
LONG SetWindowLong ( HWND hWnd, int nIndex, LONG dwNewLong );
°Ñ¼Æ hWnd ¬On³]©w¸ê®Æªºµøµ¡¥N½X¡CnIndex ¸ò¤Wªí¡uGetWindowLong ªº nIndex °Ñ¼Æ¡vªº¡unIndex¡vÄæ¦ì¬Û¦P¡A¥u¬O¥Ñ¨ú±o§ï¬°³]©w¡CdwNewLong ¬On·s³]©wªºÈ¡C¦pªG¦¨¥\ªº³]©wµøµ¡¸ê®Æ¡A«h·|¶Ç¦^ì¥ýªºµøµ¡¸ê®Æ¡F¦pªG³]©w¥¢±Ñ¡A«h¶Ç¦^ FALSE¡Cn³]©w¡u²M³æÀ˵ø¡v±±¨î¶µªºÅã¥Ü¤è¦¡¡A¥²»ÝÁÙn¦A¸g¹L´XÓ¨BÆJ¡C©³¤U¥H³]©wÀ˵ø²M³æÅã¥Ü¤è¦¡¬° Icon View ¬°¨Ò¡A¾ãÓ¹Lµ{¦p¤U¡G
INVOKE GetWindowLong,hListView,GWL_STYLE ;¨ú±oì¨Ó·®æ and eax,not LVS_TYPEMASK ;²M°£Åã¥Ü¤è¦¡ or eax,LVS_ICON ;³]©w·sªºÅã¥Ü¤è¦¡ INVOKE SetWindowLong,hListView,GWL_STYLE,eax
°²¦p±z¬d¾\ WINDOWS.INC ÀÉ¡A·|µo²{©³¤Uªº²M³æÀ˵ø±±¨î¶µªº·®æ¡G
LVS_ICON EQU 0000H LVS_REPORT EQU 0001H LVS_SMALLICON EQU 0002H LVS_LIST EQU 0003H LVS_TYPEMASK EQU 0003H
¤W±µ{¦¡½X¤¤³Ì«á¤@Ó¡ALVS_TYPEMASK ¤§È¬° 3¡A¤]´N¬O¤G¶i¦ìªº 11¡A¦Ó¨ä¥L¦³ÃöÅã¥Ü¤è¦¡ªº´XÓ·®æ³£¬O¦b 0¡ã3 ªº½d³ò¤º¡A¤]´N¬O¦û¾Ú²Ä 0¡B1 ¦ì¤¸¡C±z¥i¥H¬d WINDOWS.INC µo²{À˵ø²M³æªº¨ä¥L·®æ«h¬O¦û¾Ú²Ä 2¡ã31 ¦ì¤¸¡C°²³]§Ú̶ȶȷQn§ïÅÜÅã¥Ü¤è¦¡¡A¦Ó¤£§ï¨ä¥L·®æ¡A¨º»ò´N¥u¯à§ïÅÜ 0¡B1 ¦ì¤¸¡C¦]¦¹¨ú±oÀ˵ø²M³æì¨Óªº·®æ«á¡A»P NOT LVS_TYPEMASK ( NOT LVS_TYPEMASK ¤§È¬° 1111 1111 1111 1100 ) §@ AND ¹Bºâ´N¥i¨Ï±o²Ä 0¡B1 ¦ì¤¸³Q²M°£¡A±µµÛ¦A»P·QnÅã¥ÜªºÅã¥Ü¤è¦¡§@ OR ¹Bºâ¡A´N¥i¥H±o¨ì·sªº·®æ¡C
¥Ñ¤W±ªº»¡©ú¡A±zÀ³·í¤wª¾¡A¦b²M³æÀ˵ø±±¨î¶µªºÅã¥Ü¤è¦¡¤¤¡A¯àÅã¥Ü³Ì¦h¸ê®Æªº¬O¡udetails view¡v¡C¥¦Åã¥Ü¤è¦¡¹³¬O¤@Óªí®æ¡A³Ì¤W±¦³¤@¦C¼ÐÃD¡A¼ÐÃD¬O¥Ñ³\¦hÄæ¦ì ( column ) ²Õ¦¨¡C¨C¤@Ó¶µ¥Ø´N¹³¤@µ§¸ê®Æ¤@¼Ë¡A¥Ñ¤W¦V¤U¤@¶µ¤@¶µ¦C¥X©ó²M³æÀ˵ø¤¤¡A¦Ó¨C¤@¶µ¤S¥]§t³\¦hÄæ¦ì¡A²Ä¤@ÓÄæ¦ìºÙ¬°¡u¶µ¥Ø¡v¡A¥H«áªºÄæ¦ì«hºÙ¬°¡u¤l¶µ¥Ø¡v¡C¦]¦¹¡A°²¦p±z³]pªº²M³æÀ˵øn¥H¡udetails view¡vÅã¥Ü¡A¨º»ò´N¥²¶·¥ý³]¸m¼ÐÃD¤Î¦UÄæ¦ì¦WºÙ¡A¤èªk¬O©I¥s SendMessage¡A¹ï²M³æÀ˵øµo¥X LVM_INSERTCOLUMN °T®§¡A¦p¤U±µ{¦¡¤ù¬q¡G
INVOKE SendMessage,hListView,LVM_INSERTCOLUMN,iCol,pcol
hListView ¬On·s²K¥[Äæ¦ìªº²M³æÀ˵ø±±¨î¶µ¥N½X¡FiCol Äæ¦ì½s¸¹¡A¥Ñ¹s¶}©l¡A0 ªí¥Ü¶µ¥Ø¡A1 ¤Î¨ä¥H«áªí¥Ü¤l¶µ¥Ø¡Fpcol ¬O«ü¦V¤@ÓºÙ¬° LV_COLUMN ªºµ²ºcÅé¡A³oÓµ²ºcÅé¤]¥s LVCOLUMN¡CLVCOLUMN µ²ºcÅé¤]¥Î¦b LVM_GETCOLUMN¡BLVM_SETCOLUMN¡BLVM_DELETECOLUMN °T®§¡A¤À§O¨ú±o¡B§ïÅÜ ( ¥ç§Y³]©w )¡B§R¥h²M³æÀ˵ø±±¨î¶µªº¬YÓÄæ¦ì¡CLVCOLUMN ªºÄæ¦ì¦¨û©w¸q¬O¡G
LVCOLUMN STRUCT imask UINT ? fmt DWORD ? lx DWORD ? pszText LPTSTR ? cchTextMax DWORD ? iSubItem DWORD ? iImage DWORD ? iOrder DWORD ? cxMin DWORD ? cxDefault DWORD ? cxIdeal DWORD ? LVCOLUMN ENDS
imask ¬O«ü LVCOLUMN µ²ºcÅ骺þ´X¶µ¦¨û¬O¦³®Äªº¡A¦b MSDN ùØ¡Aimask ºÙ¬° mask¡A¦ý¦b MASM32 ùØ¡Amask ¬O«O¯d¦r¡A¦]¦¹§ï¬° imask¡C¤£¦Pªº imask ¼ÆÈ¡A¥Nªí LVCOLUMN ¤¤ªº¬Y¨ÇÄæ¦ì»Ýn³]©w¡A©ÎªÌ¬Oªð¦^®É¬Y¨ÇÄæ¦ì¤w¶ñ¦n¸ê®Æ¡F´«¥y¸Ü»¡ imask ¤§È¡A·|¼vÅT¬Y¨ÇÄæ¦ì¡A¦p¤Uªí¡J
imask | ¼vÅTÄæ¦ì | »¡¡@¡@¡@©ú |
LVCF_FMT | fmt | fmt Äæ¦ì¬O¥Î¨Ó³]©wÄæ¦ì¤å¦r¦p¦ó¹ï»ô¡C¤£¹L³Ì¥ªÃ䪺Äæ¦ì¤å¦r®æ¦¡¬OµLªk³]©wªº¡A¨ä¾l¤l¶µ¥ØªºÄæ¦ì¤å¦r®æ¦¡«h¥i¥H³]©w¡Cfmt ¥i¥H¬O¤U±´XºØ¼ÆÈ¡G LVCFMT_LEFT¡G¤å¦r¦V¥ª¹ï»ô¡A¨äȬ° 0¡C LVCFMT_RIGHT¡G¤å¦r¦V¥k¹ï»ô¡A¨äȬ° 1¡C LVCFMT_CENTER¡G¤å¦r¦V¤¤¶¡¹ï»ô¡A¨äȬ° 2¡C LVCFMT_JUSTIFYMASK¡G¦¹¼ÆȥΨӾB¸n¤å¦r±Æ¦C¤è¦¡¡A¨äȬ° 3¡A«ê¦n´N¬O LVCFMT_LEFT¡BLVCFMT_RIGHT¡BLVCFMT_CENTER ©Ò¦bªº¦ì¤¸¡C LVCFMT_IMAGE¡G¥Ñ image list ¤¤¬D¤@±i¹Ï¤ùÅã¥Ü¡AnÅã¥Üªº¹Ï¤ù¯Á¤Þȶñ¦b iImage Äæ¦ìùØ¡A©Ò¥H imask ¶·¬° LVCF_IMAGE or LVCF_FMT¡C4.70 ª©¥H«áªº COMCTL32.DLL ¤~¤ä´©¡C LVCFMT_BITMAP_ON_RIGHT¡G4.70 ª©¥H«áªº COMCTL32.DLL ¤~¤ä´©¡A¨Ï¦ì¤¸¹Ï¥X²{¦b¤å¦r¥kÃä¡C LVCFMT_COL_HAS_IMAGES¡GÄæ¦ì¥]§t image list ¤¤ªº¹Ï¤ù¡A4.70 ª©¥H«áªº COMCTL32.DLL ¤~¤ä´©¡C LVCFMT_FIXED_WIDTH¡G¤£¯àÅܧóÄæ¦ì¼e«×¡A©M HDF_FIXEDWIDTH ¬Û¦P¡AXP ©Î COMCTL32.DLL ¦b 6.00 ª©¥H«á¤~¤ä´©¡C LVCFMT_NO_DPI_SCALE¡G LVCFMT_FIXED_RATIO¡G¼e«×·|ÀH°ª«×§ïÅÜ¡AXP ©Î COMCTL32.DLL ¦b 6.00 ª©¥H«á¤~¤ä´©¡C LVCFMT_LINE_BREAK¡GXP ©Î COMCTL32.DLL ¦b 6.00 ª©¥H«á¤~¾A¥Î¡A¥u¥Î©ó Title View Åã¥Ü¤è¦¡®É¡A±j¢¤å¦r¨ì¤U¤@Äæ¦ì¡A»Ý·f°t LVTVIF_EXTENDED ºX¼Ð¡C LVCFMT_FILL¡GXP ©Î COMCTL32.DLL 6.00 ª©¥H«á¤~¾A¥Î¡A¥u¥Î©ó Title View Åã¥Ü¤è¦¡®É¡A¥i¥H¨Ï¾ãÓÄæ¦ì¶ñº¡¤å¦r¡A»Ý·f°t LVTVIF_EXTENDED ºX¼Ð¡C LVCFMT_WRAP¡GXP ©Î COMCTL32.DLL 6.00 ª©¥H«á¤~¾A¥Î¡A¥u¥Î©ó Title View Åã¥Ü¤è¦¡®É¡A¥i¥H¨Ï©µ¦ùªº¤å¦r´«¦æ¡A»Ý·f°t LVTVIF_EXTENDED ºX¼Ð¡C LVCFMT_NO_TITLE¡GXP ©Î COMCTL32.DLL ¦b 6.00 ª©¥H«á¤~¾A¥Î¡A¥u¥Î©ó Title View Åã¥Ü¤è¦¡®É¡A¨ÏÄæ¦ì¤£Åã¥Ü¤å¦r¡A»Ý·f°t LVTVIF_EXTENDED ºX¼Ð¡C LVCFMT_TILE_PLACEMENTMASK¡GXP ©Î COMCTL32.DLL ¦b 6.00 ª©¥H«á¤~¾A¥Î¡A¬Û·í©óµ²¦X LVCFMT_LINE_BREAK »P LVCFMT_FILL¡A»Ý·f°t LVTVIF_EXTENDED ºX¼Ð¡C LVCFMT_SPLITBUTTON¡GXP ¤Î©Î COMCTL32.DLL ¦b 6.00 ª©¥H«á¤~¾A¥Î¡AÄæ¦ì¬O¤@Ó split button¡A»P HDF_SPLITBUTTON ¬Û¦P¡C |
LVCF_WIDTH | lx | lx ¬OÄæ¦ì¼e«×¡A¥H¹Ï¯À ( pixel¡A§Y¿Ã¹õ¤Wªº¤@ÓÂI ) ¬°³æ¦ì¡C¦b MSDN ¤åÄm¤¤¡A¦¹Äæ¦ì¦WºÙ¬° cx¡A¦ý¦b²Õ¦X»y¨¥ùØ©M¼È¦s¾¹ CX ¦P¦W¡A¬G§ïºÙ¬° lx¡C |
LVCF_TEXT | pszText ©Î cchTextMax |
pszText ¬O¥H 0 ¬°µ²§Àªº¦r¦ê¦ì§}¡A¦pªG¬O¦b LVM_GETCOLUMN °T®§¤¤¡A¥Nªí¨t²Î·|§â²M³æ±±¨î¶µªºÄæ¦ì¦WºÙ¶ñ¤J pszText ©Ò«ü¦ì§}ªº½w½Ä°ÏùØ¡A¨ä³Ì¤jªº¤j¤p¬O´XÓ¼e¦r¤¸ªø«×¡AÀ³¸Ó¨Æ¥ý¦b cchTextMax ¤¤³]©w¡F¦pªG¬O LVM_SETCOLUMN¡BLVM_INSERTCOLUMN °T®§ùØ¡A·|¨Ï²M³æ±±¨î¶µªºÄæ¦ì¦WºÙ³]©w¬° pszText ¦ì§}©Ò«üªº¦r¦ê¡A¦Ó cchTextMax ¬OµL§@¥Î¡C |
LVCF_SUBITEM | iSubItem | iSubItem ¬O²Ä´XÓÄæ¦ì¡A¥Ñ¹s¶}©l¡A¦¹Äæ¦ìÀ³»P iCol ¬Û¦P¡C0 ªí¥Ü¶µ¥Ø¡A1 ¤Î¨ä¥H«áªí¥Ü¤l¶µ¥Ø¡C |
LVCF_IMAGE | iImage | ³o¬O COMCTL32.DLL ¦b 4.70 ª©¤Î¨ä¥H«á¤~¤ä´©ªºÄæ¦ì¡C( Ãö©ó COMCTL32.DLL ªºª©¥»¥i¥H°Ñ¦Ò²Ä 21 ³¹µù¤@¡C)iImage ¬O Image List ùر²Ä´XӹϥܡA³oӹϥܷ|Åã¥Ü¦bÄæ¦ì¦WºÙ¤W¡C |
LVCF_ORDER | iOrder | ³o¬O COMCTL32.DLL ¦b 4.70 ª©¤Î¨ä¥H«á¤~¤ä´©ªºÄæ¦ì¡C |
LVCF_MINWIDTH | cxMin | ³o¬O COMCTL32.DLL ¦b 6.00 ª©¤Î¨ä¥H«á¤~¤ä´©ªºÄæ¦ì¡CcxMin ªí¥Ü³Ì¤pÄæ¦ì¼e«×¡A¥H¹Ï¯À¬°³æ¦ì¡C |
LVCF_DEFAULTWIDTH | cxDefault | ³o¬O COMCTL32.DLL ¦b 6.00 ª©¤Î¨ä¥H«á¤~¤ä´©ªºÄæ¦ì¡CcxDefault ªí¥Ü¤º©wªºÄæ¦ì¼e«×¡A¥H¹Ï¯À¬°³æ¦ì¡C |
LVCF_IDEALWIDTH | cxIdeal | ³o¬O COMCTL32.DLL ¦b 6.00 ª©¤Î¨ä¥H«á¤~¤ä´©ªºÄæ¦ì¡C |
¦pªGµ{¦¡¹ï²M³æÀ˵øµo¥X LVM_INSERTCOLUMN °T®§¡A¨Ã¦¨¥\¦a³]¸m·sªºÄæ¦ì¡Aªð¦^Ȭ°·sÄæ¦ìªº½s¸¹¡FY¥¢±Ñ¡A«hªð¦^ ¡Ð1¡C¦Ó LVM_DELETECOLUMN¡BLVM_GETCOLUMN¡BLVM_SETCOLUMN °T®§Y¯à¦¨¥\¡Aªð¦^ TRUE¡F§_«hªð¦^ FALSE¡C
¦pªG¡u²M³æÀ˵ø¡v±±¨î¶µ¥H details view ¤è¦¡Åã¥Ü¡A¨äµøµ¡ªº³Ì¤W±¬O¥Ñ¦n´XÓÄæ¦ì©Ò²Õ¦¨ªº¼ÐÃD ( header )¡A¨Æ¹ê¤W¡A¼ÐÃD¤]¬O¤@ºØ³q¥Î±±¨î¶µ¡AºÙ¬°¡u¼ÐÃD±±¨î¶µ¡v¡C¦pªGn¦b¼ÐÃD¤¤ªºÄæ¦ìÅã¥Ü¹Ï¥Üªº¸Ü¡A¥²¶·¥ý¨ú±o¡u¼ÐÃD±±¨î¶µ¡vªº¥N½X¡C
INVOKE SendMessage,hListView,LVM_GETHEADER,0,0ªð¦^®É¡AEAX §Y¬°¡u¼ÐÃD±±¨î¶µ¡v¥N½X¡C
INVOKE SendMessage,hHeader,HDM_SETIMAGELIST,wParam,lParam¤W±µ{¦¡¤¤ªº wParam ¥i¥H¬O HDSIL_NORMAL ©Î HDSIL_STATE¡A¤À§O¥NªíÅã¥Ü¦bÄæ¦ì©Î¤£¦Pª¬ºA®ÉÔªº¹Ï¥Ü¡A¦pªG¬O¥un¦b¼ÐÃD±±¨î¶µªº¬YÓÄæ¦ìÅã¥Ü¹Ï¥Üªº¸Ü¡A¨º»ò wParam ³]¬° HDSIL_NORMAL §Y¥i¡ClParam «h¬O¹Ï¤ù²M³æªº¥N½X¡C
mov lvc.imask,LVCF_IMAGE mov lvc.fmt,LVCFMT_IMAGE or LVCFMT_CENTER or LVCFMT_BITMAP_ON_RIGHT INVOKE SendMesage,hListView,LVM_SETCOLUMN,1,ADDR lvc
¤W±µ{¦¡ªº²Ä¤T¦æ¡Aµo°e LVM_SETCOLUMN °T®§®É¡AwParam ¥Nªí²Ä´XÓ¤l¶µ¥Ø¡AlParam ¥Nªí LVCOLUMN µ²ºcÅé©Ò¦b¦ì§}¡C
n¦b¡u²M³æÀ˵ø¡v±±¨î¶µùزK¥[¤@Ó¶µ¥Ø¡A¥²¶·©I¥s SendMessage¡A¹ï¡u²M³æÀ˵ø¡vµo¥X LVM_INSERTITEM °T®§¡Fn¦b¦¹¶µ¥ØùزK¥[¤l¶µ¥Ø ( subitem )¡A¤]n©I¥s SendMessage¡A¹ï¨äµo¥X LVM_SETITEM °T®§¡C¦pªGn²K¥[¨âÓ¤l¶µ¥Ø¡A´N±o¹ï²M³æÀ˵ø±±¨î¶µµo¥X¨â¦¸ LVM_SETITEM °T®§¡A±zµLªk¥Î LVM_INSERTITEM ¤¤²K¥[¤l¶µ¥Ø¡C¦p¤U±µ{¦¡½X¡G¤W±¬O²K¥[¶µ¥Ø¡A¦pªG¦¨¥\ªð¦^·s¶µ¥Øªº¯Á¤ÞÈ¡A¦pªG¥¢±Ñ¶Ç¦^ -1¡F¤U±¬O²K¥[¤l¶µ¥Ø¡A¦pªG¦¨¥\ªð¦^ TRUE¡A¦pªG¥¢±Ñªð¦^ FALSE¡J
INVOKE SendMessage,hListView,LVM_INSERTITEM,0,pitem ;²K¥[¶µ¥Ø INVOKE SendMessage,hListView,LVM_SETITEM,0,pitme ;²K¥[¤l¶µ¥Ø
LVM_INSERTITEM ©M LVM_SETITEM °T®§ªº wParam §¡¬°¹s¡F¦Ó lParam °Ñ¼Æ³£¬O pitem¡A¥¦¬O«ü¦V¤@Ó¦W¬° LVITEM ªºµ²ºcÅé¦ì§}¡C±zÀ³¸Ó¦b©I¥s SendMessage «e¥ý³]©w¦n LVITEM µ²ºcÅ骺¦U¶µÄæ¦ì¡C¦pªG±z·Q§ïÅܤw²K¥[¶µ¥Øªº¶µ¥Ø¦WºÙ¡B¤l¶µ¥Ø¦WºÙ¡Bª¬ºA¡K¡Kµ¥¡A¤]¬O¹ï²M³æÀ˵ø±±¨î¶µµo¥X LVM_SETITEM °T®§¡A¦P¼Ëªº¡A±z¤]»Ýn¦b©I¥s SendMessage «e³]©w¦n LVITEM ¦UÄæ¦ì¤§È¡CLVITEM µ²ºcÅéº٠LV_ITEM µ²ºcÅé¡A¨ä¦¨û¦p¤U¡G
LVITEM STRUCT imask UINT ? iItem DWORD ? iSubItem DWORD ? state UINT ? stateMask UINT ? pszText LPTSTR ? cchTextMax DWORD ? iImage DWORD ? lParam LPARAM ? iIndent DWORD ? iGroupId DWORD ? cColumns UINT ? puColumns DWORD ? piColFmt DWORD ? iGroup DWORD ? LVITEM ENDS
imask ¬O¥Î¨Óªí¥Ü LVITEM µ²ºcÅ骺þ´XÓÄæ¦ì¦¨û¬O¦³®Äªº¡A¤£¦Pªº imask ¤§È¡A¥Nªí LVITEM µ²ºcÅ餤¬Y¨Ç¯S©wÄæ¦ì¥²¶·³]©w¡Cimask Ȧ³¤U¦C´XºØ¡G( ¦b MSDN ùØ¡Aimask ºÙ¬° mask¡A¦ý¦b MASM32 ùØ¡Amask ¬O«O¯d¦r¡A¦]¦¹§ï¬° imask¡A¨ä¸ê®Æ«¬ºA¬° 32 ¦ì¤¸ªøªºµL¸¹¾ã¼Æ¡A§Y UINT )
imask | ¼vÅTÄæ¦ì | »¡¡@¡@¡@©ú |
LVIF_TEXT | pszText ©Î cchTextMax |
pszText ¬O¤@Ó«ü¼Ð¡A¦¹«ü¼Ð«ü¦V¤@Ó¦r¦ê¡Aªí¥Ü¦¹¶µ¥Øªº¼ÐÅÒ¤å¦r¡A¼ÐÅÒ¤å¦rÁöµM¥i¥H¶W¹L 260 ¦r¤¸¡A¦ý¥u¦³«e±ªº 260 ¦r¤¸·|Åã¥Ü¥X¨Ó¡C¦pªG¬O¥Î¦b¨ú±o¶µ¥Ø¸ê®Æªº°T®§®É¡ApszText ´N¬O±µ¦¬ªº½w½Ä°Ï¦ì§}¡A³o®Én±µ¦¬ªº¦r¤¸ªø«× ( ¥]§t NULL ) ¥Ñ cchTextMax «ü©w¡C¦pªGµo°e LVM_SETITEM ©M LVM_INSERTITEM °T®§®É¡ApszText ´N¬On³]©wªº¶µ¥Ø©Î¤l¶µ¥Ø¦WºÙ¡A¦¹®É cchTextMax ´NµL§@¥Î¤F¡C |
LVIF_IMAGE | iImage | iImage ¬O¹Ï¤ù²M³æ¤¤ªº¯Á¤ÞÈ¡Aªí¥Ün§â¦¹¯Á¤ÞÈ©Ò¥Nªíªº¹Ï¤ù«ü©wµ¹¦¹¶µ¥Ø¡C |
LVIF_COLUMNS | cColumns puColumns |
Windows XP ¤Î¨ä¥H«áªº§@·~¨t²Î¤~¤ä´©¦¹ºX¼Ð¡CcColumns ¬O¦b Tile View Åã¥Ü¤è¦¡¤U¡AÅã¥Ü´XÄ檺¤l¶µ¥Ø¡A³Ì¦h¬° 20¡C |
LVIF_GROUPID | iGroupId | iGroupId ¬O COMCTL32.DLL 6.00 ª©¥H«á¤~¦³ªºÄæ¦ì¡A¬O¥Î¨Ó³]©w¦¹¶µ¥ØÄÝ©óþ¤@Ó¸s²Õ¡C¦pªG¨S¦³³]©w LVIF_GROUPID¡A«h¨t²Î·|§â iGroupId µø¬° I_GROUPIDNONE¡Aªí¥Ü¦¹¶µ¥Ø¤£ÄÝ©ó¥ô¦ó¤@Ó¸s²Õ¡FiGroupId ¤]¥i¥H¬O I_GROUPIDCALLBACK¡Aªí¥Ü¦¹²M³æÀ˵ø±±¨î¶µ·|¹ï¤÷µøµ¡µo¥X LVN_GETDISPINFO °T®§¡A¥H¨ú±o¸s²Õªº¯Á¤ÞÈ¡C |
LVIF_COLFMT | piColFmt cColumns |
Windows Vista/7 ¤Î¨ä¥H«áªº§@·~¨t²Î¤~¤ä´©¦¹ºX¼Ð¡C |
LVIF_INDENT | iIndent | iIndent Äæ¦ì¬O¦w¸Ë¤F IE 3.0 ¥H«á©Î COMCTL32.DLL §ó·s¨ì 4.70 ª©¥H«á¡A¤~¦³ªºÄæ¦ì¡F¥¦¬O¥Î¨Ó«ü©w¶µ¥Ø¼e«×¬°´Xӹϥܪº¼e«×¡A¤]´N¬O»¡¦pªG iIndent ¬° 1¡Aªí¥Ü¶µ¥Ø³]¬°¤@ӹϥܼe¡AiIndent ¬° 2¡Aªí¥Ü¶µ¥Ø³]¬°¨âӹϥܼe¡C |
LVIF_PARAM | lParam | lParam ¬Oµ{¦¡¦Û¦æ©w¸qªº¼ÆÈ¡A¥i¥H¥Î¦b±Æ§Ç ( µo¥X LVM_SORTITEMS °T®§ ) ©Î·j´M ( µo¥X LVM_FINDITEM °T®§ )¡C |
LVIF_STATE | state | ²M³æÀ˵ø±±¨î¶µ¤¤ªº¶µ¥Ø¦³©³¤U´XºØª¬ºA¡J
|
LVIF_NORECOMPUTE | ||
LVIF_DI_SETITEM |
iItem ¶µ¥Ø¯Á¤Þ¡A¥ç§Y²Ä´XÓ¶µ¥Ø¡A¥Ñ¹s¶}©l½s¸¹¡A¦b²M³æÀ˵øùØ´¡¤J¶µ¥Ø®É¡An«ü©w¶µ¥Ø¯Á¤ÞÈ¡CiSubItem ¬O¤l¶µ¥Øªº¯Á¤ÞÈ¡A¥ç§Y²Ä´XÓÄæ¦ì¡A¥Ñ¤@¶}©l¡A¦]¬°¹sªí¥Ü¶µ¥Ø¡A¦b²M³æÀ˵øùØ´¡¤J¶µ¥Ø©Î³]©w¤l¶µ¥Ø®É¡AÀ³«ü©w¤l¶µ¥Ø¯Á¤ÞÈ¡C¨Ò¦p§ÚÌ¥ý²³æ¦Ò¼{¤U±³oºØ±¡§Î¡J¦³Ó¤p¤½¥q¶È¦³¤T¤H¡A·Q§âû¤u°ò¥»¸ê®Æ ( ©m¦W¡B©Ê§O¡B¦~ÄÖ¡B¥X¥Í¦a ) Åã¥Ü¦b²M³æÀ˵ø±±¨î¶µ¤¤¡C¦]¦¹§Ú̱o¦b¼ÐÃD¤¤·s¼W¥|ÓÄæ¦ì¡J©m¦W¡B©Ê§O¡B¦~ÄÖ¡B¥X¥Í¦a¡A¨Ã¥[¤J¤TÓ¶µ¥Ø¡A³o¤TÓ¶µ¥Ø¤À§O¬O¤TÓ¤Hªº¸ê®Æ¡Ð¡Ð©m¦W¡B©Ê§O¡B¦~ÄÖ¡B¥X¥Í¦a¡A¦p¤U¹Ï¡J
¨º»ò³o¤TÓ¤Hªº©m¦WºÙ¬°¡u¶µ¥Ø¡v¡A¦Ó©Ê§O¡B¦~ÄÖ¡B¥X¥Í¦a«h¬O²Ä¤@¡B¤G¡B¤TÓ¤l¶µ¥Ø¡C¨º»òµ{¦¡½XÀ³¸Ó¬O¹³¤U±³o¼Ë¡J
.CONST ;Äæ¦ì¦W szName BYTE 'Name',0 szSex BYTE 'Sex',0 szAge BYTE 'Age',0 szBirthPlace BYTE 'Birth Place',0 ;²Ä 0 Ó¶µ¥Øªº¸ê®Æ szNo1Name BYTE 'John',0 szNo1Sex BYTE 'Male',0 szNo1Age BYTE '40',0 szNo1BP BYTE 'Taipei',0 ;²Ä 1 Ó¶µ¥Øªº¸ê®Æ szNo2Name BYTE 'Mary',0 szNo2Sex BYTE 'Female',0 szNo2Age BYTE '30',0 szNo2BP BYTE 'Kaohsiung',0 ;²Ä 2 Ó¶µ¥Øªº¸ê®Æ szNo3Name BYTE 'David',0 szNo3Sex BYTE 'Male',0 szNo3Age BYTE '28',0 szNo3BP BYTE 'Taichung',0 . . . . . . . . . . . . . . . . . . . ;²K¥[¼ÐÃD¡A¦¹¼ÐÃD¦@¥|Äæ mov lvc.imask,LVCF_FMT or LVCF_TEXT or LVCF_WIDTH or LVCF_SUBITEM mov lvc.fmt,LVCFMT_CENTER mov lvc.lx,45 mov lvc.pszText,OFFSET szName mov lvc.iSubItem,0 INVOKE SendMessage,hListView,LVM_INSERTCOLUMN,0,ADDR lvc ;²K¥[²Ä 0 Äæ¡A©m¦W mov lvc.lx,50 mov lvc.pszText,OFFSET szSex mov lvc.iSubItem,1 INVOKE SendMessage,hListView,LVM_INSERTCOLUMN,1,ADDR lvc ;²K¥[²Ä 1 Äæ¡A©Ê§O mov lvc.lx,50 mov lvc.pszText,OFFSET szAge mov lvc.iSubItem,2 INVOKE SendMessage,hListView,LVM_INSERTCOLUMN,2,ADDR lvc ;²K¥[²Ä 2 Äæ¡A¦~ÄÖ mov lvc.lx,90 mov lvc.pszText,OFFSET szBirthPlace mov lvc.iSubItem,3 INVOKE SendMessage,hListView,LVM_INSERTCOLUMN,3,ADDR lvc ;²K¥[²Ä 3 Äæ¡A¥X¥Í¦a ;²K¥[²Ä¤@Óû¤uªº¸ê®Æ mov lvi.imask,LVIF_TEXT or LVIF_PARAM mov lvi.iItem,0 mov lvi.iSubItem,0 mov lvi.lParam,0 mov lvi.pszText,OFFSET szNo1Name INVOKE SendMessage,hListView,LVM_INSERTITEM,0,ADDR lvi mov lvi.imask,LVIF_TEXT mov lvi.iSubItem,1 mov lvi.pszText,OFFSET szNo1Sex INVOKE SendMessage,hListView,LVM_SETITEM,0,ADDR lvi mov lvi.iSubItem,2 mov lvi.pszText,OFFSET szNo1Age INVOKE SendMessage,hListView,LVM_SETITEM,0,ADDR lvi mov lvi.iSubItem,3 mov lvi.pszText,OFFSET szNo1BP INVOKE SendMessage,hListView,LVM_SETITEM,0,ADDR lvi ;²K¥[²Ä¤GÓû¤uªº¸ê®Æ mov lvi.imask,LVIF_TEXT or LVIF_PARAM mov lvi.iItem,1 mov lvi.iSubItem,0 mov lvi.lParam,1 mov lvi.pszText,OFFSET szNo2Name INVOKE SendMessage,hListView,LVM_INSERTITEM,0,ADDR lvi mov lvi.imask,LVIF_TEXT mov lvi.iSubItem,1 mov lvi.pszText,OFFSET szNo2Sex INVOKE SendMessage,hListView,LVM_SETITEM,0,ADDR lvi mov lvi.iSubItem,2 mov lvi.pszText,OFFSET szNo2Age INVOKE SendMessage,hListView,LVM_SETITEM,0,ADDR lvi mov lvi.iSubItem,3 mov lvi.pszText,OFFSET szNo2BP INVOKE SendMessage,hListView,LVM_SETITEM,0,ADDR lvi ;²K¥[²Ä¤TÓû¤uªº¸ê®Æ mov lvi.imask,LVIF_TEXT or LVIF_PARAM mov lvi.iItem,2 mov lvi.iSubItem,0 mov lvi.lParam,2 mov lvi.pszText,OFFSET szNo3Name INVOKE SendMessage,hListView,LVM_INSERTITEM,0,ADDR lvi mov lvi.imask,LVIF_TEXT mov lvi.iSubItem,1 mov lvi.pszText,OFFSET szNo3Sex INVOKE SendMessage,hListView,LVM_SETITEM,0,ADDR lvi mov lvi.iSubItem,2 mov lvi.pszText,OFFSET szNo3Age INVOKE SendMessage,hListView,LVM_SETITEM,0,ADDR lvi mov lvi.iSubItem,3 mov lvi.pszText,OFFSET szNo3BP INVOKE SendMessage,hListView,LVM_SETITEM,0,ADDR lvi
lParam ¬Oµ{¦¡¦Û¦æ©w¸qªº¼ÆÈ¡A¥i¥H¥Î¦b±Æ§Ç ( µo¥X LVM_SORTITEMS °T®§ ) ©Î·j´M ( µo¥X LVM_FINDITEM °T®§ )¡C¦pªGn³]©w¶µ¥Øªº lParam ¼ÆÈ¡A³Ì¦n¬O¦b LVM_INSERTITEM ®É´N³]©w¦n¡A¦b LVM_SETITEM ®É¡A³s¦P¤l¶µ¥Ø¤@°_³]©w¡A·|²£¥Í°ÝÃD¡C¦p¦ó±Æ§Ç¡A½Ð°Ñ¾\¤U±ªº»¡©ú¡CLVITEM ¤¤ªº lParam Áö¥i¥H¥ô·N©w¸q¡A¦ý¬O¬°¤F¤è«K¡A¤@¯ë·|³]©w¬°©M iItem ¬Û¦P¡A¥H«K¦b±Æ§Ç®É¯à«Ü§ÖªºÂÇ¥Ñ lParam ´N¥i¨ú±o iItem¡A¶i¦Ó±o¨ì¬YÓ¶µ¥Øªº©Ò¦³¸ê®Æ¡C
¦pªGn¦b¶µ¥Ø¦WºÙ¤¤Åã¥Ü¹Ï¥Ü¡A¨º»òn¥ý¹ï²M³æÀ˵ø±±¨î¶µµo¥X LVM_SETIMAGELIST °T®§¡A¨Ï¬YӹϤù²M³æ ( image list ) »P²M³æÀ˵ø±±¨î¶µ³s±µ°_¨Ó¡Aµ{¦¡½X¦p¤U¡J
INVOKE SendMessage,hListView,LVM_SETIMAGELIST,wParam,lParam
hListView ¬O²M³æÀ˵ø±±¨î¶µ¥N½X¡AlParam ¬O image list ¥N½X¡A¥Nªín§â lParam ¤¤ªº image list »P²M³æÀ˵ø±±¨î¤U³sµ²°_¨Ó¡A¥ç§Y¦b¦¹µ{¦¡½X¤§«á¡A¦pªG²M³æÀ˵ø±±¨î¶µ»Ý¥Î¨ì image list ®É¡A´N¬O¥H lParam ¤¤©Ò«ü©wªº image list ¨Ï¥Î¡CwParam ¥i¥H¬O¤U±¼ÆÈ¡J
¦b¤@¯ë±¡§Î¤U¡A¥u¦³¶µ¥ØÄæ¦ì¤~¯àÅã¥Ü¹Ï¥Ü¡A¦pªG±z·Q¦b¤l¶µ¥Ø¤¤¤]Åã¥Ü¹Ï¥Ü¡A¨º»ò¥²¶·¨Ï¥Î LVS_EX_SUBITEMIMAGES ÂX¥R·®æ¡A½Ð°Ñ¦Ò List View ªºÂX¥R·®æ¡C
Tile View ¬O Windows XP ¤¤·s¼Wªº¤@ºØÅã¥Ü¤è¦¡¡A¥¦¥i¥H¦b¹Ï¥Ü®ÇÃäÅã¥Ü¶µ¥Ø¦WºÙ¤Î¼ÆÓ¤l¶µ¥Ø¦WºÙ¡C¶µ¥Ø¦WºÙ¬O¨t²Î¤º©wÅã¥Üªº¡A¦Ó¤l¶µ¥Ø¦WºÙ«h¬Oµ{¦¡¥i¥H¥Ñ details view ¤¤¿ï¾Üþ´XÓÄæ¦ì¥i¥HÅã¥Ü¡C¦Ü©ónÅã¥Ü¤l¶µ¥Ø¼Æ¥Ø¤Îþ¨Ç¤l¶µ¥Ø¡A¥i¥H¥Ñ LVITEM ¤¤ªº cColumns ©M puColumns ¨M©w¡CcColumns ³Ì¤jȬO 20¡A¥ç§Y³Ì¦h¥u¯àÅã¥Ü 20 Ó¤l¶µ¥Ø¡A³s¦P¶µ¥Ø¦WºÙ¡A´N¦³ 21 µ§¸ê®ÆÅã¥Ü¦b¹Ï¥Ü®Ç¡CpuColumns ¬O«ü¦V¤@Ó°}¦C¦ì§}¡A¦¹°}¦C¥Ñ cColumns ÓÂù¦r²Õ²Õ¦¨¡A¨ä¨CÓ¦¨û´N¥Nªí details view ¤¤ªº²Ä´XÓÄæ¦ì¡C
¦pªGÅã¥Üªº¤l¶µ¥Ø¤Ó¦h¡AªÅ¶¡¤£°÷®É¡A¥i¯à·|³Q¤Á°£¡A³o®É¥²¶·³]©w¨CÓ¶µ¥Øªº°ª«×¡B¼e«×¡C¤èªk¬O¥ý³]©w LVTILEVIEWINFO µ²ºcÅé¡A¦A¹ï²M³æÀ˵ø±±¨î¶µµo¥X LVM_SETTILEVIEWINFO °T®§¡A¦p¤U±µ{¦¡¤ù¬q¡J
INVOKE SendMessage,hListView,LVM_SETTILEVIEWINFO,wParam,lParam
wParam ¥²¶·¬° 0¡AlParam ¬O LVTILEVIEWINFO µ²ºcÅé¦ì§}¡C¦pªGªð¦^Ȭ° TRUE¡A«h©I¥s¦¨¥\¡FY¬° FALSE¡A«h©I¥s¥¢±Ñ¡C°²¦pn¨ú±o tile view ¤¤¨C¤@¶µ¥Øªºªø»P¼e¡A«h¥i¥H¹ï²M³æÀ˵ø±±¨î¶µµo¥X LVM_GETTILEVIEWINFO °T®§¡A¦p¤U±µ{¦¡¤ù¬q¡J
INVOKE SendMessage,hListView,LVM_GETTILEVIEWINFO,wParam,lParam
wParam ¥²¶·¬° 0¡AlParam ¬O LVTILEVIEWINFO µ²ºcÅé¦ì§}¡C¨S¦³ªð¦^È¡CLVTILEVIEWINFO µ²ºcÅéÄæ¦ì¦p¤U¡J
LVTILEVIEWINFO STRUCT cbSize UINT ? dwMask DWORD ? dwFlags DWORD ? sizeTile SIZEL <> cLines DWORD ? rcLabelMargin RECT <> LVTILEVIEWINFO ENDS
Äæ¦ì¤¤ªº cbSize ¬O LVTILEVIEWINFO ¤j¤p¡A¥H¦ì¤¸²Õ¬°³æ¦ì¡AÀ³¦b©I¥s«e´N¤w¸g¶ñ¦n¡A¤£ºÞ¬Oµo¥X LVM_SETTILEVIEWINFO °T®§ÁÙ¬O LVM_GETTILEVIEWINFO °T®§¡CdwMask ¬O«ü©w³o¨âÓ°T®§n³]©w©Î¨ú±oþ¨Ç¸ê®Æ¡A¦]¦¹¤]·|¼vÅT dwFlags¡BsizeTile¡BcLines¡BrcLabelMargin µ¥¥|ÓÄæ¦ì¡Aþ¨ÇÄæ¦ì»Ýn³]©w©Î¬Oªð¦^®É·|³Q¨t²Î¶ñ¤J¾A·íªº¼ÆÈ¡CdwMask ¥i¯àªº¼ÆȦ³¤U±¤TºØ¡J
dwMask | ¼vÅTÄæ¦ì | »¡¡@¡@¡@©ú |
LVTVIM_TILESIZE | dwFlags sizeTile |
dwFlags ¬O¥Î¨Ó³]©w tile view ¶µ¥Ø¤j¤pªº¤è¦¡¡A¥i¥H¬O¤U±¤Ó¼ÆȤ§¤@¡J ¡@¡@LVTVIF_AUTOSIZE¡J¨t²Î¦Û°Ê³]©w ¡@¡@LVTVIF_EXTENDED¡JVista ¤~¥i¥H¨Ï¥Î¦¹¼ÆÈ¡A¥Î©ó extended tiles view ¡@¡@LVTVIF_FIXEDWIDTH¡J©T©w¼e«× ¡@¡@LVTVIF_FIXEDHEIGHT¡J©T©w°ª«× ¡@¡@LVTVIF_FIXEDSIZE¡J©T©w¼e«×»P°ª«× ¦pªG¨Ï¥Î©T©w¼e«×»P°ª«×¡AÁٻݳ]©w sizeTile¡C¨Ò¦p¡A¦pªG dwFlags ¬° LVTVIF_FIXEDWIDTH¡A´N¥²¶·³]©w sizeTile.x¡F¦pªG dwFlags ¬° LVTVIF_FIXEDHEIGHT¡A´N¥²¶·³]©w sizeTile.y¡F¦pªG dwFlags ¬° LVTVIF_FIXEDSIZE¡A´N¥²¶·¦P®É³]©w sizeTile.x ¤Î sizeTile.y¡CsizeTile ªº¸ê®Æ«¬ºA¬O SIZE¡A½Ð¬Ý¤U±ªº»¡©ú¡C |
LVTVIM_COLUMNS | cLines | Åã¥Ü¦b¹Ï¥Ü®Çªº¤l¶µ¥Ø¼Æ¥Ø¡A¦¹ÈÀ³¸Ó»P LVITEM ¤¤ªº cColumns ¬Û¦P¡A¦pªG¤£¦P¡A¨t²Î·|¿ï¾Ü¸û¤pªº¨º¤@Ó¡C |
LVTVIM_LABELMARGIN | rcLabelMargin |
¦b MSDN ùØ¡ALVTILEVIEWINFO ¤¤ªº sizeTile ¬O¤@ÓºÙ¬° SIZE ªºµ²ºcÅé¡A¨äÄæ¦ì¬°¡J
SIZE STRUCT cx DWORD ? cy DWORD ? SIZE ENDS
¦ý¬O SIZE ¬O ML ªº«O¯d¦r¡Acx ¬O¼È¦s¾¹ªº¦WºÙ¡A¬G MASM32 ¥H SIZEL ¥N´À SIZE¡A¨äÄæ¦ì¤]¥H x¡By ¥N´À¡C¦]¦¹¦b MASM32 ùØ¡ASIZE µ²ºcÅéÅܬ°¡J
SIZEL STRUCT x DWORD ? y DWORD ? SIZEL ENDS
LVM_SETTILEVIEWINFO ¤Î LVM_GETTILEVIEWINFO ¬O¥Î¨Ó³]©w©Î¨ú±o¥þ³¡¶µ¥Øªº¸ê®Æ¡A¦pªG·Qn³B²z³æ¤@¤@Ó¶µ¥Ø¡A©Î¬YÓ¯S©w¶µ¥Øªº¸ê®Æ¡A«h¥²¶·µo¥X LVM_SETTILEINFO ©Î LVM_GETTILEINFO °T®§¡C¸Ô²Ó±¡§Î¥i¬d¾\ MSDN¡C
¦b Windows XP ¤Î¨ä¥H«áªº¨t²ÎùØ¡A¤]¥i¥H¥Î¡u¸s²Õ¡v¼Ò¦¡Åã¥Ü²M³æÀ˵ø±±¨î¶µªº¤º®e¡A³o®Én¹ï²M³æÀ˵ø±±¨î¶µµo¥X LVM_ENABLEGROUPVIEW °T®§¡A¤Á´«¬O§_¥H¸s²Õ¤è¦¡Åã¥Ü¡J
INVOKE SendMessage,hWndControl,LVM_ENABLEGROUPVIEW,fEnable,0
hWndControl ¬O²M³æÀ˵ø±±¨î¶µ¥N½X¡A¦pªG fEnable ¬° TRUE¡A«h·|¨Ï hWndControl Åܬ°¸s²Õ¼Ò¦¡¡F¦pªG fEnable ¬° FALSE¡A«h¨Ï±o hWndControl Åܬ°«D¸s²Õ¼Ò¦¡¡C·íµM¦pªG²M³æÀ˵ø±±¨î¶µ¤¤¡A¨S¦³¸s²Õ¡A¨º»ò¤´µMµLªk¬Ý¨£¨ä®ÄªG¡Cn·s¼W¸s²Õªº¤èªk¬O¹ï²M³æÀ˵øµo¥X LVM_INSERTGROUP °T®§¡A¦bµo¥X°T®§«eÀ³¥ý«ü©w¸s²ÕÃѧO½X¤Î¸s²Õ¦WºÙ¡A³o¨Ç¸ê®Æ³Q¥]§t¦b LVGROUP µ²ºcÅ餺¡C
¨Æ¹ê¤W¡A°£¤F LVM_INSERTGROUP °T®§·|²o¯A¨ì LVGROUP µ²ºcÅé¥~¡A³]¥ß©Î¨ú±o¸s²Õ¸ê®Æ¡A¤]·|²o¯A¨ì LVGROUP µ²ºcÅé¡Cn³]¥ß©Î¨ú±o¸s²Õ¸ê®Æªº¤èªk¬O¤À§O¹ï²M³æÀ˵ø±±¨î¶µµo¥X LVM_SETGROUPINFO ©Î LVM_GETGROUPINFO °T®§¡C³o¤TÓ°T®§³£²o¯A¨ì¤@ÓºÙ¬° LVGROUP ªºµ²ºcÅé¡A³oÓµ²ºcÅé¥Î¨Ó¦s©ñ²M³æÀ˵øªº¸s²Õ¸ê®Æ¡ALVGROUP µ²ºcÅ馨ûÄæ¦ì¦p¤U¡J
LVGROUP STRUCT cbSize UINT ? imask UINT ? pszHeader LPWSTR ? cchHeader UINT ? pszFooter LPWSTR ? cchFooter DWORD ? iGroupId DWORD ? stateMask UINT ? state UINT ? uAlign UINT ? pszSubtitle LPWSTR ? cchSubtitle UINT ? pszTask LPWSTR ? cchTask UINT ? pszDescriptionTop LPWSTR ? cchDescriptionTop UINT ? pszDescriptionBottom LPWSTR ? cchDescriptionBottom UINT ? iTitleImage DWORD ? iExtendedImage DWORD ? iFirstItem DWORD ? cItems UINT ? pszSubsetTitle LPWSTR ? cchSubsetTitle UINT ? LVGROUP ENDS
cbSize ¬O¦¹µ²ºcÅé¤j¤p¡A¥H¦ì¤¸²Õ¬°³æ¦ì¡A¨t²ÎÂǦ¹¤À¿ëª©¥»¡A¥²¶·¦bµo¥X°T®§«e¡A¥ý³]©w¦n¦¹Äæ¦ì¡Cimask ¬O¥Î¨Ó¨M©wþ¨ÇÄæ¦ì¬O¦³®Äªº¡A¥i¯àªº¼ÆȬ°¡J
imask | ¼vÅTÄæ¦ì | »¡¡@©ú |
LVGF_HEADER | pszHeader cchHeader |
pszHeader «ü¦V¤@Ó¥H NULL ¬°µ²§Àªº¦r¦ê¦ì§}¡A¦¹¦r¦ê¬°¸s²Õ¦WºÙ¡CcchHeader ¬° pszHeader ªø«×¡A¥H¦r¤¸¬°³æ¦ì¡C¦pªG¬O³]©w©Î·s²K¸s²Õ¡A¨Ò¦pµo¥X LVM_SETGROUPINFO¡BLVM_INSERTGROUP °T®§®É¡AcchHeader ·|³Q©¿²¤¡A¸s²Õ¦WºÙ§Y¬° pszHeader ©Ò«üªº¦r¦ê¡F¦ý¦pªG¬O¨ú±o¸s²Õ¸ê®Æ¡A¨Ò¦pµo¥X LVM_GETGROUPINFO °T®§®É¡AcchHeader ´N±o¦bµo¥X°T®§«e³]¦n¡A¨t²Î¤~ª¾¹D½w½Ä°Ïùس̦h¥i¥H®e¯Ç¦h¤Ö¦r¤¸¡Aº¸«á©ÒÀò±oªº¸s²Õ¦WºÙ±N¦s©ó pszHeader ©Ò«ü¦ì§}¡C |
LVGF_ALIGN | uAlign | Windows XP ¤Î¨ä¥H«áªºª©¥»¤~¥i¥H¨Ï¥Î¡AuAlign ¤§È¥i¥H¬O LVGA_HEADER_CENTER¡BLVGA_HEADER_LEFT¡BLVGA_HEADER_RIGHT¡A¤À§Oªí¥Ü¸s²Õ¦WºÙÅã¥Ü¦b²M³æ±±¨î¶µªº¤¤¶¡¡B¥ª°¼¡B¥k°¼¦ì¸m¡C |
LVGF_GROUPID | iGroupId | ¸s²ÕªºÃѧO½X¡C¦b¤@Ó²M³æÀ˵ø¤¤À³¬O°ß¤@ªº¡A¥ç§Y·s¼W¸s²ÕªºÃѧO½X¤£¥i«½Æ¡C |
LVGF_SUBTITLE | pszSubtitle | Windows XP ¤Î¨ä¥H«áªºª©¥»¤~¥i¥H¨Ï¥Î¡A |
²M³æÀ˵ø±±¨î¶µ¦³ 30 ÓÂX¥R·®æ¥i¥H¨Ï¥Î¡A³£¬O¥H¡uLVS_EX_¡v¬°¦rº¡A¨Ò¦p LVS_EX_BORDERSELECT¡BLVS_EX_FULLROWSELECT µ¥µ¥¡Cn¨Ï¥Î³o¨ÇÂX¥R·®æ¡A¦ü¥GµLªk¦b¸ê·½´yzÀÉ ( *.RC ) ùتº±±¨î¶µ¤¤ªº exStyle ©w¸q¡A¦Ü¤Ö¤p¤ì°¸¨S¦¨¥\¹L¡C¦ý¬O¥i¥H³z¹L LVM_SETEXTENDEDLISTVIEWSTYLE °T®§¡A§â¸ê®Æ¶Ç»¼¨ì²M³æÀ˵ø±±¨î¶µ¤º¡A¨Ó³]©wÂX¥R·®æ¡A¤èªk¬O¡G
INVOKE SendMessage,hListView,LVM_SETEXTENDEDLISTVIEWSTYLE,dwExMask,dwExStyle
°Ñ¼Æ wParam ¥Nªí dwExMask ¤§·N¡AWindows ¥Î¤@ÓÂù¦r²Õ ( §Y 32 ¦ì¤¸ ) ¨Óªí¥Ü 30 ÓÂX¥R·®æ¡A±z¦pªG¥´¶} WINDOWS.INC¡A¥i¥H§ä¨ì
LVS_EX_GRIDLINES equ 00000001h LVS_EX_SUBITEMIMAGES equ 00000002h LVS_EX_CHECKBOXES equ 00000004h LVS_EX_TRACKSELECT equ 00000008h LVS_EX_HEADERDRAGDROP equ 00000010h LVS_EX_FULLROWSELECT equ 00000020h LVS_EX_ONECLICKACTIVATE equ 00000040h LVS_EX_TWOCLICKACTIVATE equ 00000080h LVS_EX_FLATSB equ 00000100h LVS_EX_REGIONAL equ 00000200h LVS_EX_INFOTIP equ 00000400h LVS_EX_UNDERLINEHOT equ 00000800h LVS_EX_UNDERLINECOLD equ 00001000h LVS_EX_MULTIWORKAREAS equ 00002000h LVS_EX_LABELTIP equ 00004000h LVS_EX_BORDERSELECT equ 00008000h LVS_EX_DOUBLEBUFFER equ 00010000h LVS_EX_HIDELABELS equ 00020000h LVS_EX_SINGLEROW equ 00040000h LVS_EX_SNAPTOGRID equ 00080000h LVS_EX_SIMPLESELECT equ 00100000h LVS_EX_JUSTIFYCOLUMNS equ 00200000h LVS_EX_TRANSPARENTBKGND equ 00400000h LVS_EX_TRANSPARENTSHADOWTEXT equ 00800000h LVS_EX_AUTOAUTOARRANGE equ 01000000h LVS_EX_HEADERINALLVIEWS equ 02000000h LVS_EX_AUTOCHECKSELECT equ 08000000h LVS_EX_AUTOSIZECOLUMNS equ 10000000h LVS_EX_COLUMNSNAPPOINTS equ 40000000h LVS_EX_COLUMNOVERFLOW equ 80000000h
¨CÓÂX¥R·®æ¥H¤@Ӧ줸¥Nªí¡A¦]¦¹·í§Ú̶ȶȷQ§ïÅܬYÓÂX¥R·®æ¡A¦Ó¤£¼vÅT¨ä¥LÂX¥R·®æ®É¡AÀ³±N¨ä¥L·®æ©Ò¥Nªí¤§¦ì¤¸¤©¥H¾B¸n¡A¦Ó dwExMask ªí¥Ü°£¤F¦¹¦ì¤¸·|³Q§ïÅÜ¥~¡A¨ä¾l¦ì¤¸§¡¤£§ïÅÜ¡C¦Ó dwExStyle «hªí¥Ü±N³]©w¦¹¦ì¤¸¬° 1¡C¨Ò¦p¡A¦b¹w³]ªº±¡§Î¤U¡A¨Ï¥ÎªÌ¥H·Æ¹«ÂI¿ï details view ¤¤¬YÓ¶µ¥Ø®É¡Aµe±¤W¥u¦³¸Ó¶µ¥Ø³Q°ª«G«×°é¦í¡A¦pªGn³]©w©Ò¦³¤l¶µ¥Ø¤]¬°°ª«G«×©Ò°é¦í¡A¨º»ò´N±o³]©w LVS_EX_FULLROWSELECT ÂX¥R·®æ¡A¦pªG±z¤S·Q¤£¼vÅT¨ä¥LÂX¥R·®æ¡A¨º»òµ{¦¡À³¼g¦¨¡G
INVOKE SendMessage,hListView,LVM_SETEXTENDEDLISTVIEWSTYLE,LVS_EX_FULLROWSELECT,LVS_EX_FULLROWSELECT
·í±z¤£·QÅý²M³æÀ˵ø±±¨î¶µ¦³ LVS_EX_FULLROWSELECT ÂX¥R·®æ¡A¦ý¤S¤£¼vÅT즳ªº·®æ®É¡A´N¥i¥H¥Î¤U±ªºµ{¦¡¹F¦¨¡G
INVOKE SendMessage,hListView,LVM_SETEXTENDEDLISTVIEWSTYLE,LVS_EX_FULLROWSELECT,0
·í±z·Q§ïÅܨâºØ©Î¨âºØ¥H¤WªºÂX¥R·®æ®É¡AdwExMask »P dwExStyle ¤]¥i¥H¬O¼ÆÓÂX¥R·®æ¥H or ¹Bºâ³s±µ¡A³o¼Ë´N¬Ù¨Æ¦h¤F¡CLVM_SETEXTENDEDLISTVIEWSTYLE °T®§ªºªð¦^ȬOì¨ÓªºÂX¥R·®æ¡C
©³¤U¤p¤ì°¸´£¤@´£´XÓÂX¥R·®æ¡C
List view ÂX¥R·®æ | »¡¡@¡@¡@©ú |
LVS_EX_BORDERSELECT | ¦¹ÂX¥R·®æ·|¦b details view Åã¥Ü¤è¦¡¤U¡A¦b¶µ¥Ø¥|©P³òµe¥XÃä®Ø¡A±z¤]¥i¥H¹ï²M³æÀ˵ø±±¨î¶µµo¥X LVM_SETOUTLINECOLOR °T®§§ïÅÜÃä®ØªºÃC¦â¡A¤èªk¬O¡JINVOKE SendMessage,hListView,LVM_SETOUTLINECOLOR,0,COLORREF¦pªG¨S¦³ LVS_EX_BORDERSELECT ·®æ¡A§Y¨Ïµo¥X LVM_SETOUTLINECOLOR °T®§¤]µLªkÅã¥ÜÃä®Ø¡C |
LVS_EX_CHECKBOXES | ³oÓÂX¥R·®æ·|¦b¨CÓ¶µ¥Ø«e±¡AÅã¥Ü¤@ÓÀËÅç²°¡A¥i¨Ñ¨Ï¥ÎªÌ¤Ä¿ï¡C |
LVS_EX_FULLROWSELECT | ¦b¹w³]ªº±¡§Î¤U¡A¨Ï¥ÎªÌ¥H·Æ¹«ÂI¿ï details view ¤¤¬YÓ¶µ¥Ø®É¡Aµe±¤W¥u¦³¸Ó¶µ¥Ø³Q°ª«G«×°é¦í¡A¦pªGn³]©w³QÂI¿ïªº¤l¶µ¥Ø¤]¬°°ª«G«×©Ò°é¦í¡A¨º»ò¥²¶·³]©w LVS_EX_FULLROWSELECT ÂX¥R·®æ¡C³oÓÂX¥R·®æ¥u¼vÅT details view¡C |
LVS_EX_INFOTIP | ¨ã¦³ LVS_EX_INFOTIP ªº²M³æÀ˵ø·|¦b·Æ¹«´å¼Ð°±¯d¦b¬YÓ¶µ¥Ø¤W®É¡AÅã¥Ü¥X¤u¨ã´£¥Ü ( tool tip )¡C¦bÅã¥Ü¤u¨ã´£¥Ü¤§«e¡A·|µo¥X LVN_GETINFOTIP ³qª¾½Xµ¹¤÷µøµ¡¡A¥HÅý¤÷µøµ¡¨M©wn¦b¤u¨ã´£¥Ü¤WÅã¥Ü¥X¤°»ò¼Ëªº¸ê®Æ¡C |
LVS_EX_GRIDLINES | ·|¦b details view Åã¥Ü¤è¦¡¤¤¡Aµe¥X¨C¤@¦C¤Î¨CÓ¤l¶µ¥Ø¤§¶¡ªº¤À®æ½u¡C |
LVS_EX_HEADERDRAGDROP | ¦¹·®æ¥i¥HÅý¨Ï¥ÎªÌ¦b details view Åã¥Ü¤è¦¡¤U¡A§â·Æ¹«´å¼Ð²¾¨ìÄæ¦ì¦WºÙ¡A¨ÃÀ£¦í·Æ¹«¥ªÁ䤣©ñ¡A©ì©ÔÄæ¦ì¦WºÙ¨ì¾A·í¦ì¸m¡A½Õ¾ãÄæ¦ì¦WºÙ¶¶§Ç¡C |
LVS_EX_ONECLICKACTIVATE | ³oÓ·®æ·|Åý·Æ¹«´å¼Ð¦b¥ô¦ó¤@Ó¶µ¥Ø¤W·Æ¹L®É¡A¤£ºÞ³oÓ¶µ¥Ø¬O§_³Q¿ï©w ¡A³£·|§ïÅÜ´å¼Ð¡AÅý¨Ï¥ÎªÌ§ó©ö¹îı¡C¥t¥~¡A¦pªG¨Ï¥ÎªÌ¥H·Æ¹«ÂI¿ï¬YÓ¶µ¥Ø¡A·|¨Ï²M³æÀ˵ø±±¨î¶µ¹ï¤÷µøµ¡µo¥X LVN_ITEMACTIVATE ³qª¾½X¡C |
LVS_EX_SUBITEMIMAGES | ³oÓÂX¥R·®æ¯à¨Ï¤l¶µ¥Ø¤]¯àÅã¥Ü¹Ï¥Ü¡A¤£¹L¥u¯à¦b details view ¤U¬Ý¨£¨ä®ÄªG¡C¤èªk¬O¥H LVM_SETITEM ©I¥s SendMessage ®É¡ALVITEM ¤¤³]©w iImage ¤Î LVIF_IMAGE¡C |
LVS_EX_TWOCLICKACTIVATE | ³oÓÂX¥R·®æ¯àÅý·Æ¹«´å¼Ð¦b³Q¿ï©wªº¶µ¥Ø¤W·Æ¹L®É¡A§ïÅÜ´å¼Ð¡AÅý¨Ï¥ÎªÌ§ó©ö¹îı¡C¥t¥~¡A¦pªG¨Ï¥ÎªÌ¥H·Æ¹«ÂùÀ»¬YÓ¶µ¥Ø¡A·|¨Ï²M³æÀ˵ø±±¨î¶µ¹ï¤÷µøµ¡µo¥X LVN_ITEMACTIVATE ³qª¾½X¡C |
LVS_EX_TRACKSELECT | ¦¹ÂX¥R·®æ·|³y¦¨¡uhot-track selection¡v¡A¥ç§Y·Æ¹«´å¼Ð¦b¬YÓ¶µ¥Ø¤W°±¯d¤@¬q®É¶¡«á¡A¦¹¶µ¥Ø´N·|³Q¿ï¨ú¡C¦Ü©ó³o¬q®É¶¡¬O¦h¤[¡A¥i¥Hµo°e LVM_SETHOVERTIME °T®§³]©w¡F¤]¥i¥H¥H SPI_GETMOUSEHOVERTIME ¬°°Ñ¼Æ©I¥s SystemParametersInfo ¨ú±o³o¬q®É¶¡¡C¨t²Î¨Ã¤£·|¦ì¨CÓ²M³æÀ˵ø±±¨î¶µ³æ¿W³]©w³o¬q®É¶¡¡A¦Ó¬O¨CÓ²M³æÀ˵ø±±¨î¶µ³£¨Ï¥Î¦P¼Ëªº°±¯d®É¶¡¡C·í·Æ¹«´å¼Ð²¾¨ì¬YÓ¶µ¥Ø¤W®É·|µo¥X LVN_HOTTRACK ³qª¾½Xµ¹¤÷µøµ¡¡A§ÚÌ¥unÀˬd¦¹³qª¾½X¡A´N¥i¥Hª¾¨ì¬O§_µo¥Í¡uhot-track selection¡v¡C |
LVS_EX_UNDERLINEHOT | ³oÓ·®æ·|Åý·Æ¹«´å¼Ð¦b¥ô¦ó¤@Ó¶µ¥Ø¤W·Æ¹L®É¡A¤£ºÞ³oÓ¶µ¥Ø¬O§_³Q¿ï©w ¡A³£·|¦b¶µ¥Ø¦WºÙ¤W²K¥[©³½u¡AÅý¨Ï¥ÎªÌ§ó©ö¹îı¡C¦¹·®æ»Ýn³]©w LVS_EX_ONECLICKACTIVATE ¤~¯àÅã¥X®ÄªG¡C |
²M³æÀ˵ø±±¨î¶µ¥H³qª¾½Xªº¤è¦¡¡A±N°T®§¶Çµ¹¤÷µøµ¡¡A¨Æ¹ê¤W¡A¤£¬O¥u¦³²M³æÀ˵ø¦p¦¹¦Ó¤w¡A¤j³¡¤Àªº³q¥Î±±¨î¶µ³£¥H³qª¾½X¶Ç»¼°T®§µ¹¤÷µøµ¡¡C«e¤@³¹´£¹L¡A½Ð¦Û¦æ°Ñ¾\¡C²M³æÀ˵øªº³qª¾½X³Q¥]§t¦b¤@ÓºÙ¬° NMLISTVIEW ªºµ²ºcÅ餺 ( ¤]ºÙ¬° NM_LISTVIEW )¡A¤÷µøµ¡¥i¥H±q²M³æÀ˵ø±±¨î¶µ¶Ç¨Óªº WM_NOTIFY °T®§¤¤ªº±oª¾¨ä¦ì§}¡AWM_VOTIFY ªº°Ñ¼Æ¡AlParam ¼ÆȨä¹ê´N¬O NMLISTVIEW µ²ºcÅ骺¦ì§}¡C§ÚÌ¥ý¨Ó¬Ý¬Ý NMLISTVIEW µ²ºcÅ骺¦UÄæ¦ì¡J
NMLISTVIEW STRUCT hdr NMHDR <> iItem DWORD ? ;µo¥X WM_NOTIFY °T®§®Éªº¶µ¥Ø¯Á¤ÞÈ¡AY¬°¡Ð1¡Aªí¥Ü¨S¦³¨Ï¥Î iSubItem DWORD ? ;µo¥X WM_NOTIFY °T®§®Éªº¤l¶µ¥Ø¯Á¤ÞÈ¡AY¬° 0¡Aªí¥Ü¨S¦³¨Ï¥Î uNewState DWORD ? ;µo¥X WM_NOTIFY °T®§®É¡A¸Ó¶µ¥Øªº³Ì·sª¬ºA uOldState DWORD ? ;µo¥X WM_NOTIFY °T®§®É¡A¸Ó¶µ¥ØªºÂ¦³ª¬ºA uChanged DWORD ? ptAction POINT <> lParam LPARAM ? NMLISTVIEW ENDS
NMHDR µ²ºcÅéÄæ¦ì¦p¤U¡J
NMHDR STRUCT hwndFrom HWND ? ;µo¥X WM_NOTIFY ªº²M³æÀ˵ø±±¨î¶µ¥N½X idFrom UINT ? ;µo¥X WM_NOTIFY ªº²M³æÀ˵ø±±¨î¶µÃѧO½X code UINT ? ;³qª¾½X NMHDR ENDS
NMHDR µ²ºcÅé¬O¨CÓ³q¥Î±±¨î¶µ³£¨ã¦³ªº¡A½Ð°Ñ¦Ò«e¤@³¹¡CptAction ¬O·í¨Æ¥óµo¥Í®É¡A¨Ò¦p¥H·Æ¹«ÂIÀ»¬YÓ¶µ¥Ø¡B©ÎÂùÀ»¬YÓ¶µ¥Øµ¥µ¥¡A·Æ¹«´å¼Ð©Ò¦b¦ì¸m¡CuChanged ¬O«üµo¥X WM_NOTIFY ®É¡A¬YÓ¶µ¥ØªºÄÝ©ÊÅܦ¨¬° uChanged ªº¤º®e¡A¨ä¤º®e©M LVITEM ªº imask ¬Û¦P¡C
¦b²Õ¦X»y¨¥¤¤¡An¦s¨ú NMLISTVIEW µ²ºcÅ骺¤º®e¡A¤@¯ë¬O¥H ASSUME °²«ü¥O«ü©w¬YӼȦs¾¹¬° NMLISTVIEW ªº¦ì§}¬°°ò·ÇÂI¡A·íµM¦¹¨BÆJ¶È¶È¬O°²«ü¥O¡A¨Ã¤£¬O¯u¥¿§â°O¾ÐÅé¦ì§}¦s¤J¼È¦s¾¹ùØ¡A©Ò¥HÁÙ¶·°õ¦æ mov «ü¥O¡A§â±N¦¹°O¾ÐÅé¦ì§}¦s¤J¸Ó¼È¦s¾¹ùØ¡CµM«á´N¥i¥H¥Î¡u[¼È¦s¾¹].hdr.hwndFrom¡v¦s¨úµo¥X WM_NOTIFY ªº²M³æÀ˵ø±±¨î¶µ¥N½X¡A¥H¡u[¼È¦s¾¹].hdr.idFrom¡v¦s¨úµo¥X WM_NOTIFY ªº²M³æÀ˵ø±±¨î¶µÃѧO½X¡C³Ì«áÁÙn°O±o¡A¥H¡uASSUME ¼È¦s¾¹:PTR NOTHING¡v«ì´_¸Ó¼È¦s¾¹¤£¥H¥ô¦ó¦ì§}¬°°ò·ÇÂI¡C¦p¤U±ªºµ{¦¡¤ù¬q¡J
.IF uMsg==WM_INITDIALOG .ELSEIF uMsg==WM_NOTIFY push ebx ASSUME ebx:PTR NM_LISTVIEW ;§â NMLISTVIEW °_©l¦ì§}°ò·ÇÂI³]¬° EBX mov ebx,lParam ;§â NMLISTVIEW °_©l¦ì§}¦s¤J EBX mov eax,[ebx].hdr.hwndFrom ;¨ú±o²M³æÀ˵ø±±¨î¶µ¥N½X¡A¦s¤J EAX .IF eax==hListView .IF [ebx].hdr.code==NM_CLICK ;¤ñ¸û³qª¾½X¬O§_¬° NM_CLICK .ENDIF .ENDIF ASSUME ebx:PTR NOTHING ;¨ú®ø EBX ¬° NMLISTVIEW °_©l¦ì§}°ò·ÇÂIªº³]©w pop ebx .ELSEIF uMsg==WM_CLOSE
©³¤U¤p¤ì°¸¤¶²Ð´XÓ±`¥Î²M³æÀ˵ø±±¨î¶µªº³qª¾½X¡C
·í¨Ï¥ÎªÌ¥H·Æ¹«¥ªÁäÂI«ö¼ÐÃD®É¡A²M³æÀ˵ø´N·|µo°e§t¦³ LVN_COLUMNCLICK ³qª¾½Xªº WM_NOTIFY °T®§µ¹¤÷µøµ¡¡CWM_NOTIFY °T®§¤¤ªº lParam «ü¦V¤@ÓºÙ¬° NM_LISTVIEW ªºµ²ºcÅé¡A¦¹µ²ºcÅ餤ªº hdr §t¦³¤W±©Ò»¡±o¦UºØ¸ê®Æ¡C¨ä¤¤³Ì«nªº¡A¤]¬O¤÷µøµ¡³ÌÀ³¸Óª¾¹Dªº¡A¤j·§´N¬O¨Ï¥ÎªÌ«ö¤F¼ÐÃDªºþ¤@Ó¤l¶µ¥Ø©O¡H³oÓ¸ê®Æ¦s©ñ©ó iSubItem ùØ¡C¦Ó¦¹®É iItem Äæ¦ì¬°¡Ð1¡A¨ä¥LÄæ¦ì«h¬° 0¡C
·í¨Ï¥ÎªÌ¥H·Æ¹«¥ªÁäÂI«ö²M³æÀ˵ø¤¤ªº¤@Ó¶µ¥Ø®É¡A²M³æÀ˵ø´N·|µo°e§t¦³ NM_CLICK ³qª¾½Xªº WM_NOTIFY °T®§µ¹¤÷µøµ¡¡C¦Ó WM_NOTIFY ¤¤ªº lParam °Ñ¼Æ©Ò«üªº¦ì§}¬O NMITEMACTIVATE µ²ºcÅé¦ì§}¡A¥¦»P NMLISTVIEW µ²ºcÅé´X¥G¬Û¦P¡A¥u¦h¤F³Ì«á¤@ÓÄæ¦ì¡AuKeyFlags¡A¦p¤U©Ò¥Ü¡J
NMITEMACTIVATE STRUCT hdr NMHDR <> iItem DWORD ? iSubItem DWORD ? uNewState UINT ? uOldState UINT ? uChanged UINT ? ptAction POINT <> lParam LPARAM ? uKeyFlags UINT ? NMITEMACTIVATE ENDS
uKeyFlags ¥NªíÁä½L¤Wªº Alt¡BCtrl¡BShift Áä¬O§_³Q«ö¤U¡A¦pªG³Q«ö¤U¡A«h uKeyFlags ¤§È¤À§O¬O LVKF_ALT¡BLVKF_CONTROL¡BLVKF_SHIFT¡C
¦pªG¨Ï¥ÎªÌ¦b details view ¤¤¡A¥H·Æ¹«¥ªÁäÂI«ö¤l¶µ¥Ø°Ï°ìªº¸Ü¡AÁö¤]¯àµo°e NM_CLICK ³qª¾½X¡A¦ý¬O NMITEMACTIVATE µ²ºcÅ餤ªº iItem «o¬O¡Ð1¡A´«¥y¸Ü»¡µLªkÂÇ¥ÑÂI«ö¤l¶µ¥Ø¦Ó±oª¾¨Ï¥ÎªÌ¿ï¨úþ¤@Ó¶µ¥Ø¡C¦pªG¤]n¨ÏÂI«ö¤l¶µ¥Ø¤]¯à¿ï¨ú¶µ¥Ø¡A¦³¨âºØ¤èªk¡J²Ä¤@¬O¨Ï²M³æÀ˵ø±±¨î¶µ¨ã¦³ LVS_EX_FULLROWSELECT ·®æ¡C²Ä¤G¬O¦b NM_CLICK ¤¤Àˬd iItem ¬O§_¬°¡Ð1¡A¦pªG¬Oªº¸Ü¡A¦A¹ï²M³æÀ˵øµo¥X LVM_SUBITEMHITTEST °T®§¡AÀˬd NMITEMACTIVATE ¤¤ªº pcAction ¸¨¦bþ¤@Ó¶µ¥Ø¤¤¡A½Ð°Ñ¦Ò¤U±¦³Ãö LVM_SUBITEMHITTEST ªº»¡©ú¡C
¦b«Ø¥ß²M³æÀ˵ø±±¨î¶µ®É¡A¥i¥H¥Î LVS_SORTASCENDING ©Î LVS_SORTDESCENDING ·®æ¨Ó«ü©w±Æ§Ç¤è¦¡¡A·íµM±z¤]¥i¥H¦b¥ô¦ó®ÉÔ¡A©I¥s SetWindowLong ¨Ó§ïÅܵøµ¡·®æ¡A¨Ï¤§Åܦ¨¤É§Ç ( ¦b¶V¤U±ªº¶µ¥Ø¶V¤j ) ©Î°§Ç ( ¦b¶V¤U±ªº¶µ¥Ø¶V¤p )±Æ¦C¡C¦ý¬O³o¨âºØ·®æ¥u¯à±Æ§Ç¶µ¥Ø¦WºÙ¡A¦pªG·Qn±Æ§Ç¤l¶µ¥Ø¡A«h¥²¶·µo°e LVM_SORTITEMS °T®§¨Ó§¹¦¨¡C¦b details view ®É¡A¨Ï¥ÎªÌ³q±`¥i¥H¦b¼ÐÃDÄ椤ªºÄæ¦ì¤W¡A¥H·Æ¹«¥ªÁäÂI«ö¤@¦¸¡A¥i¥H¨Ï±o²M³æÀ˵ø±±¨î¶µ¤ºªº¶µ¥Ø¨Ì©Ò«öÄæ¦ì±Æ§Ç¡A¦bµ{¦¡¤º´N¬Oµo°e LVM_SORTITEMS °T®§¡A¦p¤U¡J
INVOKE SendMessage,hListView,LVM_SORTITEMS,lParamSort,pfnCompare
lParamSort ¬O±Æ§Ç¤è¦¡¡A³o¬Oµ{¦¡©w¸qªº¼ÆÈ¡A¤@¯ë´N¬O¥H¬Y¤@¼Æ¥Nªí¤É§Ç¡A¥t¤@¼Æ«h¥Nªí°§Ç¡CpfnCompare ¬Oµ{¦¡³]p®v¦Û¦æ©w¸qªº¤ñ¸û¨ç¦¡¦ì§}¡A¦pªG¤ñ¸û¨ç¦¡ªº¦WºÙ¬O compare_func¡A¨º»ò pfnCompare ´NÀ³¸Ó¬O OFFSET compare_func¡C¤ñ¸û¨ç¦¡¬O³Q¨t²Î©Ò©I¥sªº°Æµ{¦¡¡A¨ä°Ñ¼Æ©T©w¡A¥u¦³¤TÓ¡A¨ä쫬¬O¡J
compare_func PROC lParam1:PARAM, lParam2:PARAM, lParamSort:DWORD
«e¨âӰѼơJlParam1¡BlParam2 ¬O¶µ¥Ø LVITEM ùتº lParam Äæ¦ì¡C³Ì«á¤@ӰѼơAlParamSort ¬O LVM_SORTITEMS °T®§ªºË¼Æ²Ä¤GӰѼơC·íµ{¦¡°õ¦æ¨ì¡uINVOKE SendMessage,hListView,lParamSort,pfnCompare¡v®É¡A¨t²Î·|¦Û¦æ¬D¿ï¨âÓ¶µ¥Ø¡A¨Ã§â³o¨âÓ¶µ¥Øªº lParam ¥H¤Î lParamSort ·í°µ°Ñ¼Æ¡A©I¥s¤ñ¸û¨ç¦¡¡A¨Ã¥B³sÄò©I¥s¦n´X¦¸¡Aª½¨ì¨CÓ¶µ¥Ø³£»P¨ä¥L¶µ¥Ø¬° lParam1¡BlParam2 ¨â°Ñ¼Æ©I¥s¤ñ¸û¨ç¦¡¤@¦¸¬°¤î¡C¤]´N¹³ªwªj±Æ§Çªk¡A§â¨CÓn¤ñ¸ûªº¼Æ¡A»P¥t¤@¼Æ³£¤ñ¸û¹L¤@¦¸¬°¤î¡C¦Ó¤ñ¸û¨ç¦¡©Òn°µªº´N¬O¨M©w¨º¤@Ó¶µ¥Ø±Æ¦b«e¡J¦pªG²Ä¤@Ó¶µ¥Ø±Æ¦b«e±¡A«h¶Ç¦^tÈ¡F²Ä¤GÓ¶µ¥Ø±Æ¦b«e±¡A«h¶Ç¦^¥¿È¡F¦pªG¬Ûµ¥¡A«h¶Ç¦^ 0¡C
¨Ò¦p¡A©µÄò¤W±¤@Ó¤p¤½¥qªº¨Ò¤l¡A°²³]·Qn¹ï¦~ÄÖ°µ±Æ§Ç¡A¨º»ò¦bµøµ¡¨ç¦¡¤¤³¡¥÷µ{¦¡½X¦p¤U¡G
.IF [ebx].hdr.code==LVN_COLUMNCLICK ;Y¨Ï¥ÎªÌ«ö¤U¼ÐÃDªº¬YÓ¤l¶µ¥Ø .IF [ebx].iSubItem==2 ;Y¨Ï¥ÎªÌ«ö¤U¼ÐÃDªº¡u¦~ÄÖ¡v¤l¶µ¥Ø test flag,1 ;Àˬd²{¦b¬O¤É§ÇÁÙ¬O°§Ç .IF ZERO? ;Y¬°ZR¡Aªí¥Ü²{¦b¬O²M³æÀ˵ø¶V¤U±¡A¦~ÄÖ¶V¤j¡A»ÝÅܧ󦨶V¤U±¡A¦~ÄÖ¶V¤p or flag,1 mov ecx,1 ;ECX¡×wParam¡×1¡Aªí¥Ü¶V¤U±¡A¦~ÄÖ¶V¤p .ELSE ;Y¬°NZ¡Aªí¥Ü²{¦b¬O²M³æÀ˵ø¶V¤U±¡A¦~ÄÖ¶V¤p¡A»ÝÅܧ󦨶V¤U±¡A¦~ÄÖ¶V¤j and flag,0fffffffeh mov ecx,2 ;ECX¡×wParam¡×2¡Aªí¥Ü¶V¤U±¡A¦~ÄÖ¶V¤j .ENDIF INVOKE SendMessage,hListView,LVM_SORTITEMS,ecx,OFFSET compare_func .ENDIF call update_item .ENDIF
¦b¦¹µ{¦¡¤¤¡Aflag ÅܼƬ° 0¡Aªí¥Ü¤É§Ç¡F¬° 1¡Aªí¥Ü°§Ç¡C³B²z LVN_COLUMNCLICK ®É¡A¥ýÀˬd¬O§_¨Ï¥ÎªÌ«ö¤U¡u¦~ÄÖ¡vÄæ¦ì¡A¦pªG¬Oªº¸Ü¡A¦AÀˬd²{¦bªº±Æ§Ç¤è¦¡¬O¤É§ÇÁÙ¬O°§Ç¡C¦pªG¬O¤É§Çªº¸Ü¡A«hµ{¦¡¶·§ï¦¨°§Ç±Æ¦C¡A¨Ã¦bµo°e LVM_SORT °T®§®É¡AlParamSort ³]¬° 1¡Aªí¥Ün§ï¦¨°§Ç±Æ¦C¡FY¬°°§Ç¡A«hn§ï¦¨¤É§Ç±Æ¦C¡A¦bµo°e LVM_SORT °T®§®É¡AlParamSort ³]¬° 2¡Aªí¥Ün§ï¦¨°§Ç±Æ¦C¡C¤ñ¸û¨ç¦¡¦p¤U¡G
compare_func PROC lp1:LPARAM,lp2:LPARAM,lParamSort:DWORD LOCAL buffer[20]:BYTE lea ecx,buffer mov lvi.imask,LVIF_TEXT mov lvi.pszText,ecx mov lvi.cchTextMax,20 mov lvi.iSubItem,2 INVOKE SendMessage,hListView,LVM_GETITEMTEXT,lp1,ADDR lvi INVOKE string_to_dword,ADDR buffer push eax INVOKE SendMessage,hListView,LVM_GETITEMTEXT,lp2,ADDR lvi INVOKE string_to_dword,ADDR buffer pop ecx ;¦¹®ÉEAX¡×²Ä¤GÓû¤uªº¦~ÄÖ¡FECX¡×²Ä¤@Óû¤uªº¦~ÄÖ .IF lParamSort==1 ;lParamSort¡×1¡Aªí¥Ü±Nn±Æ§Ç¡AÅܦ¨¶V¤U±¦~ÄÖ¶V¤p sub eax,ecx .ELSEIF lParamSort==2 ;lParamSort¡×2¡Aªí¥Ü±Nn±Æ§Ç¡AÅܦ¨¶V¤U±¦~ÄÖ¶V¤j sub ecx,eax mov eax,ecx .ENDIF ret compare_func ENDP
¦b¤ñ¸û¨ç¦¡ùØ¡A¤p¤ì°¸©I¥s¨â¦¸ SendMessage¡A³£¬O§â LVM_GETITEMTEXT °T®§¶Çµ¹²M³æÀ˵ø±±¨î¶µ¡A¥ý«án¨D²M³æÀ˵ø±±¨î¶µ§â¨t²Î¶Ç¨Óªº¨âÓ¶µ¥Ø¤¤¡A¡u¦~ÄÖ¡vªº¸ê®Æ¶Ç¹L¨Ó¡C³o¨âµ§¸ê®Æ¬O¥H¦r¦ê«¬ºA¦s¦b°Ï°ìÅÜ¼Æ buffer ùØ¡A±µµÛ§â¥¦ÌÂà´«¦¨¤Q¤»¶i¦ì¼ÆÈ ( ¥Ñ string_to_dword °Æµ{¦¡t³d¡AÂà´««áªº¤Q¤»¶i¦ì¼ÆÂÇ¥Ñ EAX ªð¦^¤ñ¸û¨ç¦¡ )¡A²Ä¤@Óû¤uªº¦~ÄÖ¦s©ó ECX¡A²Ä¤GÓû¤uªº¦~ÄÖ¦s©ó EAX ùØ¡C±µ¤U¨Ó¡A®Ú¾Ú lParamSort¡A¨M©w±Æ§Ç¤è¦¡¬O¤É§ÇÁÙ¬O°§Ç¡A¦pªG¬O 1¡Aªí¥ÜnÅܧ󬰰§Ç¡A¥ç§Y¶V¤U±¡A¦~ÄÖ¶V¤p¡A¥H EAX ´î ECX ±o¨ìªº®t¦pªG¬°tÈ¡Aªí¥Ü²Ä¤GÓû¤u¦~ÄÖ¸û¤p¡AÀ³¸Ó§â²Ä¤@Óû¤u±Æ¦b«e±¡A¨Ì¾Ú«e±©Ò´yzªº¡AÀ³¸Ó¶Ç¦^tÈ¡A¦Ó EAX ¦¹®É«ê¬°t¡A©Ò¥H¥un¶Ç¦^ EAX ¨Ãµ²§ô¤ñ¸û¨ç¦¡§Y¥i¡F¦ý¦pªG EAX ´î ECX ¤§®t¬°¥¿È¡Aªí¥Ü²Ä¤GÓû¤u¦~ÄÖ¸û¤j¡AÀ³¸Ó§â²Ä¤GÓû¤u±Æ¦b«e±¡A¨Ì¾Ú«e±©Ò´yzªº¡AÀ³¸Ó¶Ç¦^¥¿È¡A¦Ó EAX ¦¹®É«ê¬°¥¿¡A©Ò¥H¥un¶Ç¦^ EAX ¨Ãµ²§ô¤ñ¸û¨ç¦¡§Y¥i¡C¤Ï¤§¥çµM¡C
±Æ§Ç¤è¦¡ | ¬Û´î¤§µ²ªG | þ¤@¶µ¦b«e | ¶Ç¦^È |
nÅܬ°°§Ç ( ¶V¤U±¶V¤p ) | ( ²Ä¤GÓ )¡Ð( ²Ä¤@Ó )¡Ö0 | ²Ä¤GÓ¦b«e | ¥¿ |
( ²Ä¤GÓ )¡Ð( ²Ä¤@Ó )¡Õ0 | ²Ä¤@Ó¦b«e | t | |
nÅܬ°¤É§Ç ( ¶V¤U±¶V¤j ) | ( ²Ä¤@Ó )¡Ð( ²Ä¤GÓ )¡Ö0 | ²Ä¤GÓ¦b«e | ¥¿ |
( ²Ä¤@Ó )¡Ð( ²Ä¤GÓ )¡Õ0 | ²Ä¤@Ó¦b«e | t |
·í±Æ§Ç§¹¦¨«á¡A¦U¶µ¥Øªº¯Á¤Þ iItem »Pì¥ý lParam ´N¤£¦A¬Û¦P¤F¡A¦]¦¹±o«·s½Õ¾ã¡C¤p¤ì°¸ÁÙ¬O¥H¤W±¤@Ó¤p¤½¥qû¤uªº¨Ò¤l»¡©ú¡A·í±Æ§Ç§¹¦¨«á¡Aµ²§ô³B²z LVN_COLUMNCLICK ³qª¾½X¤§«e¡Aµ{¦¡ÁÙ©I¥s¤F update_item °Æµ{¦¡¡A´N¬O«·s³]©w¦U¶µ¥Øªº lParam¡C¨äµ{¦¡½X¦p¤U¡J
update_item PROC LOCAL n:DWORD INVOKE SendMessage,hListView,LVM_GETITEMCOUNT,0,0 mov n,eax mov lvi.imask,LVIF_PARAM mov lvi.iSubItem,0 mov lvi.iItem,0 .WHILE n>0 mov eax,lvi.iItem mov lvi.lParam,eax INVOKE SendMessage,hListView,LVM_SETITEM,0,ADDR lvi inc lvi.iItem dec n .ENDW ret update_item ENDP
¤W±¤w¸g¤¶²Ð¹L´XÓ¦³Ãö²M³æÀ˵ø±±¨î¶µªº°T®§¡A¦p LVM_SETVIEW ¬O¥Î¨Ó§ïÅÜÅã¥Ü¤è¦¡¡FLVM_GETCOLUMN¡BLVM_SETCOLUMN¡BLVM_DELETECOLUMN °T®§¡A¤À§O¨ú±o¡B§ïÅÜ ( ¥ç§Y³]©w )¡B§R¥h²M³æÀ˵ø±±¨î¶µªº¬YÓÄæ¦ì¡FLVM_INSERTITEM¡BLVM_SETITEM¡BLVM_GETITEM¡A¤À§O¥Î¨Ó·s¼W¡B³]©w¡B¨ú±o¶µ¥Ø¡C¨Æ¹ê¤W¡AÁÙ¦³³\¦h¦³Ãö²M³æÀ˵ø±±¨î¶µªº°T®§¡A½Ð¬d¾\ MSDN¡A©³¤U¶È¦C¥X«Ý·|½d¨Ò»Ýn¥Î¨ìªº°T®§¡CList view ©Ò¦³ªº°T®§¶}ÀY¥|Ó¦r³£¬O¡uLVM_¡v¡Aªí¥Ü list view message ¤§·N¡C
³oÓ°T®§¬O¥Î¨Ó²Îp²M³æÀ˵ø±±¨î¶µùئ³´XÓ¶µ¥Ø¡Aµ{¦¡¦p¤U¡G
INVOKE SendMessage,hListView,LVM_GETITEMCOUNT,wParam,lParam
¨ä¤¤ wParam ©M lParam ³£¥²¶·³]¬° 0¡A¶Ç¦^Ȧs©ó EAX¡A§Y¶µ¥ØӼơC
³oÓ°T®§¬O¥Î¨Ó¨ú±o·í«eÅã¥Ü¤è¦¡ªº¯x§ÎÃä¬É¡A¦p¤U±µ{¦¡¡G
INVOKE SendMessage,hListView,LVM_GETITEMRECT,wParam,lParam
wParam ¬O¶µ¥Øªº¯Á¤ÞÈ¡AlParam ¬O RECT µ²ºcÅé¦ì§}¡C¦¹°T®§·|§â¯Á¤ÞȬ° wParam ªº¶µ¥Ø©Ò¦û¥Îªº¯x§Î¶ñ¤J lParam ©Ò«üªºµ²ºcÅéùØ¡CLVM_GETITEMRECT ÁÙ¥i¥H¿ï¾Ü¬O¹Ï¥Ü©Î¬O¶µ¥Ø¦WºÙ¡K¡K©Ò¦û¥Îªº¯x§Î¡A¤èªk¬O©I¥s SendMessage «e¡A¥ý³]©w RECT ªº left Äæ¦ì¡C¦¹Äæ¦ì¥i¥H¬O¤U±¥|ºØ¼ÆÈ¡G
³oÓ°T®§¬O¥Î¨Ó¨ú±o¬YÓ¶µ¥Ø©Î¬YÓ¤l¶µ¥Øªº¦WºÙ¡A¤èªk¬O©I¥s SendMessage¡G
INVOKE SendMessage,hListView,LVM_GETITEMTEXT,wParam,lParam
¨ä¤¤ wParam ¬On¨ú±oªº¶µ¥Ø¯Á¤ÞÈ¡AlParam ¬O LVITEM µ²ºcÅé¦ì§}¡C¦pªGn¨ú±o¬YÓ¶µ¥Øªº¦WºÙ¡ALVITEM ªº iSuItem ¥²¶·¬° 0¡AiItem ¥i¤£¶ñ¡A¦]¬°¦b wParam ¤¤¤w«ü©w¡A¦Ó pszText¡BcchTextMax ¤À§O¥Nªín¨ú±oªº¦WºÙ¦s©ñ¦ì§}¤Î¸Ó¦ì§}ªºªø«×¡A¥²¶·¦b©I¥s SendMessage ¤§«e¶ñ¦n¡C¦pªGn¨ú±o¬YÓ¤l¶µ¥Øªº¦WºÙ¡ALVITEM ªº iSuItem ¥²¶·³]¬°¸Ó¤l¶µ¥Øªº¯Á¤ÞÈ¡C
·íµM¡A±z¤]¥i¥H¥Î LVM_GETITEM ¨Ó°µ LVM_GETITEMTEXT °µªº¨Æ¡A¦ý¬O LVITEM ¤¤ªº iItem ´N¥²¶·¶ñ¦n¾A·íªº¼ÆÈ¡C¦¹¥~ LV_GETITEM ©Ò¯àÀò±oªº¸ê®Æ¤ñ LVM_GETITEMTEXT ¦h¡C
´ú¸Õ²M³æÀ˵ø¤ºªº¬Y¤@ÂI¡A¸¨¦bþ¤@Ó¶µ¥Ø¤W¡C¤èªk¬O©I¥s SendMessage¡G
INVOKE SendMessage,hListView,LVM_HITTEST,wParam,lParam
°Ñ¼Æ wParam ¥²¶·¬O¹s¡AlParam ¬O¤@Ó¦ì§}«ü¼Ð¡A«ü¦V LVHITTESTINFO µ²ºcÅé ( ¤]ºÙ¬° LV_HITTESTINFO µ²ºcÅé )¡ALVHITTESTINFO µ²ºcÅ骺¦UÄæ¦ì¬O¡G
LVHITTESTINFO STRUCT pt POINT <> flags DWORD ? iItem DWORD ? iSubItem DWORD ? LVHITTESTINFO ENDS
ºX¼Ð | ¼ÆÈ | »¡©ú |
LVHT_NOWHERE | 1 | ´ú¸ÕÂI¦b²M³æÀ˵øªº¤u§@°Ï¤º¡A¦ý¤£¦b¶µ¥Ø¤W ( ¦pªG¶µ¥Ø¤Ó¤Ö¡A²M³æÀ˵ø¤U±·|ªÅ¥Õ¡A´N¥i¯à¬° LVHT_NOWHERE ) |
LVHT_ONITEMICON | 2 | ´ú¸ÕÂI¦b¶µ¥Øªº¹Ï¥Ü¤W |
LVHT_ONITEMLABEL | 4 | ´ú¸ÕÂI¦b¶µ¥Øªº¦WºÙ¤W |
LVHT_ONITEMSTATEICON | 8 | ´ú¸ÕÂI¦b¶µ¥Øªºª¬ºA¹Ï®×¤W |
LVHT_ONITEM | 0Eh | ´ú¸ÕÂI¦b¶µ¥Ø¥ô¦ó¤@³B¡A¨ä¹ê¥¦¬O LVHT_ONITEMICON¡BLVHT_ONITEMLABEL ¤Î LVHT_ONITEMSTATEICON ªº OR ¹Bºâµ²ªG |
LVHT_ABOVE | 8 | ´ú¸ÕÂI¸¨¦b¤u§@°Ï¤W¤è ( «ü¦b¿Ã¹õ¤W¡A¤u§@°Ï¥~±ªº¤W¤è ) |
LVHT_BELOW | 10h | ´ú¸ÕÂI¸¨¦b¤u§@°Ï¤W¤è ( «ü¦b¿Ã¹õ¤W¡A¤u§@°Ï¥~±ªº¤U¤è ) |
LVHT_TORIGHT | 20h | ´ú¸ÕÂI¸¨¦b¤u§@°Ï¥k¤è ( «ü¦b¿Ã¹õ¤W¡A¤u§@°Ï¥~±ªº¥k¤è ) |
LVHT_TOLEFT | 40h | ´ú¸ÕÂI¸¨¦b¤u§@°Ï¥ª¤è ( «ü¦b¿Ã¹õ¤W¡A¤u§@°Ï¥~±ªº¥ª¤è ) |
LVHT_EX_GROUP_STATEICON | 1000000h | ´ú¸ÕÂI¸¨¦b¸s²Õªºª¬ºA¹Ï¥Ü¤W¡A¥u¦³ XP ¤Î¨ä¥H«áªº¨t²Î¥i¨Ï¥Î |
LVHT_EX_GROUP_SUBSETLINK | 2000000h | |
LVHT_EX_GROUP_HEADER | 10000000h | ´ú¸ÕÂI¸¨¦b¸s²Õ¼ÐÃD¤W¡A¥u¦³ XP ¤Î¨ä¥H«áªº¨t²Î¥i¨Ï¥Î |
LVHT_EX_GROUP_FOOTER | 20000000h | ´ú¸ÕÂI¸¨¦b¸s²Õ¶¸} ( footer ) ¤W¡A¥u¦³ XP ¤Î¨ä¥H«áªº¨t²Î¥i¨Ï¥Î |
LVHT_EX_GROUP_COLLAPSE | 40000000h | ´ú¸ÕÂI¸¨¦b¸s²Õªº§éÅ|«ö¶s¤W¡A¥u¦³ XP ¤Î¨ä¥H«áªº¨t²Î¥i¨Ï¥Î |
LVHT_EX_GROUP_BACKGROUND | 80000000h | ´ú¸ÕÂI¸¨¦b¬YÓ¸s²Õ¤º¦ý¬O¦b¶µ¥Ø¤§¶¡¡A¥u¦³ XP ¤Î¨ä¥H«áªº¨t²Î¥i¨Ï¥Î |
LVHT_EX_GROUP | 0F3000000h | ¬O LVHT_EX_GROUP_BACKGROUND¡BLVHT_EX_GROUP_COLLAPSE¡BLVHT_EX_GROUP_FOOTER¡BLVHT_EX_GROUP_HEADER¡BLVHT_EX_GROUP_STATEICON¡BLVHT_EX_GROUP_SUBSETLINK §@ OR ¹Bºâªºµ²ªG |
LVHT_EX_ONCONTENTS | 4000000h | ´ú¸ÕÂI¸¨¦b¶µ¥Øªº¹Ï¥Ü©Î¦WºÙ¤W¡A¥B¤£¸¨¦bI´º¡A¥u¦³ XP ¤Î¨ä¥H«áªº¨t²Î¥i¥H¨Ï¥Î |
LVHT_EX_FOOTER | 8000000h | ´ú¸ÕÂI¸¨¦b²M³æÀ˵øªº¶¸}¤W¡A¥u¦³ XP ¤Î¨ä¥H«áªº¨t²Î¥i¥H¨Ï¥Î |
Y©I¥s SendMessage «á¡A¦¨¥\ªð¦^¡Aªð¦^Ȭ°´ú¸ÕÂI©Ò¦b¤§¶µ¥Ø¯Á¤ÞÈ¡FY¥¢±Ñ¡Aªð¦^¡Ð1¡C
³oÓ°T®§¬O³]©w icon view ¤¤¹Ï¥Üªº¶¡¹j¶ZÂ÷¡A¤èªk¬O©I¥s SendMessage¡G
INVOKE SendMessage,hListView,LVM_SETICONSPACING,wParam,lParam
°Ñ¼Æ wParam ¥²¶·¬O¹s¡AlParam ¬On³]©wªº¶¡¹j¶ZÂ÷¡A¥HÂI¬°³æ¦ì¡A§C¦r²Õªº¼ÆÈ¥Nªí¤ô¥¼e«× ( ¤]´N¬O¶¡¹j )¡F°ª¦r²Õªº¼ÆÈ¥Nªí««ª½°ª«× ( ¶ZÂ÷ )¡C³o¨âÓ¼ÆȬO¥Ñ¶µ¥Ø©Ò¦ûµe±ªº¥ª¤W¨¤¶}©lºâ°_¡A¦pªG³o¨âÓ¼ÆȤñ¹Ï¥Ü¼e«×¡B°ª«×¤pªº¸Ü¡A¶µ¥Ø´N·|«Å|¦b¤@°_¡A¦]¦¹³Ì¦nn¤ñ¹Ï¥Ü¨Ó±o¤j¨Ç¡A¥t¥~¤]n¦Ò¼{¶µ¥Ø¦WºÙªº¤j¤p¡C
¦¹°T®§¬O¥Î¨ÓÀË´ú¬YÓÂI¸¨¦b²M³æÀ˵øªºþ¤@Ó¤l¶µ¥Ø¤W¡C©I¥s¤è¦¡¬°¡J
INVOKE SendMessage,hListView,LVM_SUBITEMHITTEST,wParam,lParam
¨ä¤¤ wParam ¥²¶·¬O 0¡AlParam ¬O«ü¦V¤@ÓºÙ¬° LVHITTESTINFO µ²ºcÅ骺¦ì§}¡CLVHITTESTINFO ¦UÄæ¦ì¨£ LVM_HITTEST¡CLVHITTESTINFO µ²ºcÅ餤ªº pt ´N¬On´ú¸ÕªºÂI®y¼Ð¡A¦¹®y¼Ð¬O¥H²M³æÀ˵ø±±¨î¶µªº¤u§@°Ï¬°ìÂI¡A¦p¥k¹Ï¬õ¦â½bÀY¦yºÝ©Ò«ü¤§³B¡C
¦b¥H LVM_SUBITEMHITTEST ¬°°Ñ¼Æ©I¥s SendMessage ¤§«e¡AÀ³¥ý¶ñ¦n pt Äæ¦ìªº´ú¸ÕÂI®y¼Ð¡A©I¥s¦¨¥\«á¡A¨t²Î·|¦b iItem¡BiSubItem¡BiGroup ¶ñ¦n¸ÓÂI¸¨¦bþ¤@Ó¶µ¥Ø¡B¤l¶µ¥Ø¡B¸s²Õ¡FY¥¢±Ñ¡A«h³o¨ÇÄæ¦ì¬°¡Ð1¡C
³Ì«á¤p¤ì°¸ªþ¤W¤@Ó¨Ò¤l¡JSELICON¡A¥¦¥i¥HÅý¨Ï¥ÎªÌ¿ï¾Ü¤@ӹϥÜÀÉ¡B¥i°õ¦æÀÉ¡A©Î¬O°ÊºA³sµ²µ{¦¡®w¡AµM«á SELICON ·|§â¸ÓÀɤ¤©Ò¦³¹Ï¥ÜÂ^¨ú¥X¨Ó¡A¨ÃÅã¥Ü¦b²M³æÀ˵ø±±¨î¶µùØ¡AÅý¨Ï¥ÎªÌ¦b¨ä¤¤¬D¿ï¤@ӹϥܨæs¦¨¹Ï¥ÜÀÉ¡C¨äì©l½X¥i«ö¦¹³B¤U¸ü¡C