Hi;
Could anyone write an win32 console application skeleton plz
thx
Could anyone write an win32 console application skeleton plz
thx
This recent post by malone is a nice example of using MASM32 for console:
http://www.asmcommunity.net/board/index.php?topic=3669.msg24937
It has intput/output and clear screen. What more do you need? :)
http://www.asmcommunity.net/board/index.php?topic=3669.msg24937
It has intput/output and clear screen. What more do you need? :)
The well known hello world.
; # to compile use >buildc test.asm
.386
.model flat, stdcall
option casemap :none ; case sensitive
; #########################################################################
include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
; #########################################################################
; = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
; P R O T O T Y P E S
; = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
PrintText PROTO :DWORD
.data
hInstance dd 0
commandline dd 0
HelloWorld db 'Hello World!',13,10,0
.code
start:
invoke GetModuleHandle, NULL
mov hInstance, eax
invoke GetCommandLine
mov commandline, eax
invoke PrintText, ADDR HelloWorld
invoke ExitProcess, 0
; = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
; Function: PrintText
;
PrintText proc spText:DWORD
LOCAL hOutPut :DWORD
LOCAL bWritten :DWORD
invoke GetStdHandle, STD_OUTPUT_HANDLE
mov hOutPut, eax
cld
xor ebx, ebx
mov esi, spText
lodsb
pt0:
cmp al, 0
je pt1
inc ebx
lodsb
jmp pt0
pt1:
invoke WriteFile, hOutPut, spText, ebx, ADDR bWritten, NULL
mov eax, bWritten
ret
PrintText endp
end start
A quick FAsm example:
Robert,
I'm getting INVALID_HANDLE_VALUE after
GetLastError returns 0 (no error) so I'm not sure why it's not working. I'm running this on win98.
I'm getting INVALID_HANDLE_VALUE after
invoke GetStdHandle, STD_OUTPUT_HANDLE
GetLastError returns 0 (no error) so I'm not sure why it's not working. I'm running this on win98.
I had that happen once. But it was some little stupid and I can't remember what it was.
Run a debugger and look at what really is put onto the stack.
Run a debugger and look at what really is put onto the stack.