%include 'c:\asm\WIN32.INC'
import SetCursorPos user32.dll
extern SetCursorPos
import MessageBoxA user32.dll
extern MessageBoxA
import ExitProcess kernel32.dll
extern ExitProcess
segment .data use32
;cursor data.
xpos dd 250
ypos dd 250
;message data.
text db "You want to move the mouse position?",0
title db "Move mouse cursor..... Made in assembly",0
segment .bbs use32
segment .code use32
..start:
;messagebox
push MB_YESNO
push title
push text
push 0
call [MessageBoxA]
;move cursor
push dword [xpos]
push dword [ypos]
call [SetCursorPos]
push dword 0x00
call [ExitProcess]
ret
it's nasm code
Like this:
include \masm32\include\masm32rt.inc
.data
text db "You want to move the mouse position?", 0
xpos dd 250
ypos dd 250
.code
start: MsgBox 0, offset text, "Move mouse cursor..... Made in assembly", MB_YESNO
.if eax==IDYES
invoke SetCursorPos, xpos, ypos
.endif
invoke ExitProcess, 0
end start
Jochen really "high-leveled" that for you - lol
start:
;message box
INVOKE MessageBox,0,offset test,offset title,MB_YESNO
;move cursor
INVOKE SetCursorPos,xpos,ypos
;exit
INVOKE ExitProcess,0
you had xpos and ypos reversed
RET is not required after ExitProcess
MessageBox is an alias for MessageBoxA
the code you had would almost work
start:
;messagebox
push MB_YESNO
push offset title
push offset text
push 0
CALL MessageBoxA
;move cursor
push dword ypos
push dword xpos
CALL SetCursorPos
push 0
CALL ExitProcess
thanks i now got this but it wont work
.386
.model flat, stdcall
option casemap:none
; Includes section.
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\kernel32.lib
include \masm32\include\user32.inc
includelib \masm32\lib\user32.lib
; Data section.
.data
filename db "c:\asm\test.obj",0
msg1text db "Are you sure you want to delete test.obj??",0
msg1capt db "Delete or not??",0
msg2text db "Cant find file.",0
msg2capt db "Error cant find file",0
; Code section.
.code
start:
invoke MessageBox, NULL, offset msg1text, offset msg1capt, MB_YESNO + MB_ICONERROR
.if eax==IDYES
invoke DeleteFile, offset filename
.if eax==ERROR_FILE_NOT_FOUND
invoke MessageBox, NULL, offset msg2text, offset msg2capt, MB_OK + MB_ICONERROR
invoke ExitProcess,0
.endif
.elseif eax==IDNO
invoke ExitProcess,0
.endif
end start
it compiles but when i run it it crashes at .if eax==ERROR_FILE_NOT_FOUND
what im trying to do is show an msgbox when the file does not exist
DeleteFile return value:
QuoteIf the function succeeds, the return value is nonzero.
If the function fails, the return value is zero (0). To get extended error information, call GetLastError
we usually use OR for these
MB_YESNO or MB_ICONERROR
thanks works like a charm