Ŀ
 Presents
  ڿĴ VMag, Issue 2, 1 June 1998
  

                         ASSEMBLER & WIN32.

        ணࠬ஢    ᥬ     Win32   ਭ
쬠    筮.  ⠥,    ᠭ ਫ ᫨誮
᫮     ਬ  ᥬ.   ⢥  㦤    ⮣
᪮쪮  ࠢ  ⠪  窠  ७   饭  .
    ⠢  ᢮  楫  祭 ணࠬ஢  Win32 
祭 ᥬ,   ࠧ㬥,  ⥫   ।
   .

          ⫨稥     ணࠬ஢     DOS,     ணࠬ
ᠭ  몠  ᮪ ஢ ()  뫨  宦   ᢮
, ᠭ  ᥬ, ਫ  Win32   ࠧ
 饣.    ।,   易  ⥬,   饭 
ࢨ  樮  ⥬    Windows  ⢫ ।⢮
맮 㭪権,    뢠,   뫮 ࠪ୮   DOS. 
  ।  ࠬ஢    ॣ    饭     ࢨ
㭪 ,  ᮮ⢥⢥,    ⢠  १ 祭
頥    ॣ  饣   祭    ॣ   䫠.
⥫쭮    ᯮ짮 ⮪ 맮  㭪権
⥬ ࢨ.  㣮  ஭,  Win32   ।⢥
ࠡ      ஢,  祬  "訫"  ணࠬ   DOS.
  ᠭ  ணࠬ    Win32  ⠫ ⥫쭮   
᫮ ᫥騬 䠪ࠬ:

        - ⢨   startup  ,  ࠪ୮    ਫ 
          ᪨ ⥪ ᠭ  Windows 3.x;

        -  ⥬ 樨  :    
           १   ॣ 饣 祭;  "⢨"
          ᥣ ॣ஢;

        - 㯭  񬮢 㠫쭮 ;

        - ࠧ   ࢨ  樮  ⥬,     㭪権,
           ࠧࠡ ਫ;

        - ࠧ     㯭  । ᮧ 䥩 
          짮⥫ (,   ..).

        ६ ᥬ,  ஬  ⭮  TASM 5.0  
Borland  International  Inc.,    ᢮  ।,  ࠧ   ।⢠,
 ࠭ 뫨 ࠪ ⮫쪮  .  ⠪ ।⢠  
⭥  ம।   맮  楤,      
蠡     楤      (ᠭ      ⨯)            
ꥪ⭮-ਥ஢  ७.  ,  ᥬ  ࠭  
⠪   ४   㬥,       ம।    
짮⥫, 業  ஬     .

            䠪     ᬠਢ  ᥬ,   
ᠬ⥫  㬥    ᠭ  ਫ   
Win32 (Windows NT   Windows 95).      ,
ᬮਬ ⮩ ਬ ਫ, ࠡ饣   .



               ਬ 1. ணࠬ ࠡ  .


*** , ᮤঠ騩 ⥪ ਫ, dlg.asm


IDEAL
P586
RADIX	16
MODEL	FLAT

%NOINCL
%NOLIST
include	"winconst.inc"		; API Win32 consts
include	"winptype.inc"		; API Win32 functions prototype
include	"winprocs.inc"		; API Win32 function
include	"resource.inc"		; resource consts

MAX_USER_NAME	=	20

DataSeg
szAppName	db	'Demo 1', 0
szHello		db	'Hello, '
szUser		db	MAX_USER_NAME dup (0)

CodeSeg
Start:          call    GetModuleHandleA,0
                call    DialogBoxParamA,eax,IDD_DIALOG,0,offset DlgProc,0
		cmp	eax,IDOK
		jne	short bye
                call    MessageBoxA,0,offset szHello,offset szAppName,MB_OK or MB_ICONINFORMATION
bye:            call    ExitProcess, 0

public	stdcall	DlgProc
proc	DlgProc	stdcall
arg     @@hDlg:dword, @@iMsg:dword, @@wPar:dword, @@lPar:dword
		mov	eax,[@@iMsg]
		cmp	eax,WM_INITDIALOG
		je	short @@init
		cmp	eax,WM_COMMAND
		jne	short @@ret_false

		mov	eax,[@@wPar]
		cmp	eax,IDCANCEL
		je	short @@cancel
		cmp	eax,IDOK
		jne	short @@ret_false

                call    GetDlgItemTextA,@@hDlg,IDR_NAME,offset szUser,MAX_USER_NAME
		mov	eax,IDOK
@@cancel:       call    EndDialog,@@hDlg,eax

