¨Ï¥Î¹L¹Ï§Î¬É±§@·~¨t²Î¡A¦p Mac OS¡BIBM OS/2¡BMicrosoft Windows¡Aªº¤H¡AÀ³¸Ó´¿¸g¾Þ§@¹L¥H·Æ¹«©ì©ñ ( drag and drop ) ªº¥\¯à¡C¨Ò¦p¦b·L³nªº Windows §@·~¨t²ÎùØ¡A§âÀÉ®×Á`ºÞ¤ºªºÀɮשì¨ì¸ê·½¦^¦¬µ©¡C¬Æ¦Ü¦³®ÉÔ¡A¤]¯à§â¿ï©wªº¸ê®Æ¡A¥H©ì©ñªº¤è¦¡¡A©ñ¨ì¥»¨©Î¥t¤@Óµøµ¡¡C¨Ò¦p¦b WORD ùØ¡A´N¥i¥H§â¤@¬q¤å¦r¤Ï¥Õ¡Aªí¥Ü¤w¿ï©w³o¬q¤å¦r¡AµM«á§â·Æ¹«´å¼Ð²¾¨ì³o¬q¤å¦r¤W¡A«ö¦í·Æ¹«¥ªÁ䤣©ñ¡A´N¯à°÷©ìµÛ³o¬q¤å¦r²¾¨ì¥t¤@Ó¦a¤è ( ¥i¯à¬O¨ä¥Lµøµ¡¡A¤]¥i¯à¬O WORD ¥»¨ªºµøµ¡ )¡C¨Ï¥ÎªÌ¾Þ§@³o¨âºØ©ì©ñ¥\¯à¡A¤£·|·Pı¦³¦ó®t²§¡A¦ý¬O¦bµ{¦¡ªº¹ê²{¤W¡A«o¬O¤£¦Pªº¾÷¨î¡C¦b³o¤@³¹ùØ¡A¤p¤ì°¸¥ý±´°QÀɮתº©ì©ñ¡C
©ì©ñÀɮתº°Ê§@¹Lµ{¦p¤U¡A¥ý¦b¤@Óµøµ¡¤º¡A¿ï©w¤@өΤ@Ó¥H¤WªºÀɮסAµM«á§â·Æ¹«´å¼Ð²¾¨ì³o¨ÇÀɮ׹ϥܤW¡A«ö¦í·Æ¹«¥ªÁ䤣©ñ¡A¦A²¾°Ê·Æ¹«´å¼Ð¨ì¥t¤@Óµøµ¡¡A³Ì«á©ñ¶}·Æ¹«¥ªÁä¡A´N§¹¦¨©ì©ñ°Ê§@¡C¿ï©w¤@өΤ@Ó¥H¤WªºÀɮשҦbªºµøµ¡¡AºÙ¬°¡u©ì©ñª«¥óªº¨ÑÀ³ªÌ¡v¡F¦Ó·Æ¹«¥ªÁäÄÀ©ñ®É¡A´å¼Ð©Ò¦bªºµøµ¡ºÙ¬°¡u©ì©ñ¼Ðªº¡vµøµ¡¡C
¨Ò¦p©³¤Uªº¹Ï¡A¤p¤ì°¸¶}±ÒÀÉ®×Á`ºÞ¨â¦¸¡A¥ªÃ䪺ÀÉ®×Á`ºÞµøµ¡¤Á´«¨ì¡u§Úªº¤å¥ó¡v¡A¥kÃ䪺ÀÉ®×Á`ºÞµøµ¡¦b¡uE:\HomePage\SOURCE\Win32\2048¡v¤l¥Ø¿ý¡A¦pªGn¡uE:\HomePage\SOURCE\Win32\2048¡v¤ºªº 2048.ASM Àɮ׽ƻs¨ì¡u§Úªº¤å¥ó¡v¸Ì¡A¥i¥H§â·Æ¹«´å¼Ð²¾¨ì¥kÃäÀÉ®×Á`ºÞªº¡u2048.ASM¡vÀɮפW¡AÀ£¦í·Æ¹«¥ªÁ䤣©ñ¡AµM«á©ì¦²·Æ¹«´å¼Ð¨ì¥ªÃ䪺ÀÉ®×Á`ºÞµøµ¡¦AÄÀ©ñ·Æ¹«¥ªÁä¡A³o®É Windows ¨t²Î·|§â¡u2048.ASM¡v½Æ»s¨ì¥ªÃ䪺ÀÉ®×Á`ºÞ©ÒÅã¥Üªº¥Ø¿ýùØ¡A¦p¤U¹Ï¬õ½uªº©ì¦²¹Lµ{¡C¥H¦¹¨Ò¤l¦Ó¨¥¡A¥kÃ䪺ÀÉ®×Á`ºÞ´N¬O¡u©ì©ñª«¥óªº¨ÑÀ³ªÌ¡v¡A¦Ó¥ªÃ䪺ÀÉ®×Á`ºÞ«h¬O¡u©ì©ñ¼Ðªº¡v¡C¦b©ì¦²¹Lµ{¤¤¡A·Æ¹«´å¼Ð¤W·|Åã¥Ü²H²Hªº¡u2048.ASM¡v¹Ï¥Ü¤Î¨ä¸ê®Æ¡A¦Ó·Æ¹«´å¼Ð¥k¤U¤è·|¦³¤@Ó¸¹¡Aªí¥Ü½Æ»sÀɮסF¦pªG·Æ¹«´å¼Ð¥k¤U¤è´N¨S¦³¥ô¦ó²Å¸¹¡Aªí¥Ü§âÀÉ®×·|³Q²¾¨ì¡u©ì©ñ¼Ðªº¡v¤º¡A¦ÓìÀÉ®×·|³Q§R°£¡A³oºØ±¡§Îµo¥Í¦b¡u©ì©ñ¼Ðªº¡v»P¡u©ì©ñª«¥ó¨ÑÀ³ªÌ¡v³£¦b¦P¤@ӺϺо÷¤º¡C
·íÀɮץѡu©ì©ñª«¥óªº¨ÑÀ³ªÌ¡v³Q©ì¦²¨ì¡u©ì©ñ¼Ðªº¡vªºµøµ¡«á¡A¡u©ì©ñ¼Ðªº¡vªºµøµ¡¥i¥H¹ïÀɮק@¤£¦Pªº³B²z¡C¨Ò¦p§â¯Â¤å¦rÀÉ©ì¨ì¡uUltraEdit-32¡vùØ¡A¸Ó¯Â¤å¦rÀÉ·|¦Û°Ê¶}±Ò¡Aµ¥«Ý½s¿è¡F§âÀɮש즲¨ì¡u¸ê·½¦^¦¬µ©¡v«á¡A¸ÓÀÉ®×´N³Q§R°£¡F§â *.EXE ¥i°õ¦æÀɮש즲¨ì OllyDbg.exe ùØ¡A·|¶}±Ò¸Ó¥i°õ¦æÀÉ¡A¶i¦æ°£¿ù¹Lµ{¡C
n¦¨¬°¡u©ì©ñ¼Ðªº¡vªºµøµ¡¡A¨ä¹ê«Ü²³æ¡A¥un§i¶D Windows ¨t²Î¡A§Ú¥i¥H±µ¨ü©ì©ñ¦Ó¨ÓªºÀɮקY¥i¡A³o¥un¨âÓ¨BÆJ¡G
Ãö©ó²Ä¤@¨B¡An¨Ïµøµ¡¨ã¦³ WS_EX_ACCEPTFILES ©µ¦ù·®æ¡A¦³¨âºØ¤èªk¡A¤@¬O©I¥s CreateWindowEx «Ø¥ßµøµ¡®É¡A²Ä¤@ӰѼƴN¬O©µ¦ù·®æ¡A¶·¥]§t WS_EX_ACCEPTFILES¡C²Ä¤GºØ¤èªk¬O¡A¦pªGµøµ¡¤w¸g«Ø¥ß¦n¤F¡A¦ýn¨Ïµøµ¡¨ã¦³ WS_EX_ACCEPTFILES¡A¥i¥H©I¥s DragAcceptFiles API¡CDragAcceptFiles ªºì«¬¦p¤U¡G
DragAcceptFiles PROTO hWnd:HWND,fAccept:BOOL
¨ä¤¤ hWnd ¬O¡u©ì©ñ¼Ðªº¡vªºµøµ¡¥N½X¡AfAccept ¦³¨âºØ¿ï¾Ü¡ATRUE ¥Nªí¨Ï«ezµøµ¡¨ã¦³ WS_EX_ACCEPTFILES ©µ¦ù·®æ¡FFALSE «h¥Nªí¨Ï¨ä¤£¨ã¦¹©µ¦ù·®æ¡C¨Æ¹ê¤W¡Aµøµ¡ªº©µ¦ù·®æ¬O¤@Ó 32 ¦ì¤¸ªº¼ÆÈ¡A¨CӦ줸¥Nªí¤@Ó©µ¦ù·®æ¡AWS_EX_ACCEPTFILES ¬O¨ä¤¤ªº²Ä¤TӦ줸¡A¦¹¦ì¤¸¬° 0¡Aªí¥Ü¤£¨ã¦³ WS_EX_ACCEPTFILES¡FY¦¹¦ì¤¸¬° 1¡Aªí¥Ü¨ã¦³ WS_EX_ACCEPTFILES¡C·í¤@µøµ¡¨ã¦³ WS_EX_ACCEPTFILES ©µ¦ù·®æ®É¡A«h¦¹µøµ¡´N¥i¥H±µ¨ü¨Ó¦Û·Æ¹«©ì¦²¦ÓÄÀ©ñªºÀɮסC¦pªG¨Ï¥ÎªÌ±NÀɮשì¨ì¦¹µøµ¡¤W±¡A·Æ¹«´å¼Ð¦p¤W¹Ï©Ò¥Ü¡A·|Åܦ¨¡Aªí¥Ü¥i±µ¨ü©ì¹L¨ÓªºÀɮסF¦pªG¨Ï¥ÎªÌ±NÀɮשì¨ì¨S¦³ WS_EX_ACCEPTFILES ©µ¦ù·®æªºµøµ¡¤W¡A·Æ¹«´å¼Ð·|Åܦ¨¡Aªí¥Ü¤£¯à±µ¨ü©ì¹L¨ÓªºÀɮסC¤£¹L¡A¤£¦Pªº³nÅé¡A·Æ¹«´å¼Ð¹Ï¥Ü¥i¯à¤£¦P¡A¦ýÁo©úªº§AÀ³¥i²q±o¥X¨Ó¡C
¯à¦¨¬°¡u©ì©ñ¼Ðªº¡vªºµøµ¡¡A°£¤Fn¨ã¦³ WS_EX_ACCEPTFILES ¤§¥~¡AÁÙn¦b¨äµøµ¡¨ç¦¡¤º¡A³B²z WM_DROPFILES °T®§¡C·í¨Ï¥ÎªÌ©ì¦²Àɮרì¡u©ì©ñ¼Ðªº¡vªºµøµ¡¡A¨ÃÄÀ©ñ·Æ¹«¥ªÁä®É¡AWindows ¨t²Î·|§â WM_DROPFILES °T®§µo°eµ¹·Æ¹«´å¼Ð©³¤Uªº¡u©ì©ñ¼Ðªº¡vµøµ¡ªºµøµ¡¨ç¦¡¡CWM_DROPFILES °T®§¤¤ªº wParam ¬O¥Ñ¡u©ì©ñª«¥óªº¨ÑÀ³ªÌ¡v©Ò´£¨Ñªº°O¾ÐÅé°Ï¶ô¥N½X¡AºÙ¬° hDrop¡C¦¹°O¾ÐÅé°Ï¶ôÄÝ©ó¥i²¾°Êªº°O¾ÐÅé°Ï¶ô ( ¤°»ò¬O¥i²¾°Êªº°O¾ÐÅé°Ï¶ô¡A½Ð°Ñ¾\²Ä¤Q¥|³¹°t¸m°O¾ÐÅé )¡A³oÓ¥i²¾°Êªº°O¾ÐÅé°Ï¶ô¨ä¹ê¤º§t¤@Ó¥s°µ DROPFILES ªºµ²ºcÅé¤Î³Q¨Ï¥ÎªÌ¿ï©wªºÀɮצWºÙ¡A³o¨ÇÀɮצWºÙ³£¬O§¹¾ãªºÀɮצWºÙ¡A¥]§tºÏºÐ¾÷¦W¤Î¸ô®|¦WºÙ¡C°²¦pn±q hDrop ¨ú¥XÀɮצWºÙ¡A¸û¤è«Kªº°µªk¬O©I¥s DragQueryFile API¡C
DragQueryFile ¬O¥Î¨Ó±q hDrop ùØ´£¨úÀɮצWºÙªº API¡A¨ä쫬¬O¡G
DragQueryFile PROTO hDrop:HDROP,iFile:DWORD,lpszFile:LPTSTR,cch:DWORD
hDrop ¬O©ì©ñª«¥ó®É¡A¡u©ì©ñª«¥óªº¨ÑÀ³ªÌ¡v²£¥Íªº°O¾ÐÅé°Ï¶ô¥N½X¡CiFile ¬O²Ä´XÓÀɮסA±q¹s¶}©l¡C§ÚÌ©ì©ñÀɮ׮ɡA¥i¯à©ì©ñ¤@ÓÀɮסA¤]¥i¥H¦P®É©ì©ñ¦n´XÓÀɮסAiFile ´N¬O«ün¨ú±oþ¤@ÓÀɮתºÀɦW¡ClpszFile ¬O¤@Ó¦ì§}«ü¼Ð¡A«ü¦Vn¦s©ñÀɦWªº½w½Ä°Ï¦ì§}¡A·í DragQueryFile ªð¦^®É¡A·|§âÀɦW¦s¨ì³oÓ¦ì§}¡Ccch ¬O½w½Ä°Ïªºªø«×¡A¥H¦r¤¸¬°³æ¦ì¡C¦pªG DragQueryFile ¦¨¥\ªº§âÀɦW¦s¤J lpszFile ©Ò«üªº¦ì§}®É¡ADragQueryFile ·|¶Ç¦^ÀɦWªºÁ`¦r¤¸¼Æ ( ¤£¥]§t NULL ¦r¤¸ )¡C
DragQueryFile ÁÙ¦³¥t¥~¨âºØ¦³½ì¥Îªk¡A¤]«D±`¦³¥Î¡C²Ä¤@ºØ¬O¡A¦pªG iFile ³]¬° -1¡ADragQueryFile ·|©¿²¤ lpszFile »P cch ¨â°Ñ¼Æ¡A¦Ó¶Ç¦^¨Ï¥ÎªÌÁ`¦@©ì¦²¤F¦h¤ÖÓÀɮסC²Ä¤GºØ¬O¡A¦pªG lpszFile ³]¬°¹s¡A¨º»ò DragQueryFile ·|ªð¦^²Ä iFile ÓÀɮתºÀɦW©Ò»Ýªº¦r¤¸Á`¼Æ ( ¤£¥]§t NULL ¦r¤¸ )¡C
DragFinish ¬O¥Î¨ÓÄÀ©ñ¡u©ì©ñª«¥óªº¨ÑÀ³ªÌ¡v²£¥Íªº°O¾ÐÅé°Ï¶ô¥N½X¡A¤@¯ë¬O¦b³B²z WM_DROPFILES °T®§³Ì«á±¡A¦pªG¨S¦³³o¼Ë§@¡AWindows ´N·|¦bµ{¦¡µ²§ô«á¡AÀ°±z³B²z±¼°O¾ÐÅé°Ï¶ô¡C¨ä쫬¬°¡G
DragFinish PROTO hDrop:HDROP
hDrop ¬°nÄÀ©ñªº©ì©ñ¥N½X¡CDragFinish ¨S¦³ªð¦^È¡C
¦pªG·Qn¨ú±o¨Ï¥ÎªÌ¦b©ì©ñ¹Lµ{¡AÄÀ©ñ·Æ¹«¥ªÁä®É·Æ¹«´å¼Ð©Ò¦b®y¼Ð¡A¥i¥H©I¥s DragQueryPoint¡A¨ä쫬¬°¡G
DragQueryPoint PROTO hDrop:HDROP,lppt:DWORD
²Ä¤@ӰѼƬO³Q©ì©ñ¦Ó¨Óªº°O¾ÐÅé°Ï¶ô¥N½X¡AhDrop¡F²Ä¤GӰѼƫh¬O¦ì§}«ü¼Ð¡A«ü¦V POINT µ²ºcÅé¡A·í·Æ¹«¥ªÁäÄÀ©ñ®É¡A·Æ¹«´å¼Ð®y¼Ð±N³Q DragQueryPoint ¦s¤J¦¹ POINT µ²ºcÅ餺¡C¦pªGªð¦^Ȭ°«D¹s¡Aªí¥ÜÄÀ©ñ·Æ¹«¥ªÁä®É¡A·Æ¹«´å¼Ð¦bµøµ¡ªº¤u§@°Ï¤º¡F¦pªGªð¦^Ȭ°¹s¡Aªí¥ÜÄÀ©ñ®Éµo¥Í¦b¤u§@°Ï¥~¡C
©³¤U¤¶²Ð¤@Ó½d¨Òµ{¦¡¡ADROP.ASM¡C°õ¦æ«á·|¥X²{¤@Ó¹ï¸Ü²°¡A¤¤¶¡¦³¤@Ӷ¦⪺¤lµøµ¡¡A¦pªG§â¥ô¦ó¤@ÓÀɮשì¶i³oÓ¤lµøµ¡¤º¡A¸Ó¤lµøµ¡·|¥H¤Q¤»¶i¦ìªº¤è¦¡Åã¥Ü³Q©ì¤JªºÀɮפº®e¡C©³¤Uªº¹Ï¤ù¬O¦bÀÉ®×Á`ºÞ¤U¡A§â¡uC:\boot.ini¡v©ì¶i¶Â¦âªº¤lµøµ¡ùئӧe²{ªºµe±¡G
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 |
.586
.MODEL FLAT,STDCALL
OPTION CASEMAP:NONE
__UNICODE__ EQU 1
FontHeight EQU 15 ;ÅÞ¿è¦r§Î°ª«×
FontWidth EQU 7 ;ÅÞ¿è¦r§Î¼e«×
INCLUDE WINDOWS.INC
INCLUDE GDI32.INC
INCLUDE KERNEL32.INC
INCLUDE SHELL32.INC
INCLUDE USER32.INC
INCLUDELIB GDI32.LIB
INCLUDELIB KERNEL32.LIB
INCLUDELIB SHELL32.LIB
INCLUDELIB USER32.LIB
;*************************************************************************************************************
.CONST
szClassName DW 44h,52h,4fh,50h,5fh,54h,45h,53h,54h,0h ;DROP_TEST
szIcon DW 45h,59h,45h,0h ;EYE
szAppName DW 6e2ch,8a66h,62d6h,653eh,7684h,300ch,653eh,300dh,0h ;´ú¸Õ©ì©ñªº¡u©ñ¡v
szHelp DW 4f7fh,7528h,8005h,53efh,4ee5h,7528h,6ed1h,9f20h,62d6h,66f3h ;¨Ï¥ÎªÌ¥i¥H¥Î·Æ¹«©ì¦²
DW 4efbh,4f55h,4e00h,500bh,6a94h,6848h,5230h,6b64h,8996h,7a97h ;¥ô¦ó¤@ÓÀɮר즹µøµ¡
DW 5167h,0ff0ch,8a72h,6a94h,6848h,7684h,5167h,5bb9h,6703h,88abh ;¤º¡A¸ÓÀɮתº¤º®e·|³Q
DW 986fh,793ah,5728h,8996h,7a97h,88cfh,3002h,0h ;Åã¥Ü¦bµøµ¡ùØ¡C
szFontFamily DW 43h,6fh,75h,72h,69h,65h,72h,20h,4eh,65h,77h,0h ;Courier New
szCrtDateFmt DW 67h,67h,79h,79h,79h,79h,2fh,4dh,2fh,64h,64h,0h ;ggyyyy/M/dd(Åã¥Ü«ØÀɮɶ¡)
szCrtTimeFmt DW 20h,48h,48h,3ah,6dh,6dh,3ah,73h,73h,3000h,0 ; HH:mm:ss
szAddrFmt DW 25h,30h,38h,58h,28h,25h,30h,39h,64h,29h,0h ;%08X(%09d)
szFileSizeFmt DW 25h,64h,4f4dh,5143h,7d44h,3000h,0h ;%d¦ì¤¸²Õ¡@
szOffsetAddr DW 504fh,79fbh,4f4dh,5740h,0h ;°¾²¾¦ì§}
szHex DW 5341h,516dh,9032h,4f4dh,5167h,5bb9h,0h ;¤Q¤»¶i¦ì¤º®e
szUnicodeTitle DW 842ch,570bh,78bch,0 ;¸U°ê½X
szASCIITitle DW 41h,53h,43h,49h,49h,0 ;ASCII
szShortKey DW 48h,6fh,6dh,65h,0ff1ah,7b2ch,4e00h,9801h,3000h,45h,6eh,64h ;Home¡G²Ä¤@¶¡@End
DW 0ff1dh,6700h,672bh,9801h,3000h,50h,67h,55h,70h,0ff1dh,4e0ah ;¡×³Ì¥½¶¡@PgUp¡×¤W
DW 4e00h,9801h,3000h,45h,6eh,64h,0ff1dh,6700h,672bh,9801h,3000h ;¤@¶¡@End¡×³Ì¥½¶¡@
DW 45h,73h,63h,0ff1dh,96e2h,958bh,0h ;Esc¡×Â÷¶}
rcTitleAddr RECT <0,FontHeight,133,FontHeight*2> ;¼ÐÃDÄæùتº¦ì§}°Åµô¯x§Î
rcTitleHex RECT <134,FontHeight,484,FontHeight*2> ;¼ÐÃDÄæùتº¤Q¤»¶i¦ì¼ÆȰŵô¯x§Î
rcTitleStr RECT <485,FontHeight,608,FontHeight*2> ;¼ÐÃDÄæùتº¦r¦ê°Åµô¯x§Î
rcTitle RECT <0,FontHeight,608,FontHeight*2> ;¼ÐÃDÄ檺°Åµô¯x§Î
rcShortKey RECT <0,FontHeight*18,608,FontHeight*19> ;«öÁ仡©úªº°Åµô¯x§Î
rcFileName RECT <0,0,608,FontHeight> ;Åã¥ÜÀɦWªº°Åµô¯x§Î
rcRedraw RECT <0,FontHeight*2,608,FontHeight*18> ;¤¤¶¡«Ã¸°Ï°ìªº¯x§Î
rcClickReresh RECT <485,FontHeight,608,FontHeight*18> ;¨Ï¥ÎªÌ¥H·Æ¹«ÂIÀ»¼ÐÃDÄæ¤Á´«¸U°ê½X©ÎASCII§ó·sµe±
;*************************************************************************************************************
.DATA
hInstance HINSTANCE ? ;¼Ò²Õ¥N½X
hwnd HWND ? ;µøµ¡¥N½X
hMem HGLOBAL ? ;°O¾ÐÅé°Ï¶ô¥N½X
wcex WNDCLASSEX <?>
msg MSG <?>
;¦ì¤¸0¡G0¡Ðªí¥Ü©|¥¼¦³Àɮ׳Q©ì¶iµøµ¡¡F1¡Ðªí¥Ü¤w¦³Àɮ׳Q©ì¶iµøµ¡
;¦ì¤¸1¡G0¡Ðªí¥Ü¦bµøµ¡¥k¤W¨¤¬°ASCII©ÎBIG5¡F1¡Ðªí¥Ü¸U°ê½X
;¦ì¤¸2¡G0¡Ðªí¥Ü¥¼¨ìÀÉ®×µ²§À¡F1ªí¥Ü¤w¬°ÀɮקÀºÝ
flag DD 0
hBlackBrush DD ? ;¶Â¦âµe¨ê
hFont DD ? ;Courier New¦r§Î
dwFileSize DD ? ;©ì¦²¶i¨ÓªºÀɮתø«×
p1stByte DD ? ;¨C¶²Ä¤@Ӧ줸²Õ«ü¼Ð¡A¦bhMemùتº«ü¼Ð¡AYp1stByte¡×0¡A§Y«ü¨ìhMem°_©l¦ì§}
pMax1stByte DD ? ;³Ì¤j¶¼Æ
szFileData DW MAX_PATH DUP (0)
;*************************************************************************************************************
.CODE
;-------------------------------------------------------------------------------------------------------------
;§âÀɮצWºÙ¡BÀɮפj¤p¡B«ØÀɮɶ¡¶ñ¤JszFileDataùØ¡Apfi_CrtTime«ü¦VFILETIMEµ²ºcÅé¡A¬°Àɮ׫إ߮ɶ¡¡FdwFileSize¬°
;¤@Âù¦r²Õ¡AÀɮפj¤p¡F¦bszFileData«e±¤w¸g¦s¦³§¹¾ãªºÀɮצWºÙ¤F
set_file_info PROC USES edi pfi_CrtTime:DWORD
LOCAL ft:FILETIME,syst:SYSTEMTIME
;·j´MÀɦW³Ì«á¤@Ó¦ì§}
mov ax,0
mov ecx,MAX_PATH
lea edi,szFileData
repne scasw
mov WORD PTR [edi-2],3000h
INVOKE wsprintf,edi,OFFSET szFileSizeFmt,dwFileSize
shl eax,1
add edi,eax
INVOKE FileTimeToLocalFileTime,pfi_CrtTime,ADDR ft ;§âUTC®É¶¡Åܦ¨·í¦a®É¶¡(¤¤µØ¥Á°ê¼Ð·Ç®É¶¡)
INVOKE FileTimeToSystemTime,ADDR ft,ADDR syst ;§âFILETIME®æ¦¡ªº·í¦a®É¶¡Åܦ¨SYSTEMTIME®æ¦¡
INVOKE GetDateFormat,LOCALE_USER_DEFAULT,0,ADDR syst,OFFSET szCrtDateFmt,edi,SIZEOF szFileData
dec eax
shl eax,1
mov ecx,SIZEOF szFileData
add edi,eax
sub ecx,eax
INVOKE GetTimeFormat,LOCALE_USER_DEFAULT,0,ADDR syst,OFFSET szCrtTimeFmt,edi,ecx
dec eax
shl eax,1
add edi,eax
ret
set_file_info ENDP
;-------------------------------------------------------------------------------------------------------------
;§âALªº¤º®eÅܦ¨¤Q¤»¶i¦ì¸U°ê½X¡A¦s©óECX©Ò«ü¦ì§}¡A¨CÓAL»Ýn¥|Ӧ줸²ÕªÅ¶¡¦s©ñ
al_to_hex PROC
mov dl,al
shr al,4
and dl,0fh
call trans_and_save
mov al,dl
trans_and_save: add al,"0"
cmp al,"9"
jbe ok00
add al,7
ok00: mov [ecx],ax
add ecx,2
ret
al_to_hex ENDP
;-------------------------------------------------------------------------------------------------------------
display_page PROC USES edi hDC:HDC
LOCAL rcDisplay:RECT ;°Åµô¯x§Î
LOCAL cRow,cHex:DWORD ;cRow¡G¦³16¦æ¡AcHex¡G¨C¦æÅã¥Ü16Ӧ줸²Õ
LOCAL buffer[20h]:WORD
LOCAL string[20]:WORD ;¥Î©óÅã¥Ü³Ì¥kÃ䪺¦r¦ê
LOCAL hbrTitle:HBRUSH
LOCAL pByte:LPSTR ;«ü¦V¬Y¤@¶ªº¨C¤@Ӧ줸²Õªº¦ì§}¡A¤@¶}©lpByte¬°p1stByte
INVOKE SelectObject,hDC,hFont
INVOKE DeleteObject,eax
INVOKE SetBkColor,hDC,0 ;¶Â©³
INVOKE SetTextColor,hDC,0ff00h ;ºñ¦r
test flag,1
jnz dp00
;¨Ï¥ÎªÌ¨S¦³©ì¦²Àɮר즹µøµ¡ùØ
INVOKE GetClientRect,hwnd,ADDR rcDisplay
INVOKE DrawText,hDC,OFFSET szHelp,-1,ADDR rcDisplay,DT_LEFT or DT_WORDBREAK
jmp dp06
;¨Ï¥ÎªÌ¤w©ì¦²Àɮר즹µøµ¡ùØ¡AÅã¥Ü¦¹Àɮפº®e
dp00: mov cRow,10h ;¨C¶Åã¥Ü16¦æ
mov edx,p1stByte
mov rcDisplay.top,FontHeight*2
mov pByte,edx
mov rcDisplay.bottom,FontHeight*3
;¦L¥X³Ì¥ªÃ䪺°¾²¾¦ì§}
dp01: INVOKE wsprintf,ADDR buffer,OFFSET szAddrFmt,pByte,pByte
mov rcDisplay.left,0
mov rcDisplay.right,133
INVOKE DrawText,hDC,ADDR buffer,-1,ADDR rcDisplay,DT_CENTER
;¦L¥X¤¤¶¡³¡¥÷ªº¤Q¤»¶i¦ì¤º®e
mov rcDisplay.left,144
mov rcDisplay.right,144+FontWidth*2
lea edi,string
mov cHex,10h ;¨C¤@¦æ¦³16Ӧ줸²Õªº¸ê®Æ
dp02: mov edx,pByte
cmp edx,dwFileSize
jne dp03
or flag,4 ;¦pªG¤w¨ìÀɮקÀºÝ¡A¦L¥X¤Q¤»¶i¦ì¤º®e°±¤î¡A¨Ã³]©wflagªº²Ä
jmp dp04 ;3¦ì¤¸¬°¤@¡A¥H«K¥u¦L¥X¥kÃ䪺¦r¦ê¤@¦¸§Y¥i
dp03: add edx,hMem
movzx eax,BYTE PTR [edx]
lea ecx,buffer
stosb
call al_to_hex
INVOKE DrawText,hDC,ADDR buffer,2,ADDR rcDisplay,DT_LEFT
;pºâ¤U¤@ÓrcDisplay
mov ecx,FontWidth
shl ecx,1
add ecx,FontWidth ;ECX¡×FontWidth*3
add rcDisplay.left,ecx
add rcDisplay.right,ecx
inc pByte
dec cHex
jnz dp02
dp04: ;¦L¥X¥kÃ䪺¸U°ê½X¦r¦ê©ÎASCII¦r¦ê
sub eax,eax
stosw
mov rcDisplay.left,485
mov rcDisplay.right,485+FontWidth*16
test flag,2
.IF ZERO?
INVOKE DrawTextA,hDC,ADDR string,-1,ADDR rcDisplay,DT_LEFT or DT_SINGLELINE
.ELSE
INVOKE DrawTextW,hDC,ADDR string,-1,ADDR rcDisplay,DT_LEFT or DT_SINGLELINE
.ENDIF
test flag,4
jnz dp05
add rcDisplay.top,FontHeight
add rcDisplay.bottom,FontHeight
dec cRow
jnz dp01
dp05: and flag,0fffffffbh
;³]©w¼ÐÃDÄæÃC¦â¬°¶À©³ÂŦr
INVOKE CreateSolidBrush,0ffffh
mov hbrTitle,eax
INVOKE FillRect,hDC,OFFSET rcTitle,hbrTitle ;¶À¦âµe¨ê¶îº¡¼ÐÃDÄæ
INVOKE SetBkColor,hDC,0ffffh
INVOKE SetTextColor,hDC,0ff0000h
INVOKE DrawText,hDC,OFFSET szOffsetAddr,-1,OFFSET rcTitleAddr,DT_CENTER
INVOKE DrawText,hDC,OFFSET szHex,-1,OFFSET rcTitleHex,DT_CENTER
test flag,2
.IF ZERO?
mov edx,OFFSET szASCIITitle
.ELSE
mov edx,OFFSET szUnicodeTitle
.ENDIF
INVOKE DrawText,hDC,edx,-1,OFFSET rcTitleStr,DT_CENTER
INVOKE FillRect,hDC,OFFSET rcShortKey,hbrTitle
INVOKE DrawText,hDC,OFFSET szShortKey,-1,OFFSET rcShortKey,DT_LEFT
INVOKE FillRect,hDC,OFFSET rcFileName,hbrTitle
INVOKE SetTextColor,hDC,0ffh
INVOKE DrawText,hDC,OFFSET szFileData,-1,OFFSET rcFileName,DT_LEFT
INVOKE DeleteObject,hbrTitle
dp06: ret
display_page ENDP
;-------------------------------------------------------------------------------------------------------------
WndProc PROC hWnd:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
LOCAL ps:PAINTSTRUCT
LOCAL hFile:HFILE
LOCAL fi:BY_HANDLE_FILE_INFORMATION
LOCAL NumberOfBytesRead:DWORD ;¤wŪ¤JªºÀɮפj¤p
.IF uMsg==WM_PAINT
INVOKE BeginPaint,hWnd,ADDR ps
INVOKE display_page,ps.hdc
INVOKE EndPaint,hWnd,ADDR ps
.ELSEIF uMsg==WM_KEYDOWN
.IF wParam==VK_PRIOR ;«ö¤UPage UpÁä
sub p1stByte,100h
jge key_up_ok
mov p1stByte,0
key_up_ok: INVOKE InvalidateRect,hWnd,OFFSET rcRedraw,TRUE
.ELSEIF wParam==VK_NEXT ;«ö¤UPage DownÁä
add p1stByte,100h
mov eax,pMax1stByte
cmp eax,p1stByte
ja key_up_ok
mov p1stByte,eax
jmp key_up_ok
.ELSEIF wParam==VK_HOME ;«ö¤UHomeÁä
mov p1stByte,0
jmp key_up_ok
.ELSEIF wParam==VK_END ;«ö¤UEndÁä
mov eax,pMax1stByte
mov p1stByte,eax
jmp key_up_ok
.ELSEIF wParam==VK_ESCAPE ;«ö¤UEscÁä
jmp wm_close
.ENDIF
.ELSEIF uMsg==WM_DROPFILES
INVOKE DragQueryFile,wParam,0,OFFSET szFileData,MAX_PATH*2 ;¨ú±o¦bhDropùزÄ0ÓÀɮתºÀɦW
INVOKE CreateFile,OFFSET szFileData,GENERIC_READ,0,0,OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL,0
.IF eax==INVALID_HANDLE_VALUE
xor eax,eax
mov p1stByte,OFFSET szHelp
and flag,0fffffffeh
.ELSE
mov hFile,eax
.IF hMem!=0
INVOKE GlobalFree,hMem
.ENDIF
INVOKE GetFileInformationByHandle,hFile,ADDR fi
mov eax,fi.nFileSizeLow
mov dwFileSize,eax
mov edx,eax
add eax,200h
and eax,0fffffff0h
and edx,0ffffff00h
mov pMax1stByte,edx
INVOKE GlobalAlloc,GPTR,eax ;¨ÌÀɮפj¤p°t¸m°O¾ÐÅé°Ï¶ô
mov hMem,eax
mov p1stByte,0
INVOKE ReadFile,hFile,hMem,dwFileSize,ADDR NumberOfBytesRead,0
INVOKE set_file_info,ADDR fi.ftCreationTime
INVOKE CloseHandle,hFile
or flag,1
.ENDIF
INVOKE DragFinish,wParam
INVOKE InvalidateRect,hWnd,0,1
.ELSEIF uMsg==WM_LBUTTONUP
mov eax,lParam
mov edx,lParam
and eax,0ffffh
shr edx,10h
.IF (eax>=rcTitleStr.left)&&(eax<=rcTitleStr.right)&&(edx>=rcTitleStr.top)&&(edx<=rcTitleStr.bottom)
xor flag,2
INVOKE InvalidateRect,hWnd,OFFSET rcClickReresh,TRUE
.ENDIF
.ELSEIF uMsg==WM_CREATE
INVOKE CreateFont,FontHeight,FontWidth,0,0,FW_NORMAL,0,0,0,DEFAULT_CHARSET,0,0,0,\
0,OFFSET szFontFamily
mov hFont,eax
.ELSEIF uMsg==WM_CLOSE
wm_close: INVOKE DestroyWindow,hWnd
.ELSEIF uMsg==WM_DESTROY
INVOKE PostQuitMessage,NULL
.ELSE
INVOKE DefWindowProc,hWnd,uMsg,wParam,lParam
ret
.ENDIF
xor eax,eax
ret
WndProc ENDP
;-------------------------------------------------------------------------------------------------------------
start: INVOKE GetModuleHandle,NULL
mov hInstance,eax
mov wcex.cbSize,SIZEOF WNDCLASSEX
mov wcex.style,CS_HREDRAW or CS_VREDRAW
mov wcex.lpfnWndProc,OFFSET WndProc
mov wcex.cbClsExtra,0
mov wcex.cbWndExtra,0
mov wcex.hInstance,eax
INVOKE LoadIcon,hInstance,OFFSET szIcon;¨ú±o¹Ï¥Ü¥N½X
mov wcex.hIcon,eax ;¦s¤J¹Ï¥Ü¥N½X
mov wcex.hIconSm,eax ;¦s¤J¤p¹Ï¥Ü¥N½X
INVOKE LoadCursor,NULL,IDC_ARROW ;¨ú±o´å¼Ð¥N½X
mov wcex.hCursor,eax ;¦s¤J´å¼Ð¥N½X
INVOKE CreateSolidBrush,0 ;«Ø¥ßÅÞ¿èµe¨ê
mov hBlackBrush,eax
mov wcex.hbrBackground,eax
mov wcex.lpszMenuName,0
mov wcex.lpszClassName,OFFSET szClassName
INVOKE RegisterClassEx,OFFSET wcex ;µù¥Uµøµ¡Ãþ§O
INVOKE CreateWindowEx,WS_EX_ACCEPTFILES,OFFSET szClassName,OFFSET szAppName,WS_OVERLAPPED or \
WS_SYSMENU or WS_MINIMIZEBOX ,660,562,615,315,0,0,hInstance,0
mov hwnd,eax
INVOKE ShowWindow,hwnd,SW_SHOWDEFAULT
INVOKE UpdateWindow,hwnd
.WHILE TRUE
INVOKE GetMessage,OFFSET msg,NULL,0,0
.BREAK .IF !eax
INVOKE TranslateMessage,OFFSET msg
INVOKE DispatchMessage,OFFSET msg
.ENDW
mov eax,msg.wParam ;µ{¦¡µ²§ô
INVOKE ExitProcess,eax
;*************************************************************************************************************
END start
|
©³¤U¬O DROP.RC ªº¤º®e¡G
1 2 3 4
5 6 |
#include "c:\masm32\include\resource.h"
#define RT_MANIFEST 24
EYE ICON viewer02.ico
1 RT_MANIFEST MOVEABLE PURE "DROP.EXE.MANIFEST"
|
©³¤U¬O DROP.EXE.MANIFEST ªº¤º®e¡G
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> |
§â DROP.ASM¡BDROP.RC¡BDROP.EXE.MANIFEST ¤Î viewer02.ico ©ñ¦b¦P¤@¤l¥Ø¿ý¡A¨Ì¤U±¤è¦¡²ÕĶ¡A´N¥i¥H±o¨ì DROP.EXE¡G
E:\HomePage\SOURCE\Win32\DragAndDrop>rc drop.rc [Enter] E:\HomePage\SOURCE\Win32\DragAndDrop>ml drop.asm /link drop.res [Enter] Microsoft (R) Macro Assembler Version 6.14.8444 Copyright (C) Microsoft Corp 1981-1997. All rights reserved. Assembling: drop.asm ************* UNICODE Build ************* Microsoft (R) Incremental Linker Version 5.12.8078 Copyright (C) Microsoft Corp 1992-1998. All rights reserved. /SUBSYSTEM:WINDOWS "drop.obj" "/OUT:drop.exe" "drop.res" E:\HomePage\SOURCE\Win32\DragAndDrop>
°õ¦æ«á¡A¶}±ÒÀÉ®×Á`ºÞ¡A§â¡uF:\¤jªk®v.txt¡v©ì©Ô¨ì DROP µøµ¡ùØ«á¡Aµe±¦p¤U¡C³oÓµ{¦¡¬O§Q¥ÎÁä½Lªº PageUp¡BPageDown¡BHome¡BEnd Áä¨Ó¡u±²°Ê¡vµe±¡A¨Ã«D¥Î·Æ¹«©Ô°Ê±²¶b¡C«ö¤U Esc Áä¥iÃö³¬¦¹µ{¦¡¡C¨Ï¥ÎªÌ¤]¥i¥H¥Î·Æ¹«ÂIÀ»µøµ¡¥k¤W¤è¶À©³ÂŦrªº¡uASCII¡v©Î¡u¸U°ê½X¡v¦r¦ê¡A¥i¥H¨Ï¥kÃ䪺¦r¦ê¦b³o¨âºØ½s½X¤¤¤Á´«¡C
¨ä¹ê¤j³¡¤Àªº¸ÑÄÀ¤w¦b«e±¸ÑÄÀ¹L¤F¡A¦¹³B¶È¶ÈÂI¥X¥¼¸ÑÄÀªº³¡¥÷¡C
º¥ý¡A²Ä 12 ¦æ»P 16 ¦æ¡A§â SHELL32.INC »P SHELL32.LIB ¨âÓÀÉ®×¥]§t¶i¨Ó¡A³o¬O¦]¬° DragQueryFile¡BDragFinish ³£¦b SHELL32.DLL ùØ¡C
¦b²Ä 321 ¦æ¡A«Ø¥ß DROP µøµ¡®É¡A¨Ïµøµ¡¨ã¦³¡uWS_OVERLAPPED or WS_SYSMENU or WS_MINIMIZEBOX¡v·®æªºì¦]¬O¸T¤î¨Ï¥ÎªÌ½Õ¾ãµøµ¡¤j¤p¡C³o¬O¦]¬° DROP µøµ¡¤ºªº¤å¦r¦æ¼Æ»P¦C¼Æ§¡¬°©T©wªº¡A¬G¨S¦³¥²n½Õ¾ã¡C
©³¤U¥ý¬Ý¬Ýµøµ¡¨ç¦¡¦p¦ó³B²z WM_DROPFILES °T®§¡Cº¥ý¡A²Ä 243 ¦æ©I¥s DragQueryFile¡A¨ú±o©ì¦²ªº²Ä¹sÓÀɦW¡A¨Ã¦s©ó szFileData ¦r¦êùØ¡CDROP ¥H¸U°ê½X³]p¡A©Ò¥H³Ì¤jªºÀɦWªø«×¬° MAX_PATH¡Ñ2¡A³o¬O¦]¬°¤@Ó¸U°ê½X¤å¦r¦û¾Ú¨âӦ줸²Õ¡A¬G¼¥H 2¡C±µ¤U¨Ó©I¥s CreateFile ¶}±ÒÀɮסA¦pªG¦¨¥\¡A«h¨ì²Ä 250 ¦æ¡A§âÀÉ®×¥N½X¦s¤J hFile¡C¥ý»¡©ú²Ä 254¡ã263 ¦æ¡A³o´X¦æµ{¦¡ªº¥Øªº¬O¨Ì¾ÚÀÉ®×¥N½X¨D±oÀɮתø«×¡A¥H°t¸m¾A·íªº°O¾ÐÅé°Ï¶ô¤j¤p¡A¦s©ñ©ì¦²¶i¨ÓªºÀɮפº®e¡A°t¸m¦nªº°O¾ÐÅé°Ï¶ô¥N½X¦s©ó hMem ùØ¡C
²Ä 251¡ã253 ¦æ¥Î¨ÓÀˬd¨Ï¥ÎªÌ¬O§_²Ä¤@¦¸©ì©ÔÀɮרì DROP µøµ¡ùØ¡A¦pªG¤£¬O²Ä¤@¦¸¡A¨º»ò hMem ¬°¤w°t¸m¹Lªº°O¾ÐÅé°Ï¶ô¡A²{¤w¥Î¤£µÛ¤F¡A¬GÀ³¥ýÄÀ©ñ¦A°t¸m·sªº°O¾ÐÅé°Ï¶ô¡A¦ý¤´ºÙ¬° hMem¡C¦]¬°·í¨Ï¥ÎªÌ°õ¦æ DROP µ{¦¡«á©ì¦²Àɮר즹µøµ¡ùØ«á¡A¨Ï¥ÎªÌ¦³¥i¯à·|¦A«×©ì¦²¨ä¥LÀɮר즹µøµ¡ùØ¡A³o®É´N±o¥ýÄÀ©ñì¨Óªº°O¾ÐÅé¡A²Ä 251¡ã253 ¦æ´N¬O¬°¤F³o¥ó¨Æ¡A§_«hµL¥Îªº°O¾ÐÅé°Ï¶ô¤Ó¦h¡A·|®ø¯Ó±¼¤Ó¦h¸ê·½¡C
³Ñ¤U¨Óªº³¡¥÷´N¬OŪ¨úÀɮרì hMem ùØ ( ²Ä 265 ¦æ )¡B©I¥s set_file_info ³]©wÀɮ׸ê®Æ ( ²Ä 266 ¦æ )¡BÃö³¬ÀɮסB©I¥s DragFinish µ²§ô©ì©Ô°Ê§@ÄÀ©ñ hDrop ( ²Ä 270 ¦æ )¡B¹ï¦Û¤vµo¥X WM_PAINT °T®§¥H§ó·sµe± ( ²Ä 271 ¦æ )¡C
¤p¤ì°¸¥´ºâ¦b DROP µøµ¡ªº¤u§@°Ï¤º¡A¤@¦¸Åã¥Ü 256 Ӧ줸²Õ¡A¦¹ 256 Ó³sÄòªº¦ì¤¸²ÕºÙ¬°¤@¶¡C¥t¥~¤p¤ì°¸³]p¥H¡uPageUp¡v¡B¡uPageDown¡v¡B¡uHome¡v¡B¡uEnd¡v¥|Ó«öÁäÅã¥Ü¤W¤@¶¡B¤U¤@¶¡B²Ä¤@¶¡B³Ì«á¤@¶¡C³Ì²«Kªº¤èªk¬O¥Î p1stByte »P pMax1stByte ¨âÓÅܼơA´N¥i¥HÅã¥Ü¤@¶¡Cp1stByte ÅܼƬO¦ì§}«ü¼Ð¡A«ü¦V¤@¶ªº²Ä¤@Ӧ줸²Õ¦ì§}¡CpMax1stByte ¬O³Ì«á¤@¶ªº²Ä¤@Ӧ줸²Õªº¦ì§}¡A¤]´N¬O p1stByte ªº³Ì¤jÈ¡A¨äpºâ¤è¦¡¦bµ{¦¡²Ä 255¡ã261 ¦æ¡C
¦]¦¹·í¨Ï¥ÎªÌ«ö¤UÁä½L¤Wªº«öÁä®É¡A¦³¤ºØµ²ªG¡G
«e¥|ºØ±¡§Î¡A°õ¦æ§¹«á¡An«·sø»s¤u§@°Ï¡A©Ò¥H³£·|¨ì²Ä 223 ¦æ¡A©I¥s InvalidateRect¡A¶i¦æ«Ã¸¡C
WM_PAINT °T®§ùØ¡A¥Dn©I¥s display_page °Æµ{¦¡§ó·sµe±¡C¶i¤J display_page «á¡A¥ý¿ï¾Ü¦Û¦æ³]pªº¦r§Î¡B¦r§ÎÃC¦â¡BI´ºÃC¦â ( ²Ä 120¡ã123 ¦æ )¡AµM«á¦b²Ä 124 ¦æÀˬd flag ªº²Ä 0 ¦ì¤¸¡A¦pªG¬°¹s¡Aªí¥Ü©|¥¼¦³Àɮ׳Q¨Ï¥ÎªÌ©ì¤J DROP µøµ¡¤º¡A¨º»ò¦b¦L¥X¡u¨Ï¥ÎªÌ¥i¥H¥Î·Æ¹«©ì¦²¥ô¦ó¤@ÓÀɮר즹µøµ¡¡K¡vªº°T®§ ( ²Ä 128 ¦æ ) «á¡A´N°h¥X display_page¡C¡FY¬°¤@¡A«hªí¥Ü¤w¦³Àɮ׳Q¨Ï¥ÎªÌ©ì¤J DROP µøµ¡¤º¡An¦bµøµ¡¤º¥H¤Q¤»¶i¦ì¤Î¦r¤¸¤è¦¡¦L¥XÀɮפº®eªº¨ä¤¤¤@¶ ( ¦@ 256 Ӧ줸²Õ )¡C
DROP ¥HÅÜ¼Æ p1stByte «ü¦V hMem ùتºÀɮפº®e¡A¦L¥X³o 256 Ӧ줸²Õªº¤Q¤»¶i¦ì¼ÆÈ»P¦r¤¸¡A±Ä¥ÎÃþ¦ü¥H«eªº PCTOOLS ¤è¦¡¡A¨C¦æ 16 Ӧ줸²Õ¡A¦@ 16 ¦æ¡CcRow¡BcHex ¤À§O¥Nªí¦@ 16 ¦æ¡A¨C¦æ 16 Ӧ줸²Õ¡C¨C·íø»s¤Q¤»¶i¦ì¼ÆȮɡA³£¬O©I¥s DrawText ¨Ó§¹¦¨ ( ¨£²Ä 156 ¦æ )¡A¦Ó°Åµô¯x§Îªº¦ì¸m¤j¤p°O¿ý¦b rcDisplay ùØ¡C
³Ì¥ªÃ䪺¬O¦r¤¸¡A¨Ï¥ÎªÌ¥i¥H¥Î·Æ¹«ÂIÀ»¶À©³ÂŦrªº¡uASCII¡v©Î¡u¸U°ê½X¡v¡A¦b³o¨âªÌ¤¤¤Á´«¡C¤p¤ì°¸¥H flag ªº²Ä¤@Ӧ줸°O¿ý½s½X¤è¦¡¡C¦pªG¬O¤@¡Aªí¥Ü¸U°ê½X¡A©I¥s DrawTextW ø»s¦r¤¸¡F¦pªG¬O 0¡Aªí¥Ü ASCII¡A©I¥sDrawTextA ø»s¦r¤¸¡C( ²Ä 171¡ã176 ¦æ )
³B²z³oÓ°T®§¥u¬O¬°¤F¨Ï¥ÎªÌ¦b¶À©³ÂŦrªº¡uASCII¡v©Î¡u¸U°ê½X¡v¼ÐÃD¤W°µ¤Á´«¡C³B²z¹Lµ{¦b²Ä 278¡ã280 ¦æ¡A¥ýÀˬd¨Ï¥ÎªÌÂIÀ»®É¡A·Æ¹«´å¼Ð¬O§_¸¨¦b¶À©³ÂŦrªº¡uASCII¡v©Î¡u¸U°ê½X¡v¼ÐÃD¤W¡A¦pªG¬O¤~¤Á´« flag ªº²Ä¤@Ӧ줸¡C
¦pªG¥u¦³¡u©ì©ñ¼Ðªº¡v¡A¦Ó¨S¦³¡u©ì©ñª«¥óªº¨ÑÀ³ªÌ¡v¡A¨º¤]²@µL¥Î³B¡A¦]¦¹©³¤Uªº½g´T¥Î¨Ó½Í½Í¦p¦ó¼g¥X¡u©ì©ñª«¥óªº¨ÑÀ³ªÌ¡v¡C
¥ý¬Ý¬Ý©ì©ñÀɮתº¾Þ§@¹Lµ{¡G·í¨Ï¥ÎªÌn©ì©ñ¬YÓÀɮ׮ɡA¥ý¦b·Æ¹«´å¼Ð²¾¨ì¸ÓÀɮתº¡u»âªÅ¡v¤W¡A«ö¦í·Æ¹«¥ªÁ䤣©ñ¡A±µµÛ²¾°Ê·Æ¹«´å¼Ð©ì¦²Àɮרì¡u©ì©ñ¼Ðªº¡vµøµ¡¡A¤~ÄÀ©ñ·Æ¹«¥ªÁä¡A´N§¹¦¨¤F¾ãÓ¹Lµ{¡C³o¹Lµ{¤¤¥i¯à·|³q¹L¨ä¥Lµøµ¡ªº¡u»âªÅ¡v¡A¡u©ì©ñª«¥óªº¨ÑÀ³ªÌ¡vÀ³¸ÓnÀò±o³o¨Çµøµ¡ªº¥N½X¡A¨ÃÀˬd¥¦Ì¬O§_¨ã¦³ WS_EX_ACCEPTFILES ÂX¥R·®æ¡A¦pªG¨ã¦³¦¹ÂX®i·®æªº¸Ü¡AÅã¥Ü¥i¥HÄÀ©ñ·Æ¹«¥ªÁ䪺´å¼Ð¡F¦pªG¤£¨ã WS_EX_ACCEPTFILES ªº¸Ü¡A«hÅã¥Ü¸T¤î´å¼Ð¡C´«¥y¸Ü»¡¡A¦b©ì¦²Àɮרì¡u©ì©ñ¼Ðªº¡vµøµ¡ªº¨BÆJ¤¤¡A§Y¨Ï·Æ¹«´å¼Ð¤£¦b¡u©ì©ñª«¥óªº¨ÑÀ³ªÌ¡vµøµ¡¤º¡A¤]n¯à§â°T®§¶Ç¦^µ¹¡u©ì©ñª«¥óªº¨ÑÀ³ªÌ¡vµøµ¡¨ç¦¡¡A¥i¥H©I¥s SetCapture ¹F¨ì³oӥتº¡C
©ì©Ô¹Lµ{ªº³Ì«á¶¥¬q¡A¨Ï¥ÎªÌÀ£µÛ·Æ¹«¥ªÁä¡A²¾°Ê·Æ¹«´å¼Ð¨ì¡u©ì©ñ¼Ðªº¡vµøµ¡¤º¡A¥u»ÝÄÀ©ñ·Æ¹«¥ªÁä¡A´N¥i§¹¦¨©ì©ñ¹Lµ{¡C¦ý¬O¹ï¡u©ì©ñª«¥óªº¨ÑÀ³ªÌ¡vµøµ¡¦Ó¨¥¡A¨Ã«D¶È¶È©I¥s ReleaseCapture ´N¥i¥H¤F¡CÁÙ¥²¶·¶ñ¦n¤@ÓºÙ¬° DROPFILES µ²ºcÅ骺¦UÄæ¦ì¡C¤@¯ë¦Ó¨¥¡A³oÓµ²ºcÅé·|³Q©ñ¦b¤@Ó¥i²¾°Êªº°O¾ÐÅé°Ï¶ôùØ¡AµM«á¹ï¡u©ì©ñ¼Ðªº¡vµøµ¡µo°e WM_DROPFILES °T®§¡A´N¯à±N¦¹°O¾ÐÅé°Ï¶ô¶Ç»¼µ¹¡u©ì©ñ¼Ðªº¡vµøµ¡¤F¡Cn°t¸m¥i²¾°Êªº°O¾ÐÅé°Ï¶ô¡A¥²¶·¥H GMEM_MOVEABLE ¬°°Ñ¼Æ¡A©I¥s GlobalAlloc¡C¦³Ãö¥i²¾°Êªº°O¾ÐÅé°Ï¶ô¡A¥i°Ñ¦Ò²Ä¤Q¥|³¹ªº»¡©ú¡CDROPFILES µ²ºcÅ骺Äæ¦ì¦p¤U¡G
DROPFILES STRUCT pFiles DD ? pt POINT <> fNC DD ? fWide DD ? DROPFILES ENDS
·í¨Ï¥ÎªÌÄÀ©ñ·Æ¹«¥ªÁä®É¡A¡u©ì©ñª«¥óªº¨ÑÀ³ªÌ¡v¶ñ¦n DROPFILES µ²ºcÅ餧«á¡A¹ï¡u©ì©ñ¼Ðªº¡vµøµ¡µo°e WM_DROPFILES °T®§¡Aµo°eªº¤èªk¬O©I¥s PostMessage¡A¦Ó¤£¥i©I¥s SendMessage¡Cì¦]¬O PostMessage ·|¹ï WM_DROPFILES °T®§©ÒÄâ±aªº°O¾ÐÅé°Ï¶ô°µ¯S§Oªº³B²z¡C²³©Ò¬Òª¾¡A¦b Win32 ¨t²ÎùØ¡A¨CÓµ{¦¡¬OµLªkŪ¨ú¡A¤]µLªk¦s¤J¸ê®Æ¨ì¨ä¥Lµ{¦¡ªº¦ì§}ªÅ¶¡¡C¦ý¬O PostMessage ¤@¨£¨ì WM_DROPFILES °T®§¡A«K·|¦b¡u©ì©ñ¼Ðªº¡vµøµ¡ªº¦ì§}ªÅ¶¡°t¸m¤@°O¾ÐÅé°Ï¶ô¡AµM«á§â WM_DROPFILES ©ÒÄâ¨Óªº°O¾ÐÅé°Ï¶ô¤º®e«þ¨©¨ì·s°t¸m°O¾ÐÅé°Ï¶ôùØ¡A¦A©I¥s GlobalFree¡A§â WM_DROPFILES ©ÒÄâ±a¨Óªº°O¾ÐÅé°Ï¶ôÄÀ©ñ±¼¡A¦P®É§â wParam °Ñ¼Æ³]©w¬°·sªº°O¾ÐÅé°Ï¶ô¥N½X¡C·í¡u©ì©ñ¥Ø¼Ð¡vªºµøµ¡¨ç¦¡¦¬¨ì¤F WM_DROPFILES °T®§¡AwParam °Ñ¼Æ©Ò«üªº¬O¦Û¤vµ{¦¡ªº¦ì§}ªÅ¶¡¤¤ªº°O¾ÐÅé°Ï¶ô¡A¦]¦¹ DragQueryPoint¡BDragQueryFile ©M DragFinish ¤~¯à¥¿½TµL»~ªº¨Ï¥Î³o¶ô°O¾ÐÅé¡C
¥Ñ¥H¤W¹Lµ{¡A¥i¥H²q´ú¡A¡u©ì©ñª«¥óªº¨ÑÀ³ªÌ¡v¥²¶·³B²z WM_LBUTTONDOWN¡BWM_MOUSEMOVE¡BWM_LBUTTONUP ¤TÓ°T®§¡A¦b³o¤TÓ°T®§ùØ¥²¶·³B²z¥H¤U¨Æ±¡¡G
ÁöµM°ò¥»¤W¡A¡u©ì©ñª«¥óªº¨ÑÀ³ªÌ¡vªº©ì©Ô°Ê§@¡A³B²z¤W±¤TÓ°T®§´N¥i¥H¤F¡A¦ý¬OÀ³¸ÓÁÙ±o³B²z WM_CAPTURECHANGED °T®§¡C³o¬O¦]¬°©ì©Ô°Ê§@«Ü®e©ö³Q¬Y¨Ç«öÁä°Ê§@¨ú®ø¡C¨Ò¦p·í¨Ï¥ÎªÌ¶i¦æ©ì©Ô°Ê§@®É¡A¦pªG¤S«ö¤U¤F Ctrl¡ÐEsc¡BAlt¡ÐTab µ¥²Õ¦X«öÁä¡A¨t²Î·|¦Û°Ê¸õ¨ì¯S®íµ{¦¡°õ¦æ¡A©ì©Ô°Ê§@«K³Q¨ú®ø¤F¡C¦ý¬O³o®ÉÔ¡u©ì©ñª«¥óªº¨ÑÀ³ªÌ¡v¤´¥H¬°¦b©ì©Ôª¬ºA¡ADragMode ¤´¬° TRUE¡A³o·|³y¦¨ÅÞ¿è¤Wªº¿ù»~¡C·íµøµ¡¥¢¥h®·Àò·Æ¹«°T®§®É¡A¨t²Î·|µo¥X WM_CAPTURECHANGED °T®§µ¹¸Óµøµ¡ªºµøµ¡¨ç¦¡¡C¦]¦¹À³¸Ó¦b³B²z WM_CAPTURECHANGED °T®§®É¡A§â DragMode ³]¬° FALSE¡CWM_CAPTURECHANGED °T®§¤¤¡AwParam ¤£¨Ï¥Î¡AlParam ¬O·í«e®·Àò·Æ¹«°T®§ªºµøµ¡¤§µøµ¡¥N½X¡C
©³¤U¤p¤ì°¸»¡©ú¦p¦ó¹ê§@¡u©ì©ñª«¥óªº¨ÑÀ³ªÌ¡v¡A¦¹µ{¦¡ºÙ¬°¡uDRAG¡v¡A°õ¦æ«á¥X²{¤@Ó¥]§t²M³æÀ˵ø¤Î¨âÓ«ö¶sªº¹ï¸Ü²°¡A¨Ï¥ÎªÌ¥i¥H«ö¤U¡uÂsÄý¡v«ö¶s¡A¿ï¾Ü¹q¸£¤Wªº¥ô¤@¤l¥Ø¿ý¡ADRAG ·|§â³oÓ¤l¥Ø¿ý¤ºªº©Ò¦³ÀÉ®×Åã¥Ü¦b²M³æÀ˵ø±±¨î¶µ¤º¡C¨Ï¥ÎªÌ¥i¥H¥H·Æ¹«©ì©Ô¨ä¤ºªº¥ô¦ó¤@ÓÀɮסA¨ì¡u©ì©ñ¥Ø¼Ð¡vªºµøµ¡ùØ¡C¤U¹Ï¬O DRAG.EXE °õ¦æ«á¡A¨Ï¥ÎªÌ¿ï¾Ü¡uF:\¡vªºµe±¡G
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 |
.586
.MODEL FLAT,STDCALL
OPTION CASEMAP:NONE
IDB_BROWSE EQU 15000
IDS_PATH EQU 15001
IDC_LISTVIEW EQU 15002
IDB_QUIT EQU 15003
__UNICODE__ EQU 1
INCLUDE WINDOWS.INC
INCLUDE COMCTL32.INC
INCLUDE KERNEL32.INC
INCLUDE SHELL32.INC
INCLUDE USER32.INC
INCLUDELIB COMCTL32.LIB
INCLUDELIB KERNEL32.LIB
INCLUDELIB SHELL32.LIB
INCLUDELIB USER32.LIB
;*************************************************************************************************************
.CONST
szDlgName DW 56h,69h,65h,77h,46h,69h,6ch,65h,4ch,69h,73h,74h,0h ;ViewFileList
szIconName DW 46h,69h,6ch,65h,4ch,69h,73h,74h,0h ;FileList
szBrowseTitle DW 9078h,64c7h,8cc7h,6599h,593eh,0h ;¿ï¾Ü¸ê®Æ§¨
szFileTitle DW 6a94h,540dh,0h ;ÀɦW
szFileSizeTitle DW 6a94h,6848h,5927h,5c0fh,0h ;Àɮפj¤p
szFileCrtTime DW 5efah,6a94h,6642h,9593h,0h ;«ØÀɮɶ¡
szFileSizeFmt DW 25h,49h,36h,34h,64h,0h ;%I64d
szAllFiles DW 5ch,2ah,2eh,2ah,0h ;\*.*
szCrtDateFmt DW 67h,67h,79h,79h,79h,79h,2fh,4dh,2fh,64h,64h,0 ;ggyyyy/M/dd
szCrtTimeFmt DW 20h,48h,48h,3ah,6dh,6dh,3ah,73h,73h,0 ; HH:mm:ss
szFmt DW 28h,25h,64h,2ch,25h,64h,29h,0h ;(%d,%d)
szDropFile DW 44h,72h,6fh,70h,46h,69h,6ch,65h,0h ;DropFile
szDropStop DW 44h,72h,6fh,70h,53h,74h,6fh,70h,0h ;DropStop
;*************************************************************************************************************
.DATA
hInstance HINSTANCE ? ;¼Ò²Õ¥N½X
hListView HANDLE ? ;²M³æÀ˵øªº¤lµøµ¡¥N½X
hCoord HANDLE ? ;ÀRºA±±¥óªº¤lµøµ¡¥N½X
hCursorStop HCURSOR ? ;©ì¦²®É¡A¦b«D©ì©ñ¼Ðªºµøµ¡¤Wªº·Æ¹«´å¼Ð¡A°±¤îªº²Å¸¹
hCursorDrop HCURSOR ? ;©ì¦²®É¡A¦b©ì©ñ¼Ðªºµøµ¡¤Wªº·Æ¹«´å¼Ð¡A¥i¥H©ñ¤Uªº²Å¸¹
hCursorArrow HCURSOR ? ;¥¿±`ªº·Æ¹«´å¼Ð
pOldFnListView LPSTR ? ;ì¨Óªº²M³æÀ˵øªºµøµ¡¨ç¦¡¦ì§}
pFileTitle LPSTR ? ;¦bszPath¤¤¡A¥DÀɦWªº°_©l¦ì§}
DragMode DD FALSE ;©ì¦²´Á¶¡¬°TRUE¡A§_«h¬°FALSE
SelFile DD -1 ;¨Ï¥ÎªÌ¿ï¾ÜªºÀɮׯÁ¤Þ¡A¦b²M³æÀ˵øªº¯Á¤ÞÈ
cbPath DD ? ;³Q¿ï¾ÜªºÀɦW(§t¸ô®|¤Î¤@ÓNULL¦r¤¸)¦û¾Ú¦h¤Ö¦ì¤¸²Õ
szPath DW MAX_PATH DUP (0)
;*************************************************************************************************************
.CODE
;-------------------------------------------------------------------------------------------------------------
;¨Ï¥ÎªÌ«ö¤U¡uÂsÄý¡v«ö¶s¡A¥iÅý¨Ï¥ÎªÌ¿ï¾Ü¤@¸ê®Æ§¨¡A¦A§â¦¹¸ê®Æ§¨¤ºªºÀÉ®×Åã¥Ü¦b²M³æÅã¥Ü¤§¤º
;¿é¤J¡GEAX¡Ð¹ï¸Ü²°¥N½X
browse PROC USES esi edi
LOCAL bi:BROWSEINFO,lvi:LVITEM,w32fd:WIN32_FIND_DATA
LOCAL ft:FILETIME,syst:SYSTEMTIME
LOCAL hFind:DWORD
LOCAL buffer[20]:WORD
mov bi.pidlRoot,0
mov bi.hwndOwner,eax
mov bi.pszDisplayName,OFFSET szPath
mov bi.lpszTitle,OFFSET szBrowseTitle
mov bi.ulFlags,BIF_RETURNONLYFSDIRS
mov bi.lpfn,0
mov bi.iImage,0
INVOKE SHBrowseForFolder,ADDR bi ;Åý¨Ï¥ÎªÌ¿ï¾Ü¤l¥Ø¿ý
or eax,eax ;YEAX¡×0¡Aªí¥Ü¨Ï¥ÎªÌ«ö¨ú®ø
jz quit_browse
INVOKE SHGetPathFromIDList,eax,OFFSET szPath ;¨ú±o¸ô®|¦WºÙ
INVOKE SendMessage,hListView,LVM_DELETEALLITEMS,0,0
lea edi,szPath
mov ecx,MAX_PATH
sub eax,eax
cld
repne scasw
.IF WORD PTR [edi-4]==5ch ;Àˬd¸ô®|¦W³Ì¥½¦r¤¸¬O§_¬°¡u\¡v
sub edi,2
mov pFileTitle,edi ;ÀɦW°_©l¦ì§}
mov esi,OFFSET szAllFiles+2
mov ecx,4
.ELSE
mov pFileTitle,edi ;ÀɦW°_©l¦ì§}
sub edi,2
mov esi,OFFSET szAllFiles
mov ecx,5
.ENDIF
rep movsw
INVOKE FindFirstFile,OFFSET szPath,ADDR w32fd
mov hFind,eax
cmp eax,INVALID_HANDLE_VALUE
je finish
mov lvi.imask,LVIF_TEXT
mov lvi.iItem,0
.WHILE eax!=0
cmp w32fd.dwFileAttributes,20h
.IF ZERO?
lea edx,w32fd.cFileName
mov lvi.pszText,edx
mov lvi.iSubItem,0
INVOKE SendMessage,hListView,LVM_INSERTITEM,0,ADDR lvi
INVOKE wsprintf,ADDR buffer,OFFSET szFileSizeFmt,w32fd.nFileSizeLow,w32fd.nFileSizeHigh
lea edx,buffer
inc lvi.iSubItem
mov lvi.pszText,edx
INVOKE SendMessage,hListView,LVM_SETITEM,0,ADDR lvi
INVOKE FileTimeToLocalFileTime,ADDR w32fd.ftCreationTime,ADDR ft ;§âUTC®É¶¡Åܦ¨·í¦a®É¶¡(¤¤µØ¥Á°ê¼Ð·Ç®É¶¡)
INVOKE FileTimeToSystemTime,ADDR ft,ADDR syst ;§âFILETIME®æ¦¡ªº·í¦a®É¶¡Åܦ¨SYSTEMTIME®æ¦¡
lea edi,buffer
INVOKE GetDateFormat,LOCALE_USER_DEFAULT,0,ADDR syst,OFFSET szCrtDateFmt,edi,SIZEOF buffer/2
mov ecx,SIZEOF buffer/2
dec eax
sub ecx,eax
shl eax,1
add edi,eax
INVOKE GetTimeFormat,LOCALE_USER_DEFAULT,0,ADDR syst,OFFSET szCrtTimeFmt,edi,ecx
lea edx,buffer
inc lvi.iSubItem
mov lvi.pszText,edx
INVOKE SendMessage,hListView,LVM_SETITEM,0,ADDR lvi
.ENDIF
INVOKE FindNextFile,hFind,ADDR w32fd
.ENDW
finish: INVOKE FindClose,hFind
quit_browse: ret
browse ENDP
;-------------------------------------------------------------------------------------------------------------
;³]©wDROPFILESµ²ºcÅé
;¿é¤J¡GEAX¡×°O¾ÐÅé°Ï¶ô¦ì§}¡A¦¹¦ì§}¬°DROPFILESµ²ºcÅé°_©l¦ì§}¡A¤§«á¬°ÀɦW
;¡@¡@¡@ECX¡×¨Ï¥ÎªÌÄÀ©ñ·Æ¹«®Éªº®y¼Ð(¿Ã¹õ®y¼Ð)
set_dropfiles PROC USES esi edi
LOCAL lvi:LVITEM
mov edx,ecx
and ecx,0ffffh
shr edx,10h
ASSUME eax:PTR DROPFILES
mov [eax].pFiles,SIZEOF DROPFILES ;ÀɦW¦bpFiles¤§«á¡ASIZEOF DROPFILESӦ줸²Õ¶}©l
mov [eax].pt.x,ecx ;¨Ï¥ÎªÌÄÀ©ñ·Æ¹«®Éªº X ®y¼Ð(¿Ã¹õ®y¼Ð)
mov [eax].pt.y,edx ;¨Ï¥ÎªÌÄÀ©ñ·Æ¹«®Éªº Y ®y¼Ð(¿Ã¹õ®y¼Ð)
mov [eax].fNC,TRUE ;TRUEªí¥Ü¿Ã¹õ®y¼Ð
mov [eax].fWide,TRUE ;«D¹sªí¥ÜÀɦW¬°¸U°ê½X
ASSUME eax:NOTHING
mov ecx,pFileTitle
add eax,SIZEOF DROPFILES
mov edi,eax ;EDI¡×DROPFILESµ²ºcÅ餧«áªº¸ô®|¦W°_©l¦ì§}
mov esi,OFFSET szPath ;ESI¡×¨Ï¥ÎªÌ¿ï¾Üªº¸ô®|¦W°_©l¦ì§}
sub ecx,esi ;ECX¡×¸ô®|¦W¦³¦h¤Ö¦r¤¸(¥H¦ì¤¸²Õ¬°³æ¦ì)
cld
shr ecx,1 ;ECX¡×¸ô®|¦W¦³¦h¤Ö¦r¤¸(¥H¦r²Õ¬°³æ¦ì)
rep movsw
mov edx,SelFile ;³Q©ì©ÔªºÀɮצb²M³æÀ˵ø¤º²Ä´XÓ¶µ¥Ø¡A¥Ñ0¶}©l
mov lvi.imask,LVIF_TEXT ;¨ú±o¶µ¥Ø¦WºÙ(¥ç§YÀɮצWºÙ)
mov lvi.pszText,edi ;³]©w¨ú±oªºÀɦW¦s©óEDI©Ò«ü¦ì§}
mov lvi.iItem,edx ;³]©wn¨ú±o²Ä´XÓ¶µ¥ØªºÀɦW
mov lvi.iSubItem,0 ;¤l¶µ¥Ø¬°0¡A¤~¬O¶µ¥Ø¦W
mov lvi.cchTextMax,MAX_PATH
INVOKE SendMessage,hListView,LVM_GETITEM,0,ADDR lvi
ret
set_dropfiles ENDP
;-------------------------------------------------------------------------------------------------------------
;·sªº²M³æÀ˵øªºµøµ¡¨ç¦¡
fnNewListView PROC hLV:DWORD,uMsg:DWORD,wParam:WPARAM,lParam:LPARAM
LOCAL pos:POINT
LOCAL hWndUnderMouse:HWND
LOCAL hDrop,pLockMem:HGLOBAL
LOCAL lvhti:LVHITTESTINFO
.IF uMsg==WM_MOUSEMOVE
.IF DragMode==TRUE
INVOKE GetCursorPos,ADDR pos
INVOKE WindowFromPoint,pos.x,pos.y
mov hWndUnderMouse,eax
INVOKE GetWindowLong,hWndUnderMouse,GWL_EXSTYLE
test eax,WS_EX_ACCEPTFILES
.IF ZERO?
mov edx,hCursorStop
.ELSE
mov edx,hCursorDrop
.ENDIF
INVOKE SetCursor,edx
.ENDIF
.ELSEIF uMsg==WM_LBUTTONDOWN
INVOKE CallWindowProc,pOldFnListView,hLV,uMsg,wParam,lParam
mov ecx,lParam
mov edx,lParam
and ecx,0ffffh
shr edx,10h
mov lvhti.pt.x,ecx
mov lvhti.pt.y,edx
INVOKE SendMessage,hLV,LVM_HITTEST,0,ADDR lvhti
mov SelFile,eax
cmp eax,-1
je quit_wndproc
INVOKE SetCapture,hLV
mov DragMode,TRUE
.ELSEIF uMsg==WM_LBUTTONUP
.IF DragMode==TRUE
INVOKE SetCursor,hCursorArrow
INVOKE GlobalAlloc,GMEM_MOVEABLE or GMEM_ZEROINIT,SIZEOF DROPFILES+MAX_PATH*2
mov hDrop,eax
INVOKE GlobalLock,hDrop ;Âê©w°O¾ÐÅé°Ï¶ô
mov pLockMem,eax
mov ecx,lParam
call set_dropfiles ;¶ñ¦nDROPFILESµ²ºcÅé
INVOKE GlobalUnlock,hDrop
INVOKE GetCursorPos,ADDR pos ;¨ú±o·í«e·Æ¹«´å¼Ð¦b¿Ã¹õ®y¼Ðªº¦ì¸m
INVOKE WindowFromPoint,pos.x,pos.y ;¨ú±o·í«e·Æ¹«´å¼Ð¤Uªºµøµ¡
INVOKE PostMessage,eax,WM_DROPFILES,hDrop,0 ;¹ï¤Wzµøµ¡µo¥XWM_DROPFILES
call ReleaseCapture
mov DragMode,FALSE
.ENDIF
.ELSEIF uMsg==WM_CAPTURECHANGED
mov DragMode,FALSE
.ELSE
INVOKE CallWindowProc,pOldFnListView,hLV,uMsg,wParam,lParam
ret
.ENDIF
quit_wndproc: xor eax,eax
ret
fnNewListView ENDP
;-------------------------------------------------------------------------------------------------------------
DlgProc PROC hDlg:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
LOCAL lvc:LVCOLUMN,lvi:LVITEM,ptMousePos:POINT
LOCAL buffer[40]:WORD
.IF uMsg==WM_COMMAND
mov edx,wParam
mov eax,wParam
shr edx,10h ;EDX=³qª¾½X
and eax,0ffffh ;EAX=±±¨î¤¸¥óÃѧO½X
.IF dx==BN_CLICKED
.IF ax==IDB_BROWSE
mov eax,hDlg
call browse
or eax,eax
jz quit_dlg_proc
INVOKE SetDlgItemText,hDlg,IDS_PATH,OFFSET szPath ;§âIDS_FILE³]¬°ªÅ¦r¦ê
.ELSEIF ax==IDB_QUIT
jmp quit
.ENDIF
.ENDIF
.ELSEIF uMsg==WM_NOTIFY
mov eax,hListView
push ebx
ASSUME ebx:PTR NM_LISTVIEW
mov ebx,lParam
.IF [ebx].hdr.hwndFrom==eax
.IF [ebx].hdr.code==NM_CLICK
mov eax,[ebx].iItem
mov edx,[ebx].ptAction.y
mov ecx,[ebx].ptAction.x
shl edx,10h
add ecx,edx
mov SelFile,eax
mov DragMode,FALSE
INVOKE PostMessage,hListView,WM_LBUTTONUP,0,ecx
.ENDIF
.ENDIF
pop ebx
ASSUME ebx:PTR NOTHING
.ELSEIF uMsg==WM_CLOSE
quit: INVOKE EndDialog,hDlg,NULL
.ELSEIF uMsg==WM_INITDIALOG
;¸ü¤J¹Ï¥Ü¨Ã¥H¦¹³]©w¹ï¸Ü²°¹Ï¥Ü
INVOKE LoadIcon,hInstance,OFFSET szIconName
INVOKE SendMessage,hDlg,WM_SETICON,ICON_SMALL,eax
;¨ú±o²M³æÀ˵øªº¥N½X¤Î³]©wÄæ¦ì
INVOKE GetDlgItem,hDlg,IDC_LISTVIEW
mov hListView,eax
mov lvc.imask,LVCF_FMT or LVCF_WIDTH or LVCF_TEXT or LVCF_SUBITEM
mov lvc.fmt,LVCFMT_LEFT
mov lvc.lx,290
mov lvc.pszText,OFFSET szFileTitle
mov lvc.iSubItem,0
INVOKE SendMessage,hListView,LVM_INSERTCOLUMN,0,ADDR lvc
mov lvc.lx,100
mov lvc.pszText,OFFSET szFileSizeTitle
inc lvc.iSubItem
INVOKE SendMessage,hListView,LVM_INSERTCOLUMN,1,ADDR lvc
mov lvc.lx,120
mov lvc.pszText,OFFSET szFileCrtTime
inc lvc.iSubItem
INVOKE SendMessage,hListView,LVM_INSERTCOLUMN,2,ADDR lvc
INVOKE SendMessage,hListView,LVM_SETEXTENDEDLISTVIEWSTYLE,LVS_EX_FULLROWSELECT,\
LVS_EX_FULLROWSELECT
;³]©w²M³æÀ˵øªº¤lÃþ¤Æ
INVOKE SetWindowLong,hListView,GWL_WNDPROC,OFFSET fnNewListView
mov pOldFnListView,eax
;¨ú±o·Æ¹«´å¼Ð
INVOKE LoadCursor,hInstance,OFFSET szDropStop
mov hCursorStop,eax
INVOKE LoadCursor,hInstance,OFFSET szDropFile
mov hCursorDrop,eax
INVOKE LoadCursor,0,IDC_ARROW
mov hCursorArrow,eax
.ELSE ;¨ä¥L¥¼³B²zªº°T®§ªð¦^ FALSE
mov eax,FALSE
ret
.ENDIF ;¤w³B²zªº°T®§¡Aªð¦^ TRUE
quit_dlg_proc: mov eax,TRUE
ret
DlgProc ENDP
;-------------------------------------------------------------------------------------------------------------
start: INVOKE GetModuleHandle,NULL ;¨ú±o¼Ò²Õ¥N½X
mov hInstance,eax
INVOKE DialogBoxParam,hInstance,OFFSET szDlgName,NULL,OFFSET DlgProc,NULL
INVOKE ExitProcess,eax
INVOKE InitCommonControls
;*************************************************************************************************************
END start
|
©³¤U¬O DRAG.RC Àɪº¤º®e¡G
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
17 18 19 20
21 22 23 24 |
#include "c:\masm32\include\resource.h"
#define IDB_BROWSE 15000
#define IDS_PATH 15001
#define IDC_LISTVIEW 15002
#define IDB_QUIT 15003
#define RT_MANIFEST 24
#define LVS_EX_FULLROWSELECT 32
ViewFileList DIALOG 200,100,360,200
STYLE WS_CAPTION|WS_VISIBLE|WS_SYSMENU
FONT 9,"MS Sans Serif"
CAPTION "ÀɮצCªí"
BEGIN
PUSHBUTTON "ÂsÄý",IDB_BROWSE, 5, 5, 50,14
LTEXT "", IDS_PATH, 60, 8,294,14
CONTROL "",IDC_LISTVIEW,"SYSListView32",LVS_REPORT|WS_BORDER|LVS_SHOWSELALWAYS|LVS_SINGLESEL, 5,23,350,160
PUSHBUTTON "Â÷¶}",IDB_QUIT, 306,184, 50,14
END
FileList ICON folder1.ico
DropFile CURSOR drop.cur
DropStop CURSOR stop.cur
1 RT_MANIFEST MOVEABLE PURE "DRAG.EXE.MANIFEST"
|
©³¤U¬O DRAG.EXE.MANIFEST ªº¤º®e¡G
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> |
§â DRAG.ASM¡BDRAG.RC¡BDRAG.EXE.MANIFEST¡Bdrop.cur¡Bstop.cur¡Bfolder1.ico ¤»ÓÀɮשñ¦b¦P¤@¤l¥Ø¿ýùØ¡AµM«á¨Ì¤U±¤èªk²ÕĶ¤Î³sµ²¡G
E:\HomePage\SOURCE\Win32\DragAndDrop>rc drag.rc [Enter] E:\HomePage\SOURCE\Win32\DragAndDrop>ml drag.asm /link drag.res [Enter] Microsoft (R) Macro Assembler Version 6.14.8444 Copyright (C) Microsoft Corp 1981-1997. All rights reserved. Assembling: drag.asm ************* UNICODE Build ************* Microsoft (R) Incremental Linker Version 5.12.8078 Copyright (C) Microsoft Corp 1992-1998. All rights reserved. /SUBSYSTEM:WINDOWS "drag.obj" "/OUT:drag.exe" "drag.res" E:\HomePage\SOURCE\Win32\DragAndDrop>
µ{¦¡²Ä 291¡ã293 ¦æªº¥Øªº¬O¨Ï²M³æÀ˵ø¡u¤lÃþ¤Æ¡v¡C¹³½s¿è®Ø¡B²M³æÀ˵ø³oºØ¤w¸g¥Ñ¨t²Î©w¸q¦nªº±±¨î¶µ¡A³£¬Oµøµ¡ªº¤@ºØ¡A¤]³£¦³¦Û¤vªºµøµ¡¨ç¦¡¡A¤j³¡¤Àªº±¡§Î¤U¡AÀ³¥Îµ{¦¡¤£¶·¾á¤ß¤]¤£¥²¼¶¼g±±¨î¶µªºµøµ¡¨ç¦¡¡A¦]¬°·L³n¤w¸g¼¶¼g¦n§¹µ½ªºµøµ¡¨ç¦¡¤F¡A¨Ã¤w§t¦b¨t²Î¤º¤F¡C¦ý¬O¦³®ÉÔ¡A§ÚÌ¥u·Q°µ¤@¨Ç¤p¤pªº×§ï¡A¦Ó¤j³¡¤Àªº¥\¯à³£»Pì±±¨î¶µ¬Û¦P¡C¨Ò¦p¡A§ÚÌ·Q¥Î½s¿è®Ø¿é¤J¤Q¤»¶i¦ì¼ÆÈ¡A³o®É½s¿è®ØÀ³¸Ó¥u¯à¿é¤J 0¡ã9 »P A¡ãF ¦r¤¸¡A¦Ó¥B¦³Ãö¨Ï¥ÎªÌ¿ï¾Ü¤å¦r¡B«þ¨©µ¥µ¥¥\¯à§¡»Pì¨Ó¬Û¦P¡A¦ý¬Oì¨Óªº½s¿è®Øµøµ¡¨ç¦¡¨S¦³¥u¯à¿é¤J 0¡ã9¡BA¡ãF ªº¥\¯à¡C³o®É´N±o¾a¡u¤lÃþ¤Æ¡vªº¤è¦¡¹F¦¨¤F¡C
n¹F¦¨±±¨î¶µ¤lÃþ¤Æªº¤u§@¦³¨â¨B¡C²Ä¤@¨B¬O¨ú±o±±¨î¶µªºµøµ¡¨ç¦¡¦ì§}¡A¨ÃÀx¦s°_¨Ó¡C¥i¥H©I¥s SetWindowLong API §¹¦¨¡ASetWindowLong ªº¥\¯à¬O³]©wµøµ¡ªº¬Y¨Ç¸ê®Æ¡A¨ä¤¤¦³¤@¶µ´N¬O³]©wµøµ¡¨ç¦¡¡ASetWindowLong ªºì«¬¬O¡G
SetWindowLong PROTO hWnd:HEND,nIndex:DWORD,dwNewLong:DWORD
¼ÆÈ | »¡©ú |
GWL_EXSTYLE | ³]©wµøµ¡ªºÂX¥R·®æ ( extended window style )¡C |
GWL_STYLE | ³]©w·sªºµøµ¡·®æ ( window style )¡C |
GWL_WNDPROC | ³]©wµøµ¡¨ç¦¡¦ì§}¡C |
GWL_HINSTANCE | ³]©w·sªº¼Ò²Õ¥N½X ( instance handle )¡C |
GWL_ID | ³]©w·sªºÃѧO½X ( identifier )¡C |
GWL_USERDATA | ³]©w¨Ï¥ÎªÌ¦Û¦æ©w¸qªºµøµ¡¸ê®Æ¡A¦¹¸ê®Æ¬O¦b«Ø¥ßµøµ¡®É«ü©wªº¡C¥ç§Y©I¥s CreateWindowEx API ®É¡A¥Ñ³Ì«á¤@Ó°Ñ¼Æ lpParam ©Ò«ü©w¡C |
©³¤Uªº¤TÓ¼ÆÈ¡A¥u¯à¥Î©ó¹ï¸Ü²°µøµ¡ | |
DWL_DLGPROC | ³]©w·sªº¹ï¸Ü²°¨ç¦¡ ( dialog box procedure )¡C |
DWL_MSGRESULT | ³]©w¦b¹ï¸Ü²°¨ç¦¡¤º¡A¤w³B²z¹Lªº°T®§ªð¦^È¡C |
DWL_USER | ³]©w¨Ï¥ÎªÌ¦Û¦æ©w¸qªº¹ï¸Ü²°¸ê®Æ¡A¦¹¸ê®Æ¬O¦b«Ø¥ß¹ï¸Ü²°®É«ü©wªº¡C¥ç§Y©I¥s DialogBoxParam API ®É¡A¥Ñ³Ì«á¤@Ó°Ñ¼Æ dwInitParam ©Ò«ü©w¡C |
SetWindowLong ªð¦^®É¡A¦pªG¦¨¥\¡A·|¶Ç·|ìÈ¡C¨Ò¦p¡AnIndex ¬° GWL_WNDPROC ¥B SetWindowLong ¦¨¥\°õ¦æ¡A¨º»ò·|ªð¦^ì¨Óªºµøµ¡¨ç¦¡¦ì§}¡C¦pªG SetWindowLong °õ¦æ¥¢±Ñ¡Aªð¦^Ȭ° 0¡C
DRAG ¹ï¸Ü²°·|§â¨Ï¥ÎªÌ©Ò¿ï¾Ü¤l¥Ø¿ý¤ºªºÀÉ®×Åã¥Ü¦b²M³æÀ˵ø±±¨î¶µ¤º¡C¨Ï¥ÎªÌ¥i¥H¥Î·Æ¹«©ì©Ô²M³æÀ˵ø¤ºªºÀɦW¡A¨ì¡u©ì©ñ¼Ðªº¡vµøµ¡¡C¦]¦¹¡ADRAG ¥²¶·³B²z¨t²Î¶Çµ¹²M³æÀ˵øªº WM_LBUTTONDOWN¡BWM_MOUSEMOVE¡BWM_LBUTTONUP¡BWM_CAPTURECHANGED ¥|Ó°T®§¡A¦Ó¨ä¥L°T®§«h¥æ¥Ñì¨Óªºµøµ¡¨ç¦¡³B²z¡C©Ò¥H¡A¤p¤ì°¸¤~§â²M³æÀ˵øµ¹¤lÃþ¤Æ¤F¡C
±±¨î¶µ¤lÃþ¤Æªº²Ä¤G¨B´N¬O¼¶¼g·sªº±±¨î¶µµøµ¡¨ç¦¡¡C¦b DRAG ùØ¡A·sªº²M³æÀ˵øµøµ¡¨ç¦¡¡A°£¤Fn³B²z WM_LBUTTONDOWN¡BWM_MOUSEMOVE¡BWM_LBUTTONUP¡BWM_CAPTURECHANGED °T®§¤§¥~¡A¨ä¾lªº°T®§¥²¶·©I¥sªº²M³æÀ˵øµøµ¡¨ç¦¡¨Ó¥[¥H³B²z¡A¦]¦¹¤~·|¦³©I¥s CallWindowProc API ³o¤@¦æµ{¦¡¡CCallWindowProc ªºì«¬¬O¡G
CallWindowProc PROTO lpPrevWndFunc:WNDPROC,hWnd:HWND,Msg:UINT,wParam:WPARAM,lParam:LPARAM
CallWindowProc API ¬O¥Î¨Ó§â Msg °T®§µo°eµ¹ hWnd ¥ý«eªºµøµ¡¨ç¦¡¡A¸Óµøµ¡¨ç¥Üªº¶i¤J¦ì§}¦b lpPrevWndFunc ÅܼÆùØ«ü©w¡C¤@¯ë¦Ó¨¥¡AlpPrevWndFunc ¬O¥Ñ GWL_WNDPROC ©Î DWL_DLGPROC ¬°°Ñ¼Æ¡A©I¥s SetWindowLong ¦Ó±o¨ìªº¡A¤×¨ä¬O¥Î¦b¤lÃþ¤Æ±±¨î¶µªº®É¾÷¡C
±z¥i¥H°Ñ¦Ò DRAG.ASM µ{¦¡ªº²Ä 160¡ã223 ¦æ«K¬O·sªºµøµ¡¨ç¦¡¡A¨ä¤º¥u³B²z¨º¥|Ó»P©ì©Ô¦³Ãöªº°T®§¡A¦Ó¨ä¾l°T®§«h¥æµ¹ì¨Óªºµøµ¡¨ç¦¡³B²z ( ²Ä 218 ¦æ )¡C¦Ó³]©w·sªºµøµ¡¨ç¦¡«h¦bµ{¦¡ªº²Ä 291¡ã293 ¦æ¡A©I¥s SetWindowLong «á¡A§â즳ªº²M³æÀ˵øµøµ¡¨ç¦¡¦ì§}¦s¨ì pOldFnListView ÅܼÆùØ¡C
¦b²Ä 183¡ã195 ¦æªºµ{¦¡½X¡A¬O¥Î¨Ó³B²z¶Çµ¹²M³æÀ˵øªº WM_LBUTTONDOWN °T®§¡C¦ý¬O¡A¨Ã¤£¬O¥u¦³©ì©Ô°Ê§@·|²£¥Í WM_LBUTTONDOWN °T®§¡A¨Ï¥ÎªÌ¥H·Æ¹«³æÀ» ( click ) ²M³æÀ˵ø¥ô¦ó¤@³B¡A©Î¥H·Æ¹«³æÀ»²M³æÀ˵øªºÀɮ׶µ¥Ø¡A³£·|²£¥Í WM_LBUTTONDOWN °T®§¡C¥¿±`±¡§Î¤U¡A¦pªG¥H·Æ¹«³æÀ»¶µ¥Ø¦WºÙ¡Aªí¥Ü¨Ï¥ÎªÌ¿ï¾ÜÀɮרèϸÓÀÉ®×¤Ï¥Õ ( ³Q¿ï¾ÜªºÀɮש³¦â·|ÅÜÂŦâ¡AºÙ¬°¤Ï¥Õ©Î°ª«G«×I´º )¡A³o¬O¥Ñ²M³æÀ˵øì¨Óªºµøµ¡¨ç¦¡©Ò°µªº¤u§@¡C¦ý¬O·í¤lÃþ¤Æ«á¡A°£«D¦Û¦æ³B²z³o¥ó¤u§@¡A§_«h¤£·|µo¥Í¤Ï¥Õ¡A¦bµøı®ÄªG¤W·|·Pı©Ç©Çªº¡C¦pn¦Û¦æ³B²z·|¼W¥[³\¦h³Â·Ð¡A©Ò¥H¤p¤ì°¸©I¥sì¨Óªºµøµ¡¨ç¦¡³B²z¤Ï¥Õ¹Lµ{¡A¦b²Ä 183 ¦æ¡A¤]´N¬O¤@¶}©l³B²z WM_LBUTTONDOWN °T®§´N©I¥s CallWindowProc ¨Ó³B²z¨ä¥L»P©ì©ÔµLÃöªº¹Lµ{¡C
²Ä 183¡ã190 ¦æ¡A¬O¥Î¨ÓÀò±o¨Ï¥ÎªÌ¿ï¾ÜªºÀɮצWºÙ¡A¤p¤ì°¸±Ä¥Î¹ï²M³æÀ˵øµo¥X LVM_HITTEST °T®§¡C·í¨Ï¥ÎªÌ¥H·Æ¹«ÂIÀ»²M³æÀ˵ø®É¡A¦pªG©ÒÂIÀ»ªºÂI¸¨¦b¬YÓ¶µ¥Ø¤W¡A¥i¥Ñµo¥X LVM_HITTEST °T®§µ¹²M³æÀ˵ø±±¨î¶µ¦ÓÀË´ú¥X¸Ó¶µ¥Øªº¯Á¤ÞÈ¡F¦pªG´ú¸ÕÂI¤£¦b¶µ¥Ø¤W¡A«hªð¦^¡Ð1¡C( ¸Ô¨£²Ä 22 ³¹¦³Ãö LVM_HITTEST °T®§ )¡C±o¨ì¨Ï¥ÎªÌ©Ò¿ï¾Üªº¶µ¥Ø¯Á¤Þ«á¡A¦s©ó SelFile ùØ¡Aµ¥¨ì¨Ï¥ÎªÌ©ñ¶}·Æ¹«¥ªÁä®É¡A¦AÄ~Äò³B²z¡C
²Ä 194 ¦æ¡A«h¬O³]©w®·Àò·Æ¹«°T®§¡A¶Çµ¹²M³æÀ˵øªºµøµ¡¨ç¦¡ùØ¡A°£«D©ñ¶}·Æ¹«¥ªÁä¤~¤£¦A®·Àò·Æ¹«°T®§ ( ²Ä 199 ¦æ )¡C²Ä 195 ¦æ«h¬O³]©w±N¶i¤J©ì©Ôª¬ºA¡A§â DragMode ³]¬° 1¡F°£«D©ñ¶}·Æ¹«¥ªÁä¤~³]¬°«D©ì©Ôª¬ºA¡A¨£²Ä 211 ¦æ¡C
¦b²Ä 168¡ã180 ¦æªºµ{¦¡½X¡A³B²z©ì©Ôª¬ºA¤U¡A·Æ¹«²¾°Ê¹Lµ{¡Cº¥ýÀˬd¬O§_³B©ó©ì©Ôª¬ºA¤U ( ¦b©ì©Ôª¬ºA¤U¡ADragMode ÅܼƬ° TRUE¡F§_«h¬° 0 )¡A¦pªG¤£¸õ¥X¦¹°T®§¡F§_«hÀˬd·Æ¹«´å¼Ð¤Uªºµøµ¡¬O§_¨ã¦³ WS_EX_ACCEPTFILES ©µ¦ù·®æ¡A¦pªG¤£¨ã¦¹·®æ¡AÅã¥Ü¸T¤î´å¼Ð¡F§_«hÅã¥Ü¥iÄÀ©ñªº´å¼Ð¡CnÀò±o·Æ¹«´å¼Ð¤Uªºµøµ¡¤§µøµ¡¥N½X¡A¨Ã¥B¨Ì¬O§_¨ã¦³ WS_EX_ACCEPTFILES §ïÅܷƹ«´å¼Ð¡A¤jP¸g¹L¤TÓ¨BÆJ¡G①©I¥s GetCursorPos¡A②©I¥s WindowFromPoint¡A③¨ú±oÂX¥R·®æ¡A§ïÅܷƹ«´å¼Ð¡C
¨ú±o·Æ¹«´å¼Ð©Ò¦bªº®y¼Ð¡A¥i©I¥s GetCursorPos¡A¨ä쫬¬°¡G
GetCursorPos PROTO lpPoint:DWORD
°Ñ¼Æ lpPoint ¬°¤@¦ì§}¡A«ü¦V POINT µ²ºcÅé¡A·í©I¥s¦¨¥\«á¡A·|ªð¦^«D¹sÈ¡A¦Ó¦¹µ²ºcÅé·|³Q¨t²Î¦s©ñ·í«e·Æ¹«´å¼Ð©Ò¦b¤§®y¼Ð¡A¦¹®y¼Ð¬O¥H¿Ã¹õ¥ª¤W¨¤¬°ìÂI¡CY GetCursorPos °õ¦æ¥¢±Ñ¡A¶Ç¦^ 0¡C
WindowFromPoint ¥i¥H´ú¸Õ¬Y¤@ÂI®y¼Ð¦bþÓµøµ¡½d³ò¤º¡A¨ä쫬¬O
WindowFromPoint PROTO x:DWORD,y:DWORD
x¡By ¨â°Ñ¼Æ¬O¿Ã¹õ®y¼Ðªº X ®y¼Ð»P Y ®y¼Ð¡A¥ç§Yn´ú¸ÕªºÂI¤§®y¼Ð¡C¦pªG¦¨¥\¦a°õ¦æ¡Aªð¦^´ú¸ÕÂI©Ò¦bªºµøµ¡¥N½X¡C¦pªG´ú¸ÕÂI¤£¦b¥ô¦óµøµ¡¤º¡A«hªð¦^ 0¡C¦pªG´ú¸ÕÂI¦bÀRºA¤å¦r±±¥ó¤W¡A«h¶Ç¦^¸ÓÀRºA±±¥óªº¤÷µøµ¡¥N½X¡C
¨ú±o´å¼Ð©Ò¦bªºµøµ¡¥N½X«á¡A´N¥i¥H¥H GWL_EXSTYLE ¬°³Ì«á¤@ӰѼƩI¥s GetWindowLong ¨ú±oÂX¥R·®æ¡AµM«á§PÂ_¬O§_¨ã¦³ WS_EX_ACCEPTFILES¡C³o¤TÓ¨BÆJ¦bµ{¦¡²Ä 169¡ã173 ¦æ¡A±µ¤U¨Óªº´X¦æ«h¬O³]©w´å¼Ð¡C
ÁöµM WM_MOUSEMOVE °T®§¤¤¡A©ÒÄâ±aªº lParam °Ñ¼Æ¥ç§t¦³·Æ¹«´å¼Ð·í«e©Ò¦b®y¼Ð¡A¦ý¬O³oÓ®y¼Ð¬O¥H¤u§@°Ïªº¥ª¤W¨¤¬°ìÂI¡A¦pªG·Æ¹«´å¼Ð¦bµøµ¡¤u§@°Ïªº¥ª¤è©Î¤W¤è¡A¨º»ò®y¼Ð·|Åܦ¨tÈ¡AÁöµM¥i¥H©I¥s ClientToScreen Âà´«¦¨¿Ã¹õ®y¼Ð¡A¦ý¬O¸û¬°³Â·Ð¡C
¦pªG¬O¦b©ì©Ô¼Ò¦¡¤U¡A¨Ï¥ÎªÌÃP¶}·Æ¹«¥ªÁä¡A¨t²Î§â WM_LBUTTONUP ¶Çµ¹²M³æÀ˵øªºµøµ¡¨ç¦¡¡A³Ì«nªº¤u§@¬O¹ï·í«e·Æ¹«´å¼Ð¤Uªºµøµ¡µo¥X WM_DROPFILES °T®§¡Bµ²§ô©ì©Ôª¬ºA¡Cµ{¦¡½X¦b²Ä 198¡ã212 ¦æ¡A¦ý«e±¤w¤¶²Ð¹L¤F¡A³oùØ´N¤£«½Æ¤F¡C
¥¿½Tªº§â¸ê®Æ¶ñ¤J DROPFILES µ²ºcÅ餺ªº¤u§@¡A¥Ñ¦b²Ä 128¡ã159 ¦æªº set_dropfiles °Æµ{¦¡°õ¦æ¡C¥H¤W±ªº¨Ò¤l¡A¨Ï¥ÎªÌ©ì©Ô¡uF:\¤jªk®v.txt¡vÀɮסA¨ä¤¤¡uF:\¡vºÙ¬°¸ô®|¦W¡A¡u¤jªk®v.txt¡vºÙ¬°ÀɦW¡C¸ô®|¦W¬O¦b¨Ï¥ÎªÌ¿ï¾Ü¤@¤l¥Ø¿ý®É¡A´N¤w¨M©w¡F¦ÓÀɦW«h¬O¦b©ì©Ô®É¡A«ö¤U·Æ¹«¥ªÁä¤~¨M©w¡C
DRAG ¯àÅý¨Ï¥ÎªÌ¿ï¾Ü¹q¸£¤¤¥ô¤@¤l¥Ø¿ýªºÀɮשì©Ô¡A³o¬O¦p¦ó°µ¨ìªº©O¡H¦b©ó©I¥s SHBrowseForFolder ¤Î SHGetPathFromIDList ¨âÓ API¡C
©I¥s SHBrowseForFolder «á¡A¨t²Î·|¥X²{¤@Ó¹ï¸Ü²°¡A¨ä¤º¥]§t¤@Ó¾ðª¬À˵ø±±¨î¶µ¡B¤@ÓÀRºA±±¨î¶µ¤Î¡u½T©w¡v¡B¡u¨ú®ø¡v¨âÓ«ö¶s¡A¥i¥HÅý¨Ï¥ÎªÌ©ó¾ðª¬À˵ø±±¨î¶µ¿ï¾Ü¤@Ó¤l¥Ø¿ý¡A¦p¥k¹Ï¡C¦pªG SHBrowseForFolder °õ¦æ¦¨¥\¡Aªð¦^¨Ï¥ÎªÌ©Ò¿ïªº PIDL ( pointer to item identifier list¡AÁY¼g¬° PIDL )¡F¦pªG¨Ï¥ÎªÌ«ö¡u¨ú®ø¡v«ö¶s¡A«hªð¦^ NULL¡CSHBrowseForFolder ªºì«¬¬O¡G
SHBrowseForFolder PROTO lpbi:LPSTR
SHBrowseForFolder ¥u¦³¤@ӰѼơAlpbi¡A¦¹°Ñ¼Æ«ü¦V¤@ÓºÙ¬° BROWSEINFO µ²ºcÅé©Ò¦b¦ì§}¡CBROWSEINFO µ²ºcÅé¥]§t¤F©I¥s SHBrowseForFolder ©Ò»Ýªº°Ñ¼Æ¥H¤Î±µ¦¬¸ê®ÆªºÄæ¦ì¡A©³¤U¬O BROWSEINFO µ²ºcÅ骺Äæ¦ì¡G
BROWSEINFO STRUCT hwndOwner DD ? pidlRoot DD ? pszDisplayName DD ? lpszTitle DD ? ulFlags DD ? lpfn DD ? lParam DD ? iImage DD ? BROWSEINFO ENDS
ºX¼Ð | ¼ÆÈ | »¡©ú |
BIF_RETURNONLYFSDIRS | 1 | ¨Ï¥ÎªÌ¥u¯à¿ï¾ÜÀɮרt²Î¤¤ªº¥Ø¿ý¡A¦pªG¿ï¾Ü¨ä«DÀɮרt²Î¤¤ªº¥Ø¿ý¡A¨Ò¦p¡uºô¸ôªÚ¾F¡v¡A½T©w«ö¶sµLªk§@¥Î¡C |
BIF_DONTGOBELOWDOMAIN | 2 | ¦b¾ðª¬À˵øùØ¡A¤£¥]§t°ì¦W©³¤Uªº¥Ø¿ý¡C |
BIF_STATUSTEXT | 4 | ¦b¹ï¸Ü²°¤¤¥]§tª¬ºA¦C¡Cn§ïÅܪ¬ºA¦C¼ÐÃD¡A¶·¹ï¹ï¸Ü²°µo¥X BFFM_SETSTATUSTEXT °T®§¡C·í«ü©w BIF_NEWDIALOGSTYLE ºX¼Ð®É¡ABIF_STATUSTEXT ´NµL®Ä¡C |
BIF_RETURNFSANCESTORS | 8 | ¥u¦³¨Ï¥ÎªÌ¿ï¤¤¸`ÂI®É¡A¡u½T©w¡v«ö¶s¤~¯à§@¥Î¡F§_«h¬°¦Ç¦â¡AµLªk«ö¤U¡C¸`ÂI¬O«ü°£¤FÀÉ®×¥H¥~ªº¶µ¥Ø¡A¨Ò¦p¤l¥Ø¿ý¡B¦Lªí¾÷¦W¡B¹q¸£¦Wµ¥µ¥¡C |
BIF_EDITBOX | 10h | COMCTL32.DLL 4.71 ª©¥H«á¤~¥i¨Ï¥Î¡A¨Ï¥Î¦¹ºX¼Ð«á¡A¹ï¸Ü²°¤W¥b³¡·|²£¥Í¤@½s¿è®Ø¡A¨Ñ¨Ï¥ÎªÌ¿é¤J¶µ¥Ø¦WºÙ¡C |
BIF_VALIDATE | 20h | COMCTL32.DLL 4.71 ª©¥H«á¤~¥i¨Ï¥Î BIF_VALIDATE¡C¦pªG¨Ï¥ÎªÌ¦b½s¿è®Ø¤¤¿é¤Jªº¦WºÙ¤£¦Xªk¡A¹ï¸Ü®Ø±Nµo¥X BFFM_VALIDATEFAILED °T®§¨ì¦^©I¨ç¼ÆùØ¡CBIF_VALIDATE ¥u¦³¦b«ü©w BIF_EDITBOX ºX¼Ð®É¡A¤~¦³®Ä¡C |
BIF_NEWDIALOGSTYLE | 40h | COMCTL32.DLL 4.71 ª©¥H«á¤~¥i¨Ï¥Î¡C¦¹ºX¼Ð¨Ï¥Î·sªº¨Ï¥ÎªÌ¬É±¡A¥]§t¥i½Õ¾ã¹ï¸Ü²°¤j¤p¡B¥i§R°£«Ø¥ß¤l¥Ø¿ý¡B¤ä´©©ì©Ôµ¥µ¥¡C¦ý¬O¦b©I¥s SHBrowseForFolder «e¡A¶·¥ý©I¥s OleInitialize ©Î CoInitialize¡C |
BIF_USENEWUI | 50h | ¬Û·í©ó BIF_EDITBOX or BIF_NEWDIALOGSTYLE |
BIF_BROWSEINCLUDEURL | 80h | COMCTL32.DLL 5.0 ª©¥H«á¤~¥i¨Ï¥Î¡CBIF_USENEWUI »P BIF_BROWSEINCLUDEFILES §¡»Ý³]©w¡ABIF_BROWSEINCLUDEURL ¤~¦³®Ä¡C¦¹¤TÓºX¼Ð³]©w«á¡A¹ï¸Ü²°·|Åã¥Ü URL¡C |
BIF_UAHINT | 100h | COMCTL32.DLL 6.0 ª©¥H«á¤~¥i¨Ï¥Î¡C |
BIF_NONEWFOLDERBUTTON | 200h | COMCTL32.DLL 6.0 ª©¥H«á¤~¥i¨Ï¥Î¡C¤£¥]§t¡u·s¸ê®Æ§¨¡v«ö¶s¡C |
BIF_NOTRANSLATETARGETS | 400h | COMCTL32.DLL 6.0 ª©¥H«á¤~¥i¨Ï¥Î¡C·í¨Ï¥ÎªÌ¿ï¨ì¡u±¶®|¡v®É¡Aªð¦^±¶®|¥»¨ªº PIDL¡A¦Ó¤£¬O쥻ªº PIDL¡C |
BIF_BROWSEFORCOMPUTER | 1000h | ¥u¦³¨Ï¥ÎªÌ¿ï¤¤¹q¸£¦WºÙ®É ( ºô¸ô¤è¾F¤º )¡A¡u½T©w¡v«ö¶s¤~¯à§@¥Î¡F§_«h¬°¦Ç¦â¡AµLªk«ö¤U¡C§Y¨ÏµLªk¿ï¾Ü¤l¥Ø¿ý¡A¦ý¬O¤´¯à¨£¨ì¹q¸£¤ºªº©Ò¦³¤l¥Ø¿ý¡C |
BIF_BROWSEFORPRINTER | 2000h | ¥u¦³¨Ï¥ÎªÌ¿ï¤¤¦Lªí¾÷®É¡A¡u½T©w¡v«ö¶s¤~¯à§@¥Î¡F§_«h¬°¦Ç¦â¡AµLªk«ö¤U¡C |
BIF_BROWSEINCLUDEFILES | 4000h | COMCTL32.DLL 4.71 ª©¥H«á¤~¥i¨Ï¥Î¡C¦P®ÉÅã¥Ü¤l¥Ø¿ý¤ÎÀɮסC |
BIF_SHAREABLE | 8000h | COMCTL32.DLL 5.0 ª©¥H«á¤~¥i¨Ï¥Î¡C¦¹ºX¼Ð¥iÅý¾ðª¬À˵øÅã¥Ü»·ºÝªº¤À¨É¸ê·½¡C¦¹ºX¼Ð¥²¶·¦b BIF_NEWDIALOGSTYLE ³]©w®É¤~¦³®Ä¡C |
BIF_BROWSEFILEJUNCTIONS | 10000h | Windows 7 ©Î¥H«áªº¨t²Î¤~¥i¨Ï¥Î¡C¦¹ºX¼Ð¥iÅý¾ðª¬À˵øÅã¥ÜÀ£ÁYÀɦp¦P¤l¥Ø¿ý¤@¯ë¡C |
¨ç¦¡¦WºÙ PROC hwnd:HWND,uMsg:UINT,lParam:LPARAM,lpData:WPARAM
¥Ñ item identifier list ¨ú±o§¹¾ã¸ô®|¦WºÙ¡Aitem identifier list ªº¨Ó·½¥i¥H¬O©I¥s SHBrowseForFolder ¦¨¥\«áªºªð¦^È¡CSHGetPathFromIDList ªºì«¬¬O¡G
SHGetPathFromIDList PROTO pidl:PCIDLIST_ABSOLUTE,pszPath:LPTSTR
pidl ¬O©I¥s SHBrowseForFolder ¦¨¥\«áªºªð¦^È¡CpszPath ¬O¤@¦ì§}«ü¼Ð¡A©I¥s¦¨¥\«á¡A¨t²Î¶ñ¤J·|§â§¹¾ãªº¸ô®|¦WºÙ¶ñ¤J¦¹¦ì§}¤º¡A¤j¤p³Q°²©w¬° MAX_PATH ¦r¤¸¡C