我正在检查 Internet 连接状态,如果没有 Internet 连接,我想发送一个 MessageBox 我所拥有的是:
;build as a WINDOWS app
.XCREF
.NOLIST
INCLUDE \masm32\include\masm32rt.inc
INCLUDE \masm32\include\wininet.inc
INCLUDELIB \masm32\lib\wininet.lib
.LIST
;-------------------------------------------------------------------------
IsOnline PROTO :LPSTR
Sleep PROTO STDCALL :DWORD
;-------------------------------------------------------------------------
IFNDEF FLAG_ICC_FORCE_CONNECTION
FLAG_ICC_FORCE_CONNECTION EQU 1
ENDIF
;-------------------------------------------------------------------------
.CODE
IsOnline PROC lpszURL:LPSTR
;Test Internet Connection
;
;lpszURL points to a zero-terminated test URL string (must start with "http://")
;
;Returns EAX = FALSE if not connected
; = TRUE if connected
; EDX = connection description (see InternetGetConnectedState documentation)
push eax
mov edx,esp
INVOKE InternetGetConnectedState,edx,0
or eax,eax
jz IsOnl0
INVOKE InternetCheckConnection,lpszURL,FLAG_ICC_FORCE_CONNECTION,0
IsOnl0: pop edx
ret
IsOnline ENDP
;-------------------------------------------------------------------------
szURL db 'http://www.google.com',0
;-------------------------------------------------------------------------
_main PROC
loop00: Invoke Sleep,5000 ;Sleep so it doesn't use 99% CPU
INVOKE IsOnline,offset szURL
or eax,eax
jz loop00
INVOKE Beep,750,1000
exit
_main ENDP
;-------------------------------------------------------------------------
END _main
现在我想添加这样的东西
.data
MyTitle db "No internet",0
MyText db "No active internet connection found, retrying in 5 seconds.",0
push 0
push offset MyTitle
push offset MyText
push 0
call MessageBoxA
但我真的不知道我必须把它放在哪里