@@ret_false:	xor	eax,eax
		ret

@@init:         call    GetDlgItem,@@hDlg,IDR_NAME
                call    SetFocus,eax
		jmp	short @@ret_false
endp	DlgProc
end	Start


***  ᮢ dlg.rc


#include "resource.h"

IDD_DIALOG DIALOGEX 0, 0, 187, 95
STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_CLIENTEDGE
CAPTION "Dialog"
FONT 8, "MS Sans Serif"
BEGIN
    DEFPUSHBUTTON   "OK",IDOK,134,76,50,14
    PUSHBUTTON      "Cancel",IDCANCEL,73,76,50,14
    LTEXT           "Type your name",IDC_STATIC,4,36,52,8
    EDITTEXT        IDR_NAME,72,32,112,14,ES_AUTOHSCROLL
END



        ⠫ 䠩   ਬ, ਢ  ਫ 1.

                  ⪨ ਨ  ணࠬ:

        ࠧ ᫥  ⪨ Start,  ணࠬ 頥   㭪樨 API
Win32  GetModuleHandle    祭  handle    (
ࠬ        handle  of instance). 稢 handle, 
뢠 ,  ᮧ   ,      -
ணࠬ ந⥫  ᮢ.   ணࠬ ஢  १
ࠡ     .  ᫨   짮⥫  襫      
।⢮   OK,   ਫ ᪠ MessageBox  
⥪⮬  ਢ⢨.    楤  ࠡ뢠   ᫥騥
ᮮ饭.    樠樨    (WM_INITDIALOG)     
Windows ⠭ 䮪      짮⥫.  饭
WM_COMMAND ࠡ뢠   ⠪  浪:   ஢ઠ  
  ,  ᫨  뫠     OK,  짮⥫᪨
      ६  szValue,  ᫨  뫠  
Cancel,   ஢   ந,      ⮬  㣮 砥
뢠 㭪 砭  : EndDialog. ⠫  ᮮ饭
  㯯   WM_COMMAND     ,  ।⠢   Windows
⢮  㬮砭.

            ࠢ   ਢ  ணࠬ     筮
ணࠬ,   ᠭ      ,   ࠧ      ᠭ   㤥
⥫쭠. 祢  ,   ᠫ ਫ   ᥬ  
Windows 3.x, ⬥  䠪,   祧 室  ᫮  
஬ startup  .   ਫ 룫廊     
⢥.



                 ਬ 2. ᪠ ⥪.

        ᠭ ᪨ ⥪   Win32 ⠪  ⥫쭮
⨫,   ࠢ   ⥬,       Windows 3.x.
祧 室 ⠢  startup ,   ᯮ짮 
ᮡ⨩ 樠樨/樠樨   ஢ ᮢ   ⮪,
 . ᬮਬ  ⮩ ਬ ᪮  ⥪,
 ன ᥣ  㭪,  ८ࠧ 楫 ᫠  ப  
⭠筮 ⥬ ᫥.


***  mylib.asm


Ideal
P586
Radix	16
Model	flat

DLL_PROCESS_ATTACH	= 1

extrn	GetVersion:	proc

DataSeg
hInst		dd	0
OSVer		dw	0

CodeSeg
proc	libEntry	stdcall
arg     @@hInst:dword, @@rsn:dword, @@rsrv:dword
		cmp	[@@rsn],DLL_PROCESS_ATTACH
		jne	@@1
		call	GetVersion
		mov	[OSVer],ax
		mov	eax,[@@hInst]
		mov	[hInst],eax
@@1:		mov	eax,1
		ret
endP	libEntry

public	stdcall	Hex2Str
proc	Hex2Str	stdcall
arg     @@num:dword, @@str:dword
uses	ebx
		mov	eax,[@@num]
		mov	ebx,[@@str]
		mov	ecx,7
@@1:		mov	edx,eax
		shr	eax,4
		and	edx,0F
		cmp	edx,0A
		jae	@@2
		add	edx,'0'
		jmp	@@3
@@2:		add	edx,'A' - 0A
@@3:		mov	[byte ebx + ecx],dl
		dec	ecx
		jns	@@1
		mov	[byte ebx + 8],0
		ret
endp	Hex2Str

end	libEntry



        ⠫  䠩,    室      ਬ,
   ਫ 2.

           ⪨ ਨ  ᪮ ⥪:

        楤  libEntry    窮  室     
