Informática Numaboa - Tutoriais e Programação
Janelas (masm)
Dom 7 Jan 2007 10:34 |
- Detalhes
- Categoria: Assembly Numaboa (antigo oiciliS)
- Atualização: Terça, 16 Fevereiro 2010 22:54
- Autor: vovó Vicki
- Acessos: 18846
Pagina 7 de 8
Código fonte completo
.386
.MODEL FLAT,STDCALL
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\user32.inc
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\user32.lib
gerenteJanela proto :DWORD, :DWORD, :DWORD, :DWORD
.DATA?
mInstancia DWORD ?
linhaComando DWORD ?
.DATA
NomeClasse db "JanelaNua",0
TituloJanela db "Janelinha NumaBoa",0
.CODE
inicio:
invoke GetModuleHandle, NULL
mov mInstancia, eax
invoke GetCommandLine
mov linhaComando, eax
invoke gerenteJanela, mInstancia, NULL, linhaComando, SW_SHOWDEFAULT
invoke ExitProcess,0
gerenteJanela proc mInst:DWORD, mInstAnt:DWORD, linhaCmd:DWORD, Mostra:DWORD
LOCAL ej:WNDCLASSEX
LOCAL mJanela:HWND
LOCAL malote:MSG
mov ej.cbSize, SIZEOF WUNDCLASSEX
mov ej.style, CS_HREDRAW or CS_VREDRAW
mov ej.lpfnWdnProc, OFFSET gerenteMensagem
mov ej.cbClsExtra, NULL
mov ej.cbWndExtra, NULL
push mInst
pop ej.hInstance
invoke LoadIcon, NULL, IDI_WINLOGO
mov ej.hIcon, eax
mov ej.hIconSm, eax
invoke LoadCursor, NULL, IDC_ARROW
mov ej.hCursor, eax
mov ej.hbrBackground, COLOR_WINDOW+1
mov ej.lpszMenuName, NULL
mov ej.lpszClassName, OFFSET NomeClasse
invoke RegisterClassEx, ADDR ej
invoke CreateWindowEx, NULL, ADDR NomeClasse, ADDR TituloJanela,
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, mInst, NULL
mov mJanela,eax
invoke ShowWindow, mJanela, SW_SHOWNORMAL
invoke UpdateWindow, mJanela
.WHILE TRUE
invoke GetMessage, ADDR malote, NULL, 0, 0
.BREAK .IF (eax < 1)
invoke TranslateMessage, ADDR malote
invoke DispatchMessage, ADDR malote
.ENDW
mov eax, malote.wParam
ret
gerenteJanela endp
gerenteMensagem proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
.IF uMsg==WM_DESTROY
invoke PostQuitMessage, NULL
xor eax,eax
ret
.ENDIF
invoke DefWindowProc, hWnd, uMsg, wParam, lParam
ret
gerenteMensagem endp
end inicio