.386
.model flat, stdcall
option casemap:none
include kernel32.inc
includelib kernel32.lib
include user32.inc
includelib user32.lib
.code
correy db "correy",0
szbody db "结束本程序的这个实例吧!",0
sztitle db "本程序的一个实例已经运行",0
szrun db "只能运行本程序的一个实例!",0
start:
invoke CreateMutex,0,0,addr correy;创建与打开成功,此时eax的值是非零。
invoke GetLastError
.if eax == 183 ;CreateMutex创建成功时返回零,打开成功时返回183.
invoke MessageBox,0,addr szbody,addr sztitle,0
ret ;invoke ExitProcess,0
.endif
invoke MessageBox,0,addr szrun,addr szrun,0
ret
end start
;made at 2010.05.28
没有评论:
发表评论