.386 .model flat,stdcall option casemap:none include windows.inc include kernel32.inc include user32.inc includelib kernel32.lib includelib user32.lib .data szCaption db 'Show resolution ratio',0 szMetrics db 'Screen Resolution Ration: %dx%d',0 .data? metricsx dd ? metricsy dd ? szBuffer db 50 dup(?) .code main proc invoke GetSystemMetrics,SM_CXSCREEN mov metricsx,eax invoke GetSystemMetrics,SM_CYSCREEN mov metricsy,eax ;利用wsprintf将获得到的信息以szMetrics中给定的格式写入到szBuffe中 invoke wsprintf,offset szBuffer,offset szMetrics,metricsx,metricsy invoke MessageBox,NULL,addr szBuffer,addr szCaption,MB_OK ret main endp start: call main invoke ExitProcess,NULL end start