Ecrire du texte dans une fenêtre (nasm)

Contenu du snippet

Sa mets du texte avec une couleur en fond

Source / Exemple :


[EXTERN BeginPaint]
[Import BeginPaint user32.dll]
[EXTERN CreateFontA]
[import CreateFontA gdi32.dll]
[EXTERN SelectObject]
[import SelectObject gdi32.dll]
[EXTERN SetTextColor]
[Import SetTextColor gdi32.dll]
[EXTERN SetBkColor]
[Import SetBkColor gdi32.dll]
[EXTERN TextOutA]
[Import TextOutA gdi32.dll]
[EXTERN EndPaint]
[Import EndPaint user32.dll]

push dword  PAINTSTRUCT
push dword [handle]
call [BeginPaint]

mov dword [hdc] , eax

push dword police
push dword 40h ; 64/0
push dword 00h
push dword 00h
push dword 00h
push dword 0FFh
push dword 00h
push dword 00h
push dword 00h
push dword 190h ; 400/
push dword 00h
push dword 00h
push dword 10h
push dword 18h
call [CreateFontA]

push dword eax
push dword [hdc]
call [SelectObject]
mov dword [hfont] , eax 

xor eax,eax
mov ah,032h
shl eax,8
mov ah,0C8h
mov al,0C8h

push dword eax
push dword [hdc]
call [SetTextColor]

xor eax,eax
mov ah,0FFh
shl eax,8
mov ah,0h
mov al,0h

push dword eax
push dword [hdc]
call [SetBkColor]

push dword 12h
push dword mon_text
push dword 00h
push dword 00h
push dword [hdc]
call [TextOutA]

push dword [hfont]
push dword [hdc]
call [SelectObject]

push dword PAINTSTRUCT
push dword [handle]
call [EndPaint]

PAINTSTRUCT 			resd 16
RECTO 				resd 4
hdc 				resd 1

hfont 				resd 1
police				db "Courier New",0

mon_text			db "Mon texte a moi!!!",0

A voir également

Vous n'êtes pas encore membre ?

inscrivez-vous, c'est gratuit et ça prend moins d'une minute !

Les membres obtiennent plus de réponses que les utilisateurs anonymes.

Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.

Le fait d'être membre vous permet d'avoir des options supplémentaires.