Before the PureBasic site switched over to this new format, I read a thread by either srod, Chris, El_Choni, or blueznl, I can't recall who, but I can't find it again.
My problem is that I copied the example inline assembly code from their thread into a sample program on my 64-bit Windows system, compiled it using PureBasic 4.4 Beta, and it worked perfectly.
However, I copied the same code onto my 32-bit XP system at work and it doesn't display the message box when I compile it using PureBasic 4.31. Here's the code. Can anyone recall from the past forum what's wrong with the code below? Why won't the message box appear on screen?
Code: Select all
EnableASM
DisableDebugger
! EXTRN "__imp__MessageBoxA@16" As MessageBox:dword
PUSH 1
PUSH _caption
PUSH _message
PUSH 0
CALL [MessageBox]
end
! _caption db "Win32 Assembly",0
! _message db "Hi! I am a sample program!",0
Also, the following code works on my Vista system when I substitute PB variables instead of FASM variables:
Code: Select all
EnableASM
DisableDebugger
caption.s = "Win32 Assembly"
message.s = "Hi! I am a sample program!"
! EXTRN "__imp__MessageBoxA@16" As MessageBox:dword
PUSH 1
PUSH caption
PUSH message
PUSH 0
CALL [MessageBox]
End
Code: Select all
EnableASM
DisableDebugger
caption.s = "Win32 Assembly"
message.s = "Hi! I am an example program!"
! EXTRN "__imp__MessageBoxA@16" As MessageBox:dword
PUSH 1
PUSH caption
PUSH message
PUSH 0
CALL [MessageBox]
MessageRequester(caption, message, 1)
End
Additionally, on my 32-bit XP system I can jump over the MessageRequester() procedure in order to get only the inlineASM MessageBox to appear on screen:
Code: Select all
EnableASM
DisableDebugger
caption.s = "Win32 Assembly"
message.s = "Hi! I am an example program!"
! EXTRN "__imp__MessageBoxA@16" As MessageBox:dword
PUSH 1
PUSH caption
PUSH message
PUSH 0
CALL [MessageBox]
JMP l_stop
MessageRequester(caption, message, 2)
Stop:
End

Logman