⥪,         ᯮ㥬, 稪  ᠬ
।    ⮭宦.  LibEntry   뢠  
:

        -    ஥஢   ⥪    ᭮   ࠭⢮
           (DLL_PROCESS_ATTACH);

        -  ࢮ 맮 ⥪  ⮪  (DLL_THREAD_ATTACH),
          ਬ,   㭪樨 LoadLibrary;

        -  㧪 ⥪ ⮪ (DLL_THREAD_DETACH);

        -  㧪  ⥪  ᭮  ࠭⢠ 
          (DLL_PROCESS_DETACH).

          襬  ਬ  ࠡ뢠  ⮫쪮  ࢮ    ᮡ⨩
DLL_PROCESS_ATTACH.      ࠡ⪥      ᮡ   ⥪
訢  OS ࠭ ,   ⠪ ᢮ handle of  instance.
⥪  ᮤন  ⮫쪮    ᯮ㥬  㭪,   
ᮡ⢥    ॡ  ᭥.   ,  ,     
    ,    ந   ८ࠧ 祭.
᭠  ⥬   樨  ।⢮     ॣ஢   饣
祭:  ebx  +  ecx,      ᯮ짮 ॣ ecx
६   稪   ⠢  .



                    ਬ 3.  ਫ.


***  dmenu.asm


Ideal
P586
Radix	16
Model	flat

struc	WndClassEx
	cbSize		dd	0
	style		dd	0
	lpfnWndProc	dd	0
	cbClsExtra	dd	0
	cbWndExtra	dd	0
	hInstance	dd	0
	hIcon		dd	0
	hCursor		dd	0
	hbrBackground	dd	0
	lpszMenuName	dd	0
	lpszClassName	dd	0
	hIconSm		dd	0
ends	WndClassEx

struc	Point
	x		dd	0
	y		dd	0
ends	Point

struc	msgStruc
	hwnd		dd	0
	message		dd	0
	wParam		dd	0
	lParam		dd	0
	time		dd	0
	pnt		Point	<>
ends	msgStruc

MyMenu			= 0065
ID_OPEN			= 9C41
ID_SAVE			= 9C42
ID_EXIT			= 9C43

CS_HREDRAW		= 0001
CS_VREDRAW		= 0002
IDI_APPLICATION	= 7F00
IDC_ARROW		= 00007F00
COLOR_WINDOW		= 5
WS_EX_WINDOWEDGE	= 00000100
WS_EX_CLIENTEDGE	= 00000200
WS_EX_OVERLAPPEDWINDOW	= WS_EX_WINDOWEDGE OR WS_EX_CLIENTEDGE
WS_OVERLAPPED		= 00000000
WS_CAPTION		= 00C00000
WS_SYSMENU		= 00080000
WS_THICKFRAME		= 00040000
WS_MINIMIZEBOX		= 00020000
WS_MAXIMIZEBOX		= 00010000
WS_OWERLAPPEDWINDOW     = WS_OVERLAPPED OR WS_CAPTION OR \
                          WS_SYSMENU OR WS_THICKFRAME OR \
                          WS_MINIMIZEBOX OR WS_MAXIMIZEBOX
CW_USEDEFAULT		= 80000000
SW_SHOW			= 5
WM_COMMAND		= 0111
WM_DESTROY		= 0002
WM_CLOSE		= 0010
MB_OK			= 0

PROCTYPE        ptGetModuleHandle       stdcall \
			lpModuleName	:dword

PROCTYPE	ptLoadIcon		stdcall	\
			hInstance	:dword,	\
			lpIconName	:dword

PROCTYPE	ptLoadCursor		stdcall	\
			hInstance	:dword,	\
			lpCursorName	:dword

PROCTYPE	ptLoadMenu		stdcall	\
			hInstance	:dword,	\
			lpMenuName	:dword

PROCTYPE	ptRegisterClassEx	stdcall	\
			lpwcx		:dword

PROCTYPE	ptCreateWindowEx	stdcall	\
			dwExStyle	:dword,	\
			lpClassName	:dword,	\
			lpWindowName	:dword,	\
			dwStyle		:dword,	\
			x		:dword, \
			y		:dword,	\
			nWidth		:dword,	\
			nHeight		:dword,	\
			hWndParent	:dword,	\
			hMenu		:dword, \
			hInstance	:dword,	\
			lpParam		:dword

PROCTYPE	ptShowWindow		stdcall	\
			hWnd		:dword,	\
			nCmdShow	:dword

PROCTYPE	ptUpdateWindow		stdcall	\
			hWnd		:dword

PROCTYPE	ptGetMessage		stdcall	\
			pMsg		:dword,	\
			hWnd		:dword,	\
			wMsgFilterMin	:dword,	\
			wMsgFilterMax	:dword

