Π Π°Π·ΡΠ°Π±ΠΎΡΠΊΠ° ΠΏΡΠΈΠ»ΠΎΠΆΠ΅Π½ΠΈΡ Π½Π° ΡΠ·ΡΠΊΠ΅ Assembler
Include masm32includewindows. inc include masm32includeuser32. inc include masm32includekernel32. inc include masm32includegdi32. inc include masm32includecomdlg32. inc include masm32includeshell32. inc includelib masm32libuser32. lib includelib masm32libkernel32. lib includelib masm32libgdi32. lib includelib masm32libcomdlg32. lib includelib masm32libshell32. lib. ΠΠ°ΠΏΠΈΡΠ°ΡΡ Π½Π° ΡΠ·ΡΠΊΠ΅ ΠΡΡΠ΅ΠΌΠ±Π»Π΅Ρ… Π§ΠΈΡΠ°ΡΡ Π΅ΡΡ >
Π Π°Π·ΡΠ°Π±ΠΎΡΠΊΠ° ΠΏΡΠΈΠ»ΠΎΠΆΠ΅Π½ΠΈΡ Π½Π° ΡΠ·ΡΠΊΠ΅ Assembler (ΡΠ΅ΡΠ΅ΡΠ°Ρ, ΠΊΡΡΡΠΎΠ²Π°Ρ, Π΄ΠΈΠΏΠ»ΠΎΠΌ, ΠΊΠΎΠ½ΡΡΠΎΠ»ΡΠ½Π°Ρ)
Π Π°Π·ΡΠ°Π±ΠΎΡΠΊΠ° ΠΏΡΠΈΠ»ΠΎΠΆΠ΅Π½ΠΈΡ Π½Π° ΡΠ·ΡΠΊΠ΅ Assembler
1. ΠΠΎΡΡΠ°Π½ΠΎΠ²ΠΊΠ° Π·Π°Π΄Π°ΡΠΈ
ΠΠ°ΠΏΠΈΡΠ°ΡΡ Π½Π° ΡΠ·ΡΠΊΠ΅ ΠΡΡΠ΅ΠΌΠ±Π»Π΅Ρ ΠΏΡΠΎΠ³ΡΠ°ΠΌΠΌΡ Π΄Π»Ρ ΡΠΏΡΠ°Π²Π»Π΅Π½ΠΈΡ Π΄ΠΈΠ½Π°ΠΌΠΈΠΊΠΎΠΌ ΡΠΈΡΡΠ΅ΠΌΠ½ΠΎΠ³ΠΎ Π±Π»ΠΎΠΊΠ°. ΠΠ±Π΅ΡΠΏΠ΅ΡΠΈΡΡ ΡΡΡΠ°Π½ΠΎΠ²ΠΊΡ ΡΠ°ΡΡΠΎΡΡ ΠΈ Π΄Π»ΠΈΡΠ΅Π»ΡΠ½ΠΎΡΡΠΈ ΡΠΎΡΠΌΠΈΡΡΠ΅ΠΌΡΡ ΡΠΈΠ³Π½Π°Π»ΠΎΠ².
Π¦Π΅Π»Ρ ΡΠ°Π±ΠΎΡΡ — ΡΠ°Π·ΡΠ°Π±ΠΎΡΠΊΠ° ΠΏΡΠΎΠ³ΡΠ°ΠΌΠΌΡ Π΄Π»Ρ ΡΠΏΡΠ°Π²Π»Π΅Π½ΠΈΡ ΡΠΈΡΡΠ΅ΠΌΠ½ΡΠΌ Π΄ΠΈΠ½Π°ΠΌΠΈΠΊΠΎΠΌ.
2. ΠΠ»Π³ΠΎΡΠΈΡΠΌ ΡΠ°Π±ΠΎΡΡ ΠΏΡΠΈΠ»ΠΎΠΆΠ΅Π½ΠΈΡ
ΠΡΠΎΠ³ΡΠ°ΠΌΠΌΠ° ΡΠ°Π±ΠΎΡΠ°Π΅Ρ ΠΏΠΎ Π°Π»Π³ΠΎΡΠΈΡΠΌΡ, ΠΈΠ·ΠΎΠ±ΡΠ°ΠΆΡΠ½Π½ΠΎΠΌΡ Π½Π° ΡΠΈΡΡΠ½ΠΊΠ΅ 1.
Π ΠΈΡΡΠ½ΠΎΠΊ 1 — ΠΠ»Π³ΠΎΡΠΈΡΠΌ ΡΠ°Π±ΠΎΡΡ ΠΡΠΈ Π·Π°ΠΏΡΡΠΊΠ΅, ΠΏΡΠΈΠ»ΠΎΠΆΠ΅Π½ΠΈΠ΅ ΠΏΡΠΎΡΠΈΡΠΎΠ²ΡΠ²Π°Π΅Ρ Π³Π»Π°Π²Π½ΠΎΠ΅ ΠΎΠΊΠ½ΠΎ ΠΈ ΠΎΠΆΠΈΠ΄Π°Π΅Ρ Π½Π°ΠΆΠ°ΡΠΈΡ ΠΊΠ½ΠΎΠΏΠΊΠΈ. ΠΡΠΈ Π½Π°ΠΆΠ°ΡΠΈΠΈ, ΡΡΠ°Π±Π°ΡΡΠ²Π°Π΅Ρ ΡΡΠ½ΠΊΡΠΈΡ GetDlgItemInt, ΠΊΠΎΡΠΎΡΠ°Ρ ΠΏΠΎΠ»ΡΡΠ°Π΅Ρ Π·Π½Π°ΡΠ΅Π½ΠΈΡ ΠΈΠ· ΠΊΠΎΠ½ΡΡΠΎΠ»ΠΎΠ² ΠΈ ΠΏΠ΅ΡΠ΅Π΄Π°ΡΡ Π² ΡΠ΅Π³ΠΈΡΡΡ eax. ΠΠΌΠ΅Π΅Ρ ΡΠ΅ΡΡΡΠ΅ ΠΏΠ°ΡΠ°ΠΌΠ΅ΡΡΠ°:
— hDlg — Π΄Π΅ΡΠΊΡΠΈΠΏΡΠΎΡ Π΄ΠΈΠ°Π»ΠΎΠ³ΠΎΠ²ΠΎΠ³ΠΎ ΠΎΠΊΠ½Π°, ΠΊΠΎΡΠΎΡΡΠΉ ΡΠΎΠ΄Π΅ΡΠΆΠΈΡ ΠΈΠ½ΡΠ΅ΡΠ΅ΡΡΡΡΠΈΠΉ ΠΎΡΠ³Π°Π½ ΡΠΏΡΠ°Π²Π»Π΅Π½ΠΈΡ;
— nIDDlgItem — ΡΡΡΠ°Π½Π°Π²Π»ΠΈΠ²Π°Π΅Ρ ΠΈΠ΄Π΅Π½ΡΠΈΡΠΈΠΊΠ°ΡΠΎΡ ΠΎΡΠ³Π°Π½Π° ΡΠΏΡΠ°Π²Π»Π΅Π½ΠΈΡ, ΡΠ΅ΠΊΡΡ ΠΊΠΎΡΠΎΡΠΎΠ³ΠΎ Π΄ΠΎΠ»ΠΆΠ΅Π½ Π±ΡΡΡ ΠΏΡΠ΅ΠΎΠ±ΡΠ°Π·ΠΎΠ²Π°Π½;
— lpTranslated — ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° ΠΏΠ΅ΡΠ΅ΠΌΠ΅Π½Π½ΡΡ, ΠΊΠΎΡΠΎΡΠ°Ρ ΠΏΠΎΠ»ΡΡΠ°Π΅Ρ Π·Π½Π°ΡΠ΅Π½ΠΈΠ΅ ΡΡΠΏΠ΅ΡΠ½ΠΎΠ³ΠΎ Π·Π°Π²Π΅ΡΡΠ΅Π½ΠΈΡ ΠΈΠ»ΠΈ Π·Π½Π°ΡΠ΅Π½ΠΈΠ΅ ΡΠ±ΠΎΡ (ΡΡΠΏΠ΅ΡΠ½ΠΎΠ΅ Π·Π°Π²Π΅ΡΡΠ΅Π½ΠΈΠ΅ ΠΎΠ±ΠΎΠ·Π½Π°ΡΠ°Π΅ΡΡΡ — ΠΠ‘Π’ΠΠΠ (TRUE), ΡΠ±ΠΎΠΉ ΠΎΠ±ΠΎΠ·Π½Π°ΡΠ°Π΅ΡΡΡ ΠΊΠ°ΠΊ ΠΠΠΠ¬ (FALSE)), Π΅ΡΠ»ΠΈ ΡΡΠΎΡ ΠΏΠ°ΡΠ°ΠΌΠ΅ΡΡ — ΠΠ£Π‘Π’Π (NULL), ΡΡΠ½ΠΊΡΠΈΡ Π½Π΅ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΠΈΠ½ΡΠΎΡΠΌΠ°ΡΠΈΡ ΠΎΠ± ΡΡΠΏΠ΅Ρ Π΅ ΠΈΠ»ΠΈ ΡΠ±ΠΎΠ΅;
— bSigned — ΡΡΡΠ°Π½Π°Π²Π»ΠΈΠ²Π°Π΅Ρ, Π΄ΠΎΠ»ΠΆΠ½Π° Π»ΠΈ ΡΡΠ½ΠΊΡΠΈΡ Π²Π½Π°ΡΠ°Π»Π΅ ΠΏΡΠΎΠ²Π΅ΡΡΡΡ ΡΠ΅ΠΊΡΡ Π½Π° Π·Π½Π°ΠΊ ΠΌΠΈΠ½ΡΡ ΠΈ Π²ΠΎΠ·Π²ΡΠ°ΡΠΈΡΡ Π·Π½Π°ΡΠ΅Π½ΠΈΠ΅ ΡΠ΅Π»ΠΎΠ³ΠΎ ΡΠΈΡΠ»Π° ΡΠΎ Π·Π½Π°ΠΊΠΎΠΌ, Π΅ΡΠ»ΠΈ ΠΎΠ½Π° Π½Π°Ρ ΠΎΠ΄ΠΈΡ ΡΡΠΎΡ ΠΌΠΈΠ½ΡΡ (Π·Π½Π°ΡΠ΅Π½ΠΈΠ΅ ΠΠ‘Π’ΠΠΠ (TRUE) ΡΡΡΠ°Π½Π°Π²Π»ΠΈΠ²Π°Π΅Ρ, ΡΡΠΎ ΡΡΠΎ Π΄ΠΎΠ»ΠΆΠ½ΠΎ Π±ΡΡΡ ΡΠ΄Π΅Π»Π°Π½ΠΎ, ΠΠΠΠ¬ (FALSE), — ΡΡΠΎ Π½Π΅ Π΄ΠΎΠ»ΠΆΠ½ΠΎ).
ΠΠ°ΡΠ΅ΠΌ ΠΏΠΎΠ»ΡΡΠ΅Π½Π½ΠΎΠ΅ Π·Π½Π°ΡΠ΅Π½ΠΈΠ΅ ΠΏΠ΅ΡΠ΅Π΄Π°ΡΡΡΡ ΠΊΠΎΠΌΠ°Π½Π΄ΠΎΠΉ mov ΠΈΠ· ΡΠ΅Π³ΠΈΡΡΡΠ° eax Π² Π½ΡΠΆΠ½ΡΡ ΠΏΠ΅ΡΠ΅ΠΌΠ΅Π½Π½ΡΡ. ΠΠ»Ρ ΡΠΏΡΠ°Π²Π»Π΅Π½ΠΈΡ Π΄ΠΈΠ½Π°ΠΌΠΈΠΊΠΎΠΌ ΡΠΈΡΡΠ΅ΠΌΠ½ΠΎΠ³ΠΎ Π±Π»ΠΎΠΊΠ° (Π±ΠΈΠΏΠ΅ΡΠΎΠΌ), ΠΈΡΠΏΠΎΠ»ΡΠ·ΡΠ΅ΡΡΡ Π±ΠΈΠ±Π»ΠΈΠΎΡΠ΅ΡΠ½Π°Ρ ΡΡΠ½ΠΊΡΠΈΡ beep. ΠΠ°Π½Π½Π°Ρ ΡΡΠ½ΠΊΡΠΈΡ ΠΈΠΌΠ΅Π΅Ρ Π΄Π²Π° ΠΏΠ°ΡΠ°ΠΌΠ΅ΡΡΠ°:
— dwFreq — ΡΠ°ΡΡΠΎΡΠ° Π·Π²ΡΠΊΠ° Π² Π³Π΅ΡΡΠ°Ρ , Π΄ΠΎΠΏΡΡΡΠΈΠΌΡΠΉ Π΄ΠΈΠ°ΠΏΠ°Π·ΠΎΠ½ — ΠΎΡ 37 Π΄ΠΎ 32 767 ΠΡ;
— dwDuration — ΠΏΡΠΎΠ΄ΠΎΠ»ΠΆΠΈΡΠ΅Π»ΡΠ½ΠΎΡΡΡ Π·Π²ΡΠΊΠ° Π² ΠΌΠΈΠ»Π»ΠΈΡΠ΅ΠΊΡΠ½Π΄Π°Ρ ;
Π§ΡΠΎΠ±Ρ ΠΎΠ±Π΅ΡΠΏΠ΅ΡΠΈΡΡ ΡΡΡΠ°Π½ΠΎΠ²ΠΊΡ ΡΠ°ΡΡΠΎΡΡ ΠΈ ΠΏΡΠΎΠ΄ΠΎΠ»ΠΆΠΈΡΠ΅Π»ΡΠ½ΠΎΡΡΠΈ, Π½Π΅ΠΎΠ±Ρ ΠΎΠ΄ΠΈΠΌΠΎ Π½Π° ΡΠΎΡΠΌΡ Π΄ΠΎΠ±Π°Π²ΠΈΡΡ Π΄Π²Π° ΠΊΠΎΠ½ΡΡΠΎΠ»Π° Edit Ρ ΡΡΡΠ°Π½ΠΎΠ²Π»Π΅Π½Π½ΡΠΌ ΠΏΠ°ΡΠ°ΠΌΠ΅ΡΡΠΎΠΌ ES_NUMBER, ΡΡΠΎΠ±Ρ ΠΏΡΠ΅Π΄ΠΎΡΠ²ΡΠ°ΡΠΈΡΡ Π²Π²ΠΎΠ΄ ΡΠΈΠΌΠ²ΠΎΠ»ΠΎΠ², ΠΎΡΠ»ΠΈΡΠ½ΡΡ ΠΎΡ ΡΠΈΡΡ. ΠΠ»Ρ Ρ ΡΠ°Π½Π΅Π½ΠΈΡ ΠΈ ΠΏΠ΅ΡΠ΅Π΄Π°ΡΠΈ Π² ΡΡΠ½ΠΊΡΠΈΡ Π·Π½Π°ΡΠ΅Π½ΠΈΠΉ, Π±ΡΠ»ΠΈ ΡΠΎΠ·Π΄Π°Π½Ρ Π΄Π²Π΅ ΠΏΠ΅ΡΠ΅ΠΌΠ΅Π½Π½ΡΠ΅ freq_var ΠΈ dur_var (ΡΠ°ΡΡΠΎΡΠ° ΠΈ Π΄Π»ΠΈΡΠ΅Π»ΡΠ½ΠΎΡΡΡ ΡΠΎΠΎΡΠ²Π΅ΡΡΠ²Π΅Π½Π½ΠΎ) Ρ ΡΠΈΠΏΠΎΠΌ dd (dword). ΠΠ»Ρ ΠΏΡΠΎΠΈΠ³ΡΡΠ²Π°Π½ΠΈΡ Π·Π²ΡΠΊΠ° ΡΠ°Π·ΠΌΠ΅ΡΠ΅Π½Π° ΠΊΠ½ΠΎΠΏΠΊΠ° play Ρ Π½Π°Π΄ΠΏΠΈΡΡΡ «ΠΠΎΡΠΏΡΠΎΠΈΠ·Π²Π΅ΡΡΠΈ».
3. ΠΡΠΈΠΌΠ΅Ρ ΡΠ°Π±ΠΎΡΡ ΠΏΡΠΈΠ»ΠΎΠΆΠ΅Π½ΠΈΡ
ΠΠ½Π΅ΡΠ½ΠΈΠΉ Π²ΠΈΠ΄ ΠΏΡΠΈΠ»ΠΎΠΆΠ΅Π½ΠΈΡ ΠΈΠ·ΠΎΠ±ΡΠ°ΠΆΡΠ½ Π½Π° ΡΠΈΡΡΠ½ΠΊΠ΅ 2.
Π ΠΈΡΡΠ½ΠΎΠΊ 2 — ΠΠ½Π΅ΡΠ½ΠΈΠΉ Π²ΠΈΠ΄ ΠΏΡΠΈΠ»ΠΎΠΆΠ΅Π½ΠΈΠ΅ Π°Π»Π³ΠΎΡΠΈΡΠΌ ΠΏΡΠΎΠ³ΡΠ°ΠΌΠΌΠ° ΠΠΎΠ»ΡΠ·ΠΎΠ²Π°ΡΠ΅Π»Ρ Π²Π²ΠΎΠ΄ΠΈΡ Π·Π½Π°ΡΠ΅Π½ΠΈΡ ΡΠ°ΡΡΠΎΡΡ Π·Π²ΡΠΊΠ° Π² Π²Π΅ΡΡ Π½Π΅Π΅ ΠΏΠΎΠ»Π΅, Π΄Π»ΠΈΡΠ΅Π»ΡΠ½ΠΎΡΡΠΈ — Π² Π½ΠΈΠΆΠ½Π΅Π΅. ΠΡΠΈ Π½Π°ΠΆΠ°ΡΠΈΠΈ Π½Π° ΠΊΠ½ΠΎΠΏΠΊΡ «ΠΠΎΡΠΏΡΠΎΠΈΠ·Π²Π΅ΡΡΠΈ», ΠΈΠ· ΡΠΈΡΡΠ΅ΠΌΠ΅Π½ΠΎΠ³ΠΎ Π΄ΠΈΠ½Π°ΠΌΠΈΠΊΠ° (ΠΈΠ»ΠΈ Π·Π²ΡΠΊΠΎΠ³ΠΎ ΡΡΡΡΠΎΠΉΡΡΠ²Π° ΠΏΠΎ-ΡΠΌΠΎΠ»ΡΠ°Π½ΠΈΡ, Π² ΡΠ»ΡΡΠ°Π΅ ΡΠΈΡΡΠ΅ΠΌΡ Windows 7) Π±ΡΠ΄Π΅Ρ Π·Π²ΡΡΠ°ΡΡ ΡΠΎΠ½ Π·Π°Π΄Π°Π½Π½ΠΎΠΉ ΡΠ°ΡΡΠΎΡΡ, Π² ΡΠ΅ΡΠ΅Π½ΠΈΠΈ Π·Π°Π΄Π°Π½Π½ΠΎΠ³ΠΎ Π²ΡΠ΅ΠΌΠ΅Π½ΠΈ, ΠΎΠ΄Π½Π°ΠΊΠΎ, ΠΏΡΠΈ ΡΡΡΠ°Π½ΠΎΠ²ΠΊΠ΅ ΡΠ°ΡΡΠΎΡΡ ΠΌΠ΅Π½ΡΡΠ΅ 35 ΠΡ ΠΈΠ»ΠΈ Π²ΡΡΠ΅ 19 ΠΊΠΡ Π·Π²ΡΠΊ ΡΠ»ΡΡΠ΅Π½ Π½Π΅ Π±ΡΠ΄Π΅Ρ ΠΈΠ·-Π·Π° ΠΎΡΠΎΠ±Π΅Π½Π½ΠΎΡΡΠ΅ΠΉ ΡΠ΅Π»ΠΎΠ²Π΅ΡΠ΅ΡΠΊΠΎΠ³ΠΎ ΡΠ»ΡΡ Π°.
Π‘ΠΏΠΈΡΠΎΠΊ ΠΈΡΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°Π½Π½ΡΡ ΠΈΡΡΠΎΡΠ½ΠΈΠΊΠΎΠ²
1. IDE MASM Builder [ΠΠ»Π΅ΠΊΡΡΠΎΠ½Π½ΡΠΉ ΡΠ΅ΡΡΡΡ]. — Π Π΅ΠΆΠΈΠΌ Π΄ΠΎΡΡΡΠΏΠ°: http://www.digitaction.com/index.php/products/masm-builder-integrated-development-environment-for-masm32.html.
2. Beep function (Windows) [ΠΠ»Π΅ΠΊΡΡΠΎΠ½Π½ΡΠΉ ΡΠ΅ΡΡΡΡ]. — Π Π΅ΠΆΠΈΠΌ Π΄ΠΎΡΡΡΠΏΠ°: http://msdn.microsoft.com/en-us/library/windows/desktop/ms679277% 28v=vs.85% 29. aspx, ΡΠ²ΠΎΠ±ΠΎΠ΄Π½ΡΠΉ.
3 GetDlgItemInt (Windows) [ΠΠ»Π΅ΠΊΡΡΠΎΠ½Π½ΡΠΉ ΡΠ΅ΡΡΡΡ]. — Π Π΅ΠΆΠΈΠΌ Π΄ΠΎΡΡΡΠΏΠ°: http://msdn.microsoft.com/en-us/library/windows/desktop/ms645485% 28v=vs.85% 29. aspx, ΡΠ²ΠΎΠ±ΠΎΠ΄Π½ΡΠΉ.
ΠΡΠΈΠ»ΠΎΠΆΠ΅Π½ΠΈΠ΅
ΠΠΈΡΡΠΈΠ½Π³ ΠΏΡΠΎΠ³ΡΠ°ΠΌΠΌΡ
model flat, stdcall option casemap: none
include masm32includewindows. inc include masm32includeuser32. inc include masm32includekernel32. inc include masm32includegdi32. inc include masm32includecomdlg32. inc include masm32includeshell32. inc includelib masm32libuser32. lib includelib masm32libkernel32. lib includelib masm32libgdi32. lib includelib masm32libcomdlg32. lib includelib masm32libshell32. lib
includelib masm32procscontrolsbaumanets. lib WinMain proto: DWORD:DWORD:DWORD:DWORD
RGB macro red, green, blue
xor eax, eax
mov ah, blue
shl eax, 8
mov ah, green
mov al, red
endm
szText MACRO Name, Text: VARARG
LOCAL lbl
jmp lbl
Name db Text, 0
lbl:
ENDM
const
playID equ 5
durID equ 4
Label2ID equ 3
freqID equ 2
Label1ID equ 1
data?
hFontN HWND?
hwndplay HWND?
hwnddur HWND?
hwndLabel2 HWND?
hwndfreq HWND?
hwndLabel1 HWND?
hInstance HINSTANCE?
CommandLine LPSTR?
data
lf LOGFONT <>
Textplay db «ΠΠΎΡΠΏΡΠΎΠΈΠ·Π²Π΅ΡΡΠΈ», 0
Textdur db «0», 0
TextLabel2 db «ΠΠ»ΠΈΡΠ΅Π»ΡΠ½ΠΎΡΡΡ, ΠΌΡΠ΅ΠΊ», 0
Textfreq db «0», 0
TextLabel1 db «Π§Π°ΡΡΠΎΡΠ°, ΠΡ», 0
szFontName db «MS Sans Serif», 0
;_______________
ClassName db «mbuilder», 0
BtnClName | db «button», 0 | |||
StatClName | db «static», 0 | |||
EditClName | db «edit», 0 | |||
LboxClName | db «listbox», 0 | |||
CboxClName | db «combobox», 0 | |||
ReditClName | db «richedit», 0 | |||
RichEditLib | db «riched32.dll», 0 | |||
FormCaption | db «ΠΠ²ΡΠΊΠΎΠ³Π΅Π½Π΅ΡΠ°ΡΠΎΡ», 0 | |||
;_______________ | ||||
freq_var | dd 0 | |||
dur_var | dd 0 | |||
code | ||||
start: | ||||
invoke | GetModuleHandle, NULL | |||
mov | hInstance, eax | |||
invoke | GetCommandLine | |||
invoke | WinMain, hInstance, NULL, CommandLine, SW_SHOWDEFAULT | |||
invoke | ExitProcess, eax | |||
WinMain proc | ||||
hInst:HINSTANCE, hPrevInst: HINSTANCE, CmdLine: LPSTR, CmdShow: DWORD | ||||
LOCAL wc | :WNDCLASSEX | |||
LOCAL msg | :MSG | |||
LOCAL hwnd | :HWND | |||
mov | wc.cbSize, SIZEOF WNDCLASSEX | |||
mov | wc.style, CS_BYTEALIGNCLIENT | |||
mov | wc.lpfnWndProc, offset WndProc | |||
mov | wc.cbClsExtra, NULL | |||
mov | wc.cbWndExtra, NULL | |||
push hInst | ||||
pop | wc.hInstance | |||
mov | wc.hbrBackground, COLOR_BTNFACE+1 | |||
mov | wc.lpszClassName, OFFSET ClassName | |||
invoke | LoadIcon, NULL, IDI_APPLICATION | |||
mov | wc.hIcon, eax | |||
mov | wc.hIconSm, eax | |||
invoke | LoadCursor, NULL, IDC_ARROW | |||
mov | wc.hCursor, eax | |||
invoke | RegisterClassEx, addr wc | |||
invoke CreateWindowEx, 0, ADDR ClassName, ADDR | ||||
FormCaption, WS_SYSMENU or WS_SIZEBOX, 209,89,255,130,0,0, hInst, 0 | ||||
mov | hwnd, eax | |||
INVOKE | ShowWindow, hwnd, SW_SHOWNORMAL | |||
INVOKE | UpdateWindow, hwnd | |||
WHILE TRUE | ||||
invoke | GetMessage, ADDR msg, 0,0,0 | |||
BREAK.IF (! eax) | ||||
invoke | TranslateMessage, ADDR msg | |||
invoke | DispatchMessage, ADDR msg | |||
ENDW | ||||
mov | eax, msg. wParam | |||
ret | ||||
WinMain endp | ||||
WndProc proc hWnd: HWND, uMsg: UINT, wParam: WPARAM, lParam: LPARAM | ||||
IF uMsg == WM_DESTROY | ||||
invoke | PostQuitMessage, NULL | |||
ELSEIF uMsg == WM_CREATE
invoke CreateWindowEx, 0, ADDR BtnClName, ADDR Textplay, WS_CHILD or BS_DEFPUSHBUTTON or WS_VISIBLE, 0,72,243,25, hWnd, playID, hInstance, 0
mov | hwndplay, eax | |||
invoke CreateWindowEx, WS_EX_CLIENTEDGE, ADDR EditClName, ADDR | ||||
Textdur, WS_CHILD or ES_LEFT or ES_AUTOHSCROLL or ES_NUMBER or | ||||
WS_VISIBLE, 120,40,121,22, hWnd, durID, hInstance, 0 | ||||
mov | hwnddur, eax | |||
invoke CreateWindowEx, WS_EX_LEFT, ADDR StatClName, ADDR | ||||
TextLabel2, WS_CHILD or SS_LEFT or SS_NOTIFY or | ||||
WS_VISIBLE, 8,40,109,18, hWnd, Label2ID, hInstance, 0 | ||||
mov | hwndLabel2, eax | |||
invoke CreateWindowEx, WS_EX_CLIENTEDGE, ADDR EditClName, ADDR | ||||
Textfreq, WS_CHILD or ES_LEFT or ES_AUTOHSCROLL or ES_NUMBER or | ||||
WS_VISIBLE, 120,8,121,22, hWnd, freqID, hInstance, 0 | ||||
mov | hwndfreq, eax | |||
invoke CreateWindowEx, WS_EX_LEFT, ADDR StatClName, ADDR | ||||
TextLabel1, WS_CHILD or SS_LEFT or SS_NOTIFY or | ||||
WS_VISIBLE, 8,8,64,18, hWnd, Label1ID, hInstance, 0 | ||||
mov | hwndLabel1, eax | |||
invoke | lstrcpy, addr lf. lfFaceName, addr szFontName | |||
mov | lf.lfWeight, 500 | |||
mov | lf.lfHeight, — 11 | |||
invoke | CreateFontIndirect, addr lf | |||
mov | hFontN, eax | |||
invoke | SendMessage, hwnddur, WM_SETFONT, hFontN, 1 | |||
invoke | SendMessage, hwndfreq, WM_SETFONT, hFontN, 1 | |||
invoke | SendMessage, hwndLabel2, WM_SETFONT, hFontN, 1 | |||
invoke | SendMessage, hwndLabel1, WM_SETFONT, hFontN, 1 | |||
invoke | SendMessage, hwndplay, WM_SETFONT, hFontN, 1 | |||
ELSEIF uMsg == WM_COMMAND | ||||
mov | eax, wParam | |||
IF lParam≠ 0 | ||||
IF ax == playID | ||||
shr eax, 16 | ||||
IF ax == BN_CLICKED | ||||
invoke | GetDlgItemInt, hWnd, freqID, 0,1 | |||
mov freq_var, eax | ||||
invoke | GetDlgItemInt, hWnd, durID, 0,1 | |||
mov dur_var, eax | ||||
invoke Beep, freq_var, dur_var | ||||
ENDIF | ||||
ENDIF | ||||
ENDIF | ||||
ELSE | ||||
invoke | DefWindowProc, hWnd, uMsg, wParam, lParam | |||
ret | ||||
ENDIF | ||||
xor | eax, eax | |||
ret | ||||
WndProc endp | ||||
end start | ||||