- UID
- 460236
- 帖子
- 19
- 主題
- 10
- 精華
- 0
- 積分
- 21
- 楓幣
- 661
- 威望
- 20
- 存款
- 0
- 贊助金額
- 0
- 推廣
- 0
- GP
- 11
- 閱讀權限
- 10
- 性別
- 保密
- 在線時間
- 16 小時
- 註冊時間
- 2024-10-12
- 最後登入
- 2024-11-21
|
本帖最後由 ikj78i 於 2024-10-30 10:41 編輯
MULTILG.RC:存成「UTF-16 - NO BOM」格式
#include "c:\masm32\include\resource.h"
#define IDS_TCHINESE 2000
#define IDS_SCHINESE 2001
#define IDS_ENGLISH 2002
#define IDS_LATIN 2003
#define IDS_RUSSIAN 2004
#define IDB_EXIT 2005
#define RT_MANIFEST 24
1 RT_MANIFEST MOVEABLE PURE "multilg.exe.manifest"
MultiLG DIALOG 0,0,170,85
STYLE WS_POPUP|WS_CAPTION|WS_VISIBLE|WS_SYSMENU|WS_MINIMIZEBOX
CAPTION "多語言對話盒"
FONT 9,"新細明體"
BEGIN
LTEXT "正體中文:早安,組合語言。", IDS_TCHINESE,5, 5,150,12
LTEXT "簡體中文:早上好,汇编。", IDS_SCHINESE,5,17,150,12
LTEXT "英文:Good morning, assembly language.",IDS_ENGLISH,5,29,150,12
LTEXT "拉丁文:Bonum mane, contione lingua.", IDS_LATIN, 5,41,150,12
LTEXT "俄文:доброе утро на языке ассемблера.",IDS_RUSSIAN,5,53,150,12
PUSHBUTTON "Exit",IDB_EXIT,106,66,50,12
END
MULTILG.ASM:須存成「ANSI/ASCII」格式
OPTION CASEMAP:NONE
.586
.MODEL FLAT,STDCALL
IDB_EXIT EQU 2005
__UNICODE__ EQU 1
INCLUDE windows.INC
INCLUDE COMCTL32.INC
INCLUDE KERNEL32.INC
INCLUDE USER32.INC
INCLUDELIB COMCTL32.LIB
INCLUDELIB KERNEL32.LIB
INCLUDELIB USER32.LIB
INCLUDE C:\masm32\macros\macros.asm
;*******************************************************************************
.DATA
hInstance HANDLE ? ;模組代碼
hButton HANDLE ? ;按鈕代碼
WSTR szDlgName,"MultiLG" ;對話盒面板名稱
;*******************************************************************************
.CODE
;-------------------------------------------------------------------------------
DlgProc PROC hDlg:HWND,uMsg:UINT,wParam:WPARAM,lParamPARAM
.IF uMsg==WM_INITDIALOG
INVOKE GetDlgItem,hDlg,IDB_EXIT
mov hButton,eax
.ELSEIF uMsg==WM_COMMAND
mov edx,wParam
mov eax,lParam
shr edx,10h
.IF eax==hButton
.IF edx==BN_CLICKED
jmp quit
.ENDIF
.ENDIF
.ELSEIF uMsg==WM_CLOSE
quit: INVOKE EndDialog,hDlg,NULL
.ELSE ;其他未處理的訊息返回 FALSE
mov eax,FALSE
ret
.ENDIF ;已處理的訊息,返回 TRUE
mov eax,TRUE
ret
DlgProc ENDP
;-------------------------------------------------------------------------------
start: INVOKE GetModuleHandle,0
mov hInstance,eax
INVOKE DialogBoxParam,hInstance,OFFSET szDlgName,0,OFFSET DlgProc,NULL
INVOKE ExitProcess,eax
INVOKE InitCommonControls
;*******************************************************************************
END start
MULTILG.EXE.MANIFEST:
<?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>
把上面三個檔案存入同一子目錄,然後在命令提示字元輸入:
set include=c:\masm32\include
set lib=c:\masm32\lib
set path=c:\masm32\bin;%path%
set ml=/coff /link /subsystem:windows
rc multilg.rc
ml multilg.asm /link multilg.res
執行時畫面如下: |
|