PROCTYPE	ptTranslateMessage	stdcall	\
			lpMsg		:dword

PROCTYPE	ptDispatchMessage	stdcall	\
			pmsg		:dword

PROCTYPE	ptSetMenu		stdcall	\
			hWnd		:dword,	\
			hMenu		:dword

PROCTYPE	ptPostQuitMessage	stdcall	\
			nExitCode	:dword

PROCTYPE	ptDefWindowProc	stdcall	\
			hWnd		:dword,	\
			Msg		:dword,	\
			wParam		:dword,	\
			lParam		:dword

PROCTYPE	ptSendMessage		stdcall	\
			hWnd		:dword,	\
			Msg		:dword,	\
			wParam		:dword,	\
			lParam		:dword

PROCTYPE	ptMessageBox		stdcall	\
			hWnd		:dword,	\
			lpText		:dword,	\
			lpCaption	:dword,	\
			uType		:dword

PROCTYPE	ptExitProcess		stdcall	\
			exitCode	:dword

extrn		GetModuleHandleA	:ptGetModuleHandle
extrn		LoadIconA		:ptLoadIcon
extrn		LoadCursorA		:ptLoadCursor
extrn           RegisterClassExA        :ptRegisterClassEx
extrn		LoadMenuA		:ptLoadMenu
extrn           CreateWindowExA         :ptCreateWindowEx
extrn		ShowWindow		:ptShowWindow
extrn		UpdateWindow		:ptUpdateWindow
extrn		GetMessageA		:ptGetMessage
extrn		TranslateMessage	:ptTranslateMessage
extrn		DispatchMessageA	:ptDispatchMessage
extrn		SetMenu			:ptSetMenu
extrn           PostQuitMessage         :ptPostQuitMessage
extrn		DefWindowProcA		:ptDefWindowProc
extrn		SendMessageA		:ptSendMessage
extrn		MessageBoxA		:ptMessageBox
extrn		ExitProcess		:ptExitProcess

UDataSeg
hInst		dd		?
hWnd		dd		?

IFNDEF	VER1
hMenu		dd		?
ENDIF

DataSeg
msg		msgStruc	<>
classTitle	db	'Menu demo', 0
wndTitle	db	'Demo program', 0
msg_open_txt	db	'You selected open', 0
msg_open_tlt	db	'Open box', 0
msg_save_txt	db	'You selected save', 0
msg_save_tlt	db	'Save box', 0

CodeSeg
Start:  call    GetModuleHandleA,0      ;  易⥫쭮,  ⥫쭮
	mov	[hInst],eax

        sub     esp,SIZE WndClassEx     ; ⢥   ⥪  

	mov	[(WndClassEx esp).cbSize],SIZE WndClassEx
	mov	[(WndClassEx esp).style],CS_HREDRAW or CS_VREDRAW
	mov	[(WndClassEx esp).lpfnWndProc],offset WndProc
	mov	[(WndClassEx esp).cbWndExtra],0
	mov	[(WndClassEx esp).hInstance],eax
        call    LoadIconA,0,IDI_APPLICATION
	mov	[(WndClassEx esp).hIcon],eax
        call    LoadCursorA,0,IDC_ARROW
	mov	[(WndClassEx esp).hCursor],eax
	mov	[(WndClassEx esp).hbrBackground],COLOR_WINDOW
IFDEF	VER1
	mov	[(WndClassEx esp).lpszMenuName],MyMenu
ELSE
	mov	[(WndClassEx esp).lpszMenuName],0
ENDIF
	mov	[(WndClassEx esp).lpszClassName],offset classTitle
	mov	[(WndClassEx esp).hIconSm],0
        call    RegisterClassExA,esp            ; ॣ㥬  

	add	esp,SIZE WndClassEx		; ⠭ ⥪
						;  ᮧ 

IFNDEF	VER2
        call    CreateWindowExA,WS_EX_OVERLAPPEDWINDOW, \ extended window style
                                offset classTitle,      \ registered class name
                                offset wndTitle,        \ window name
                                WS_OWERLAPPEDWINDOW,    \ window style
                                CW_USEDEFAULT,          \ horizontal position of window
                                CW_USEDEFAULT,          \ vertical position of window
                                CW_USEDEFAULT,          \ window width
                                CW_USEDEFAULT,          \ window height
                                0,                      \ parent or owner window
                                0,                      \ handle to menu or child-window identifier
                                [hInst],                \ handle to application instance
                                0                       ; pointer to window-creation data
ELSE
        call    LoadMenu,hInst,MyMenu
	mov	[hMenu],eax
        call    CreateWindowExA,WS_EX_OWERLAPPEDWINDOW, \ extended window style
                                offset classTitle,      \ registered class name
                                offset wndTitle,        \ window name
                                WS_OWERLAPPEDWINDOW,    \ window style
                                CW_USEDEFAULT,          \ horizontal position of window
                                CW_USEDEFAULT,          \ vertical position of window
                                CW_USEDEFAULT,          \ window width
                                CW_USEDEFAULT,          \ window height
                                0,      \ handle to parent or owner window
                                eax,    \ handle to menu, or child-window identifier
                                [hInst],                \ handle to application instance
                                0                       ; pointer to window-creation data
ENDIF
	mov	[hWnd],eax
        call    ShowWindow,eax,SW_SHOW                  ; show window
        call    UpdateWindow,[hWnd]                     ; redraw window

IFDEF	VER3
        call    LoadMenuA,[hInst],MyMenu
	mov	[hMenu],eax
        call    SetMenu,[hWnd],eax
ENDIF

msg_loop:
        call    GetMessageA,offset msg,0,0,0
	or	ax,ax
	jz	exit
        call    TranslateMessage,offset msg
        call    DispatchMessageA,offset msg
	jmp	msg_loop
exit:   call    ExitProcess,    0

public	stdcall	WndProc
proc	WndProc	stdcall
arg     @@hwnd: dword, @@msg:dword, @@wPar:dword, @@lPar:dword
	mov	eax,[@@msg]
	cmp	eax,WM_COMMAND
	je	@@command
	cmp	eax,WM_DESTROY
	jne	@@default
        call    PostQuitMessage,0
	xor	eax,eax
	jmp	@@ret
@@default:
        call    DefWindowProcA,[@@hwnd],[@@msg],[@@wPar],[@@lPar]
@@ret:	ret
@@command:
	mov	eax,[@@wPar]
	cmp	eax,ID_OPEN
	je	@@open
	cmp	eax,ID_SAVE
	je	@@save
        call    SendMessageA,[@@hwnd],WM_CLOSE,0,0
	xor	eax,eax
	jmp	@@ret
@@open:	mov	eax, offset msg_open_txt
	mov	edx, offset msg_open_tlt
	jmp	@@mess
@@save:	mov	eax, offset msg_save_txt
	mov	edx, offset msg_save_tlt
@@mess: call    MessageBoxA,0,eax,edx,MB_OK
	xor	eax,eax
	jmp	@@ret
endp	WndProc
end	Start



                      ਨ  ணࠬ:

            ⥫       ।   த஢
ᯮ짮  ⨯  㭪権  API  Win32.  筮    ( ⠪
ᠭ  ⠭        API  Win32)  ᫥  뭥   
⤥  砥  䠩,  ᪮,  ᪮॥  ᥣ    㤥
ᯮ짮      㣨 ணࠬ.  ᠭ ⨯  㭪権
ᯥ稢 ண ஫  ஭   ⢮  
⨯ ࠬ஢,  ।   㭪樨.   ⢥ 砥
 ணࠬ,    訡 ६  ᯮ, ⥬
,    ᫮  ࠬ஢     㭪 API Win32 쬠
⥫쭮.

        ⢮      ணࠬ   砥      樨
ਠ⮢ ࠡ     . ணࠬ   ⪮஢  
 ਠ  (), 㪠뢠     VER2   VER3
( 㬮砭  ᯮ   VER1).   ࢮ ਠ  ணࠬ
 ।   ஢           
   筮 .   ஬  ਠ,  ।
 ᮧ ,  ࠬ 㭪樨 CreateWindowEx.    
       砥,     ⮣   
᢮ ᮡ⢥ .  ,  쥬 ਠ,   㦠
᫥  ᮧ  .    ਠ  뢠,   易
  㦥 ᮧ .

        ४⨢ ᫮ 樨     ਠ
 ⥪    ⮩   ணࠬ.  孨  㤮  ⮫쪮
  樨,        ⫠. ਬ,   ॡ
    ணࠬ    ࠣ  ,     ਬ
  孨,        㭪樮騩  .  ,  
筮, ਬ  ४⨢ ᫮  樨 -   㤮
।⢮ ஢ ࠧ 襭 (⬮)    㫥.
।⠢  ।    ᯮ짮  ⥪ ३ 
      ⥪  ।⢮  ॣ  㪠⥫ ⥪
