?? 見招拆招windows程序設計(五).txt
字號:
szShow106 db "How minimized windows arranged",0
szShow107 db "SM_CXMINIMIZED",0
szShow108 db "Minimized window width",0
szShow109 db "SM_CYMINIMIZED",0
szShow110 db "Minimized window height",0
szShow111 db "SM_CXMAXTRACK",0
szShow112 db "Maximum draggable width",0
szShow113 db "SM_CYMAXTRACK",0
szShow114 db "Maximum draggable height",0
szShow115 db "SM_CXMAXIMIZED",0
szShow116 db "Width of maximized window",0
szShow117 db "SM_CYMAXIMIZED",0
szShow118 db "Height of maximized window",0
szShow119 db "SM_NETWORK",0
szShow120 db "Network present flag",0
szShow121 db "SM_CLEANBOOT",0
szShow122 db "How system was booted",0
szShow123 db "SM_CXDRAG",0
szShow124 db "Avoid drag x tolerance",0
szShow125 db "SM_CYDRAG",0
szShow126 db "Avoid drag y tolerance",0
szShow127 db "SM_SHOWSOUNDS",0
szShow128 db "Present sounds visually",0
szShow129 db "SM_CXMENUCHECK",0
szShow130 db "Menu check-mark width",0
szShow131 db "SM_CYMENUCHECK",0
szShow132 db "Menu check-mark height",0
szShow133 db "SM_SLOWMACHINE",0
szShow134 db "Slow processor flag",0
szShow135 db "SM_MIDEASTENABLED",0
szShow136 db "Hebrew and Arabic enabled flag",0
szShow137 db "SM_MOUSEWHEELPRESENT",0
szShow138 db "Mouse wheel present flag",0
szShow139 db "SM_XVIRTUALSCREEN",0
szShow140 db "Virtual screen x origin",0
szShow141 db "SM_YVIRTUALSCREEN",0
szShow142 db "Virtual screen y origin",0
szShow143 db "SM_CXVIRTUALSCREEN",0
szShow144 db "Virtual screen width",0
szShow145 db "SM_CYVIRTUALSCREEN",0
szShow146 db "Virtual screen height",0
szShow147 db "SM_CMONITORS",0
szShow148 db "Number of monitors",0
szShow149 db "SM_SAMEDISPLAYFORMAT",0
szShow150 db "Same color format flag",0
sysmetrics dd SM_CXSCREEN, offset szShow01, offset szShow02
dd SM_CYSCREEN, szShow03,offset szShow04
dd SM_CXVSCROLL,offset szShow05,offset szShow06
dd SM_CYHSCROLL,offset szShow07,offset szShow08
dd SM_CYCAPTION,offset szShow09,offset szShow10
dd SM_CXBORDER,offset szShow11,offset szShow12
dd SM_CYBORDER,offset szShow13,offset szShow14
dd SM_CXFIXEDFRAME,offset szShow15,offset szShow16
dd SM_CYVTHUMB,offset szShow17,offset szShow18
dd SM_CYFIXEDFRAME,offset szShow19,offset szShow20
dd SM_CXHTHUMB,offset szShow21,offset szShow22
dd SM_CXICON,offset szShow23,offset szShow24
dd SM_CYICON,offset szShow25,offset szShow26
dd SM_CXCURSOR,offset szShow27,offset szShow28
dd SM_CYCURSOR,offset szShow29,offset szShow30
dd SM_CYMENU,offset szShow31,offset szShow32
dd SM_CXFULLSCREEN,offset szShow33,offset szShow34
dd SM_CYFULLSCREEN,offset szShow35,offset szShow36
dd SM_CYKANJIWINDOW,offset szShow37,offset szShow38
dd SM_MOUSEPRESENT,offset szShow39,offset szShow40
dd SM_CYVSCROLL,offset szShow41,offset szShow42
dd SM_CXHSCROLL,offset szShow43,offset szShow44
dd SM_DEBUG,offset szShow45,offset szShow46
dd SM_SWAPBUTTON,offset szShow47,offset szShow48
dd SM_CXMIN,offset szShow49,offset szShow50
dd SM_CYMIN,offset szShow51,offset szShow52
dd SM_CXSIZE,offset szShow53,offset szShow54
dd SM_CYSIZE,offset szShow55,offset szShow56
dd SM_CXSIZEFRAME,offset szShow57,offset szShow58
dd SM_CYSIZEFRAME,offset szShow59,offset szShow60
dd SM_CXMINTRACK,offset szShow61,offset szShow62
dd SM_CYMINTRACK,offset szShow63,offset szShow64
dd SM_CXDOUBLECLK,offset szShow65,offset szShow66
dd SM_CYDOUBLECLK,offset szShow67,offset szShow68
dd SM_CXICONSPACING,offset szShow69,offset szShow70
dd SM_CYICONSPACING,offset szShow71,offset szShow72
dd SM_MENUDROPALIGNMENT,offset szShow73,offset szShow74
dd SM_PENWINDOWS,offset szShow75,offset szShow76
dd SM_DBCSENABLED,offset szShow77,offset szShow78
dd SM_CMOUSEBUTTONS,offset szShow79,offset szShow80
dd SM_SECURE,offset szShow81,offset szShow82
dd SM_CXEDGE,offset szShow83,offset szShow84
dd SM_CYEDGE,offset szShow85,offset szShow86
dd SM_CXMINSPACING,offset szShow87,offset szShow88
dd SM_CYMINSPACING,offset szShow89,offset szShow90
dd SM_CXSMICON,offset szShow91,offset szShow92
dd SM_CYSMICON,offset szShow93,offset szShow94
dd SM_CYSMCAPTION,offset szShow95,offset szShow96
dd SM_CXSMSIZE,offset szShow97,offset szShow98
dd SM_CYSMSIZE,offset szShow99,offset szShow100
dd SM_CXMENUSIZE,offset szShow101,offset szShow102
dd SM_CYMENUSIZE,offset szShow103,offset szShow104
dd SM_ARRANGE,offset szShow105,offset szShow106
dd SM_CXMINIMIZED,offset szShow107,offset szShow108
dd SM_CYMINIMIZED,offset szShow109,offset szShow110
dd SM_CXMAXTRACK,offset szShow111,offset szShow112
dd SM_CYMAXTRACK,offset szShow113,offset szShow114
dd SM_CXMAXIMIZED,offset szShow115,offset szShow116
dd SM_CYMAXIMIZED,offset szShow117,offset szShow118
dd SM_NETWORK,offset szShow119,offset szShow120
dd SM_CLEANBOOT,offset szShow121,offset szShow122
dd SM_CXDRAG,offset szShow123,offset szShow124
dd SM_CYDRAG,offset szShow125,offset szShow126
dd SM_SHOWSOUNDS,offset szShow127,offset szShow18
dd SM_CXMENUCHECK,offset szShow129,offset szShow130
dd SM_CYMENUCHECK,offset szShow131,offset szShow132
dd SM_SLOWMACHINE,offset szShow133,offset szShow134
dd SM_MIDEASTENABLED,offset szShow135,offset szShow136
dd SM_MOUSEWHEELPRESENT,offset szShow137,offset szShow138
dd SM_XVIRTUALSCREEN,offset szShow139,offset szShow140
dd SM_YVIRTUALSCREEN,offset szShow141,offset szShow142
dd SM_CXVIRTUALSCREEN,offset szShow143,offset szShow144
dd SM_CYVIRTUALSCREEN,offset szShow145,offset szShow146
dd SM_CMONITORS,offset szShow147,offset szShow148
dd SM_SAMEDISPLAYFORMAT,offset szShow149,offset szShow150
sysmetricsEnd label DWORD
.DATA?
hInstance dd ?
cxChar dd ?
cxCaps dd ?
cyChar dd ?
cxClient dd ?
cyClient dd ?
iMaxWidth dd ?
.CODE
START: ;從這里開始執行
invoke GetModuleHandle,NULL
mov hInstance,eax
invoke WinMain,hInstance,NULL,NULL,SW_SHOWDEFAULT
invoke ExitProcess,0
WinMain proc hInst:DWORD,hPrevInst:DWORD,CmdLine:DWORD,iCmdShow:DWORD
LOCAL wndclass :WNDCLASSEX
LOCAL msg :MSG
local hWnd :HWND
mov wndclass.cbSize,sizeof WNDCLASSEX
mov wndclass.style,CS_HREDRAW or CS_VREDRAW
mov wndclass.lpfnWndProc,offset WndProc
mov wndclass.cbClsExtra,0
mov wndclass.cbWndExtra,0
push hInst
pop wndclass.hInstance
invoke LoadIcon,NULL,IDI_APPLICATION
mov wndclass.hIcon,eax
invoke LoadCursor,NULL,IDC_ARROW
mov wndclass.hCursor,eax
invoke GetStockObject,WHITE_BRUSH
mov wndclass.hbrBackground,EAX
mov wndclass.lpszMenuName,NULL
mov wndclass.lpszClassName,offset szAppName
mov wndclass.hIconSm,0
invoke RegisterClassEx, ADDR wndclass
.if (EAX==0)
invoke MessageBox,NULL,CTXT("This program requires Windows NT!"),addr szAppName,MB_ICONERROR
ret
.endif
invoke CreateWindowEx,
NULL,
ADDR szAppName, ;window class name
CTXT("Get System Metrics No. 4"), ;window caption
WS_OVERLAPPEDWINDOW, ;window style
CW_USEDEFAULT, ;initial x position
CW_USEDEFAULT, ;initial y position
CW_USEDEFAULT, ;initial x size
CW_USEDEFAULT, ;initial y size
NULL, ;parent window handle
NULL, ;window menu handle
hInstance, ;program instance handle
NULL ;creation parameters
mov hWnd,eax
invoke ShowWindow,hWnd,iCmdShow
invoke UpdateWindow,hWnd
StartLoop:
invoke GetMessage,ADDR msg,NULL,0,0
cmp eax, 0
je ExitLoop
invoke TranslateMessage, ADDR msg
invoke DispatchMessage, ADDR msg
jmp StartLoop
ExitLoop:
mov eax,msg.wParam
ret
WinMain endp
WndProc proc hwnd:DWORD,message:DWORD,wParam :DWORD,lParam :DWORD
LOCAL hdc :HDC
LOCAL i,x,y,iVertPos,iHorzPos, iPaintBeg, iPaintEnd :DWORD
LOCAL ps :PAINTSTRUCT
LOCAL ssi :SCROLLINFO
LOCAL szBuffer[10] :BYTE
LOCAL tm :TEXTMETRIC
LOCAL y_Pos,x_Caps :DWORD
.if message==WM_CREATE
invoke GetDC,hwnd
mov hdc,eax
invoke GetTextMetrics,hdc,addr tm
mov eax,tm.tmAveCharWidth
mov cxChar,eax ;cxChar = tm.tmAveCharWidth
mov eax,2 ;cxCaps = (tm.tmPitchAndFamily & 1 ? 3 : 2) * cxChar / 2
test DWORD ptr tm.tmPitchAndFamily,1
jz @f
inc eax
@@:
push eax
mov eax,cxChar
pop ebx
mul ebx
shr eax,1
mov cxCaps,eax
mov eax,tm.tmHeight ;cyChar = tm.tmHeight + tm.tmExternalLeading
add eax,DWORD ptr tm.tmExternalLeading
mov cyChar,eax
invoke ReleaseDC,hwnd, hdc
;Save the width of the three columns
mov eax,cxChar ;iMaxWidth = 40 * cxChar + 22 * cxCaps
mov ecx,40
mul ecx
mov ebx,eax
mov eax,cxCaps
mov ecx,22
mul ecx
add eax,ebx
mov iMaxWidth,eax
ret
.elseif message == WM_SIZE
mov eax,lParam ;cxClient = LOWORD (lParam)
and eax,0FFFFh
mov cxClient,eax
mov eax,lParam
shr eax,16
mov cyClient,eax ;cyClient = HIWORD (lParam)
mov eax,sizeof ssi
mov ssi.cbSize,eax
mov DWORD ptr [ssi.fMask],SIF_RANGE or SIF_PAGE
mov DWORD ptr [ssi.nMin],0
mov DWORD ptr [ssi.nMax],NUMLINES - 1
xor edx,edx ;si.nPage = cyClient / cyChar
mov eax,cyClient
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -