Download WINDOWS ASSEMBLY LANGUAGE & SYSTEMS PROGRAMMING

Transcript
100 Windows Assembly Language & Systems Programming
cwd
push dx
::s:
mov
mov
mov
mov
mov
mov
mov
mov
lea
push
push
I
ZmJRSOR
WORD PTR [bp-321,ax
;
;
:
/
ax,COLOR_BACKGROUND
PTR [bp-301,ax
ax,OFFSET szskeletonname
WORD PTR [bp-281,ax
WORD PTR [bp-261,ds
WORD PTR [bp-241,ax
WORD PTR [bp-221,ds
ax,WORD PTR [bp-461
;wndclass
;this is address of above data
ss
;structure.
ax
WORD
RegisterClassfl
Note that we only have to call RegisterClass for the first instance
of the program. If you double-click on the program icon a second
time, the second instance of the program created in memory will
not have to register the window with Windows.
sub ax,
push ax
push ax
mov ax,
push ax
sub ax,
push ax
push ax
call CRE
mov WOE:
push ax
push WOI
call SHC
push WOI
call UPI
jmp SH(
Message
loop
call REGISTERCLASS;registers this class of window.
or ax,ax
;error test.
quitwinmain
je
Displaying
a window
CreateWindow(-)
The above block of code registered the “specifications” of our
program’s window with Windows. Now to display it:
Parameters that have to be pushed on the stack prior to calling
CreateWindow are a long-pointer to window class-name, lp to
the window title-name, type of window, x and y coordinates, width
and height, parent-handle, menu-handle, instance-handle, and an lp
to parameters to link with the window.
createwin:
mov ax,OFFSET szskeletonname
push ds
;long-pointer (far address) of
push ax
;class-name.
mov ax,OFFSET szwintitle
;far address of window-title.
push ds
push ax
/
sub ax,ax
I*typi of window (32-bit value).
mov dx,207
;
push dx
;
push ax
!
ix-coord (16-bit).
mov ax,150
push ax
;
/
;y-co/ord (16-bit).
sub ax,ax
push ax
iwidth (16-bit).
mov ax,250
push ax
/
iheight (16-bit).
mov ax,200
push ax
;
/
mainloop:
lea ax,
push ss
push ax
call TFU
; . . . . . . .
lea ax,
push ss
push ax
call DI!
;........
messageloc
lea ax,
push ss
push ax
sub ax,
push ax
push ax
push ax
call GE!
or ax,
jne ma:
;GetMessa:
;so here u
mov ax,
quitwinmaj
mov sp
POP bp
ret 10