(esp).        த஢       
WndClassEx.  뤥       ⥪  (३)     
६饭 esp:

	sub	esp,SIZE WndClassEx

              뤥  ᯮ  
    ॣ  㪠⥫  ⥪.   ᮧ 16- ਫ
⠪      .      ᯮ짮
    楤       ந쭮     ணࠬ.
  室      뤥  , ,
᫥  뢠,    ࠧ  ⥪  ࠭祭  ࠧ 訥
    ⥪     楫ᮮࠧ.     楫 
ᯮ짮 "" (heap)  㠫  (virtual memory).

        ⠫쭠  ணࠬ  筮 ਢ쭠    ॡ
-  ᭥.            ⥬
ᯮ짮 ம।.

                          ம।.

           筮   ।   室   񧭮   
ࠧࠡ⪮  ம।    ணࠬ஢   DOS.  Win32
    ਭ樯쭮    .        ࠬ⭮     ᠭ
ம।  ᯮᮡ    ⮫쪮    ⥭  ⨥
ணࠬ,   ॠ쭮   ணࠬ⮢.   ⮬,  
  Win32  ࠣ       ,       ⮬   
ਭ樯 ⫨.  ⥫쭠,  ⮬ ᫥,  
/  楤.   ⮬  㣮 砥  ।塞  
ᮮ饭   । ࠢ  ⮬   ,  ⢥砥
  ࠡ   祭  ᮮ饭.   ᫨     ணࠬ  ⨢
ᯮ    ,     ࠣ  ᨫ쭮
ॣ  ணࠬ,   ᤥ     ਣ     .
ਬ ம।  ⠪    祬 ࠢ.  
⢥ ᭮   ம।,  饣 ᯥਧ樥
㯠  ᮮ饭    ࠡ稪,    㦨  ᫥饥
ᠭ.



                      ਬ ம।.

macro	MessageVector	message1, message2:REST
	IFNB	<message1>
		dd	message1
		dd	offset @@&message1
		@@VecCount = @@VecCount + 1
		MessageVector	message2
	ENDIF
endm	MessageVector

macro	WndMessages	VecName, message1, message2:REST
	@@VecCount	= 0
DataSeg
label	@@&VecName	dword
	MessageVector	message1, message2
	@@&VecName&Cnt	= @@VecCount
CodeSeg
		mov	ecx,@@&VecName&Cnt
		mov	eax,[@@msg]
@@&VecName&_1:	dec	ecx
		js	@@default
		cmp	eax,[dword ecx * 8 + offset @@&VecName]
		jne	@@&VecName&_1
		jmp	[dword ecx + offset @@&VecName + 4]

@@default:	call	DefWindowProcA, [@@hWnd], [@@msg], [@@wPar], [@@lPar]
@@ret:		ret
@@ret_false:	xor	eax,eax
		jmp	@@ret
@@ret_true:	mov	eax,-1
		dec	eax
		jmp	@@ret
endm	WndMessage



                  ਨ  ம।:

           ᠭ   楤           ᯮ짮
ம।   WndMessages,   㪠      ᯨ᪥   ࠬ஢  
ᮮ饭,  ࠡ    ७  ⢨.  楤
 ਬ :

proc	WndProc	stdcall
arg     @@hWnd: dword, @@msg:dword, @@wPar:dword, @@lPar:dword
WndMessages     WndVector, WM_CREATE, WM_SIZE, WM_PAINT, WM_CLOSE, WM_DESTROY

@@WM_CREATE:
	;  ࠡ뢠 ᮮ饭 WM_CREATE
@@WM_SIZE:
	;  ࠡ뢠 ᮮ饭 WM_SIZE
@@WM_PAINT:
	;  ࠡ뢠 ᮮ饭 WM_PAINT
@@WM_CLOSE:
	;  ࠡ뢠 ᮮ饭 WM_CLOSE
@@WM_DESTROY:
;  ࠡ뢠 ᮮ饭 WM_DESTROY

endp	WndProc

        ࠡ  ᮮ饭   ६ ᯮᮡ:

        -    祭  TRUE,   ⮣ 室 ᯮ짮
          室   @@ret_true;

        -   祭 FALSE,   ⮣  室 ᯮ짮
          室   @@ret_false;

        - ३     ࠡ    㬮砭,  ⮣ 室
          ᤥ 室   @@default.

        ⬥,      ᫥  ⪨  ।   
WndMessages    ᫥ ।    ⥫ 楤.

             ࠧ,     ந室      맮
