I need to check wheather my app is in memory or not and than do something. How? Sometingh with mutex? Thanx
Posted on 2001-05-01 06:37:00 by raguru
Check prostart.exe in your masm32 directory. It has a checkbox for generating "single instance code" or something to that effect.
Posted on 2001-05-01 07:40:00 by 4oh4
use FindWindow API to check if your app is running.
Posted on 2001-05-01 07:58:00 by _drcmda
There were a few threads about this too.. you might check out these ones: previous instance solution allow only one instance? how 2 prevent from an app. running multiple instances? :) J
Posted on 2001-05-01 07:59:00 by JimmyClif
raguru,

	invoke FindWindow,addr szClassName,addr szCaption		;check if your hovno is already running
	.IF eax!=0							;if yes
	 invoke ExitProcess,0 ;or message box						;exit
	.ENDIF
addr szCaption could be NULL if you have only one window of the some class. forge
Posted on 2001-05-01 08:21:00 by forge
the method with a single FindWindow will NOT always work proper! If you have a program with associated data files, you can try to mark three or more of the data files in an explorer, and than choose "open" from the context menu. Windows will load the programs nearly parallel, and the application windows cant be opened as fast. You should use a named event (CreateEvent) and check for it at the very beginning of the program.
Posted on 2001-05-01 08:54:00 by beaster
You could also use "RegisterWindowMessage" and "BroadcastSystemMessage". Use the lParam = 0 as an "is anybody out there", and wParam as its own handle. And all others reply to handle wParam with lParam = 1 ("I am here"). Mirno
Posted on 2001-05-01 09:51:00 by Mirno
Will that work if I have no window???
Posted on 2001-05-01 16:12:00 by raguru
.data sa SECURITY_ATTRIBUTES objname db 'SVIN' .code invoke CreateMutex,addr sa,FALSE,addr objname or eax,eax jne @F ;if not zero - then it's the first instance call GetLastError cmp eax,ERROR_ALREADY_EXISTS je AlreadyExist ;if it's not first instance then ERROR_ALREADY_EXISTS we get. @@: .... ;procede case for first instance
Posted on 2001-05-01 16:47:00 by The Svin