Home Random Page


CATEGORIES:

BiologyChemistryConstructionCultureEcologyEconomyElectronicsFinanceGeographyHistoryInformaticsLawMathematicsMechanicsMedicineOtherPedagogyPhilosophyPhysicsPolicyPsychologySociologySportTourism






The general principles of creation of window applications in the Assembler

In order to display any window, the program usually has to first describe its appearance and all of the properties, that is what is called a window class. MessageBox - it's a small window with the specified text message and one or more buttons. In our example, the message will be the traditional «Hello world!», And the button will be only one - OK.

; winhello.asm

; Graphic win32-prilozhenie

; A dialog box appears with the text type mesagebox "Hello world!"include def32.incinclude kernel32.incinclude user32.inc .386 .model flat .const

; window title

hello_title db "First win32 GUI program",0; messagehello_message db "Hello world!",0 .code_start: push MB_ICONINFORMATION ; window style push offset hello_title ; Address line with the title push offset hello_message ; Address line with the message push 0 ; ID of parent call MessageBox push 0 ; exit code call ExitProcess ; completion of the program end _startwe need to add to the file def32.inc line:; from winuser.h MB_ICONINFORMATION equ 40hand create a new file, user32.inc, which will include determining the functions of user32.dll - library, which includes all the basic functions that are responsible for window interface:; user32.inc; include file with definitions of functions from user32.dll;ifdef _TASM_ includelib import32.lib; the names of the functions extrn MessageBoxA:near; assignment to facilitate readability MessageBox equ MessageBoxAelse includelib user32.lib; true names used functions extrn __imp__MessageBoxA@16:dword; assignment to facilitate readability MessageBox equ __imp__MessageBoxA@16Now you can compile the program the same way as we did winurl.asm, and run - you will see a small window with our message and an OK button, which will disappear after you press the button. If winhello.asm compiled as a console application, nothing will change, the text box with the name of the program will be open as long as our message box is closed.

 

 


Date: 2015-01-29; view: 1079


<== previous page | next page ==>
Models of memory and the simplified directives of segment definition. Order of loading segments. | Global declarations.
doclecture.net - lectures - 2014-2024 year. Copyright infringement or personal data (0.01 sec.)