ம। WndMessages. 砫 ந 㫥  稪
ࠬ஢ ᠬ ம।  (᫮  ࠬ஢   
ந).   ᥣ   ᮧ    ⥬ ,
஥ ।  ம।  ⢥ ࢮ ࠬ.  
⪨ ନ  ⥭樨  ᨬ @@    .
⨣        ᯮ짮   &. ਬ, ᫨
।   TestLabel,    ⪨  ਬ :  @@TestLabel.
ࠧ       ⪨   뢠  㣮   ம।
MessageVector,  ஥  ।  ⠫  ࠬ, 
  祬 ,  ᯨ᪮ ᮮ饭,  ࠡ⪥  
楤  .    ம।  MessageVector   
⭠.    ࠬ   祩   ଠ
dword   ᮮ饭.   ᫥ 祩   ଠ dword
뢠    ⪨  ࠡ稪,    ன  ନ 
ᠭ  ࠢ.  稪 ᮮ饭 㢥稢   .
 ᫥ ४ᨢ 맮  ।祩    ॣ஢
ᮮ饭,   ⠪ த     ,   ᯨ᮪ ᮮ饭 
㤥 ௠.     ம। WndMessage   稭
ࠡ.   ⢮ ࠡ⪨  ᪮॥ ᥣ  㤥 ⭮ 
⥫ ᭥.

        ࠡ⪠ ᮮ饭   Windows     , ,  
ࠢ, ।⠢ ᮡ  . ਬ, ᮮ饭  WM_COMMAND
   ᥡ  ⢮ ᮮ饭 㯠    /
㣨 ࠢ ⮢.  ⥫쭮,  ⮤   
ᯥ宬  ਬ      㣨  ஢  ᪠    ᪮쪮
  .  ⢨⥫쭮,          ᨫ  ࠢ   
ᮮ饭,  㯠    楤      ,     롮
᫥⥫쭮 ⠭, 砥 㭪⠬    ࠢ騬
⠬  (controls)      .    ⮬ 砥  㦤 
⥫쭮  ,  ஥  ࠭   ᮮ饭.  
    㤥  ᮤঠ  ⮫쪮   ࠡ稪,  
㦭   쬠 .   祭  ⠭, 襤襩  
ᮮ饭, ⠥  䨪 ࢮ  㭪    ࢮ
ࠢ饣 ,     㤥   㦭   .
 ⮫쪮 ᤥ 室  ࠡ稪.

          ⥬  ம।  쬠  ⥫쭠  ୠ.
  ।      ࠬ⭮  ᯮ짮 ᮢ  
ᠤ,  ᪮         ᤥ ࠡ  ᥬ
⥫쭮   ⭥.

                               .

          ⮣,  ⮡    業  ਫ    Win32
ॡ  ⠪ :

        - ᮡ⢥       騪  ( ᯮ 離
          TASM32  TLINK32    TASM 5.0). ।  ᯮ짮
          ४ ""  patch,    .  Patch 
            site www.borland.com;

        - ।       ᮢ  (  ᯮ  Developer
          Studio  brcc32.exe);

        - 믮    ࠭  header   䠩     ᠭﬨ
          楤,   ⠭ API Win32  樨  ਭ⮩
           몥  ,    ࠭  ० ᥬ: Ideal
           MASM.   १        
          񣪨   ਫ  Win32,     
          ᬮ ᮧ   㠫  ,   ࠡ  
          ,   㦨 㭨樨,   ࠡ  multimedia
          㬥⠬.     ᠭ ணࠬ  DOS,   
          ࠭          ᯮ짮
          ᮢ  ,       ⮬  ᫮   ᠭ
          ਫ  ⥫쭮  ᭨        魮
          ࢨ  樮  ⥬,  ᯮ짮  㤮
          ⥬ 樨  쬠 ⮣ ଫ ணࠬ.



        ਫ 1. , 室  ࢮ ਬ.


***  ⠭ ᮢ resource.inc


IDD_DIALOG	=	65	; 101
IDR_NAME	=	3E8	; 1000
IDC_STATIC	=	-1
 । dlg.def
NAME		TEST
DESCRIPTION	'Demo dialog'
EXETYPE		WINDOWS
EXPORTS         DlgProc @1


***  樨 makefile


#   Make file for Demo dialog
#   make -B
#   make -B -DDEBUG for debug information

NAME	= dlg
OBJS	= $(NAME).obj
DEF	= $(NAME).def
RES	= $(NAME).res

TASMOPT=/m3 /mx /z /q /DWINVER=0400 /D_WIN32_WINNT=0400

!if $d(DEBUG)
TASMDEBUG=/zi
LINKDEBUG=/v
!else
TASMDEBUG=/l
LINKDEBUG=
!endif

!if $d(MAKEDIR)
IMPORT=$(MAKEDIR)\..\lib\import32
!else
IMPORT=import32
!endif

$(NAME).EXE: $(OBJS) $(DEF) $(RES)
	tlink32 /Tpe /aa /c $(LINKDEBUG) $(OBJS),$(NAME),, $(IMPORT), $(DEF), $(RES)

.asm.obj:
	tasm32 $(TASMDEBUG) $(TASMOPT) $&.asm

$(RES): $(NAME).RC
	BRCC32 -32 $(NAME).RC


***   resource.h


//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by dlg.rc
//
#define IDD_DIALOG                      101
#define IDR_NAME                        1000
#define IDC_STATIC                      -1

// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE        102
#define _APS_NEXT_COMMAND_VALUE         40001
#define _APS_NEXT_CONTROL_VALUE         1001
#define _APS_NEXT_SYMED_VALUE           101
#endif
#endif


        ਫ 2. , 室  ண ਬ.


***  ᠭ mylib.def


LIBRARY		MYLIB
DESCRIPTION	'DLL EXAMPLE, 1997'
EXPORTS         Hex2Str @1


***  樨 makefile


#   Make file for Demo DLL
#   make -B
#   make -B -DDEBUG for debug information

NAME	= mylib
OBJS	= $(NAME).obj
DEF	= $(NAME).def
RES	= $(NAME).res

TASMOPT=/m3 /mx /z /q /DWINVER=0400 /D_WIN32_WINNT=0400

!if $d(DEBUG)
TASMDEBUG=/zi
LINKDEBUG=/v
!else
TASMDEBUG=/l
LINKDEBUG=
!endif

!if $d(MAKEDIR)
IMPORT=$(MAKEDIR)\..\lib\import32
!else
IMPORT=import32
!endif

$(NAME).EXE: $(OBJS) $(DEF)
	tlink32 /Tpd /aa /c $(LINKDEBUG) $(OBJS),$(NAME),, $(IMPORT), $(DEF)

.asm.obj:
	tasm32 $(TASMDEBUG) $(TASMOPT) $&.asm

$(RES): $(NAME).RC
	BRCC32 -32 $(NAME).RC


       ਫ 3. , 室  쥣 ਬ.


***  ᠭ dmenu.def


NAME		TEST
DESCRIPTION	'Demo menu'
EXETYPE		WINDOWS
EXPORTS         WndProc @1


***  ᮢ dmenu.rc


#include "resource.h"
MyMenu MENU DISCARDABLE
BEGIN
    POPUP "Files"
    BEGIN
        MENUITEM "Open",                        ID_OPEN
        MENUITEM "Save",                        ID_SAVE
        MENUITEM SEPARATOR
        MENUITEM "Exit",                        ID_EXIT
    END
    MENUITEM "Other",                           65535
END


***   resource.h


//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by dmenu.rc
//
#define MyMenu                          101
#define ID_OPEN                         40001
#define ID_SAVE                         40002
#define ID_EXIT                         40003

// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE        102
#define _APS_NEXT_COMMAND_VALUE         40004
#define _APS_NEXT_CONTROL_VALUE         1000
#define _APS_NEXT_SYMED_VALUE           101
#endif
#endif


***  樨 makefile


#   Make file for Turbo Assembler Demo menu

#       make -B
#       make -B -DDEBUG -DVERN	for debug information and version

NAME	= dmenu
OBJS	= $(NAME).obj
DEF	= $(NAME).def
RES	= $(NAME).res

!if $d(DEBUG)
TASMDEBUG=/zi
LINKDEBUG=/v
!else
TASMDEBUG=/l
LINKDEBUG=
!endif

!if $d(VER2)
TASMVER=/dVER2
!elseif $d(VER3)
TASMVER=/dVER3
!else
TASMVER=/dVER1
!endif

!if $d(MAKEDIR)
IMPORT=$(MAKEDIR)\..\lib\import32
!else
IMPORT=import32
!endif

$(NAME).EXE: $(OBJS) $(DEF) $(RES)
	tlink32 /Tpe /aa /c $(LINKDEBUG) $(OBJS),$(NAME),, $(IMPORT), $(DEF), $(RES)

.asm.obj:
	tasm32 $(TASMDEBUG) $(TASMVER) /m /mx /z /zd $&.asm

$(RES): $(NAME).RC
	BRCC32 -32 $(NAME).RC



ASSEMBLER & WIN32                                       ᠭ ᮢ
(c) 27.11.97                            Alex Usov, 2:5080/82.3@FidoNet
