switch to app

BlitzMax Forums/BlitzMax Programming/switch to app

Rob, got your email and from what you are saying it's actually a lot easier than all that messaging stuff. The following code (Windows only) will prevent another instance of your application launching.

Extern "win32"
	Function Findwindow(lpClassName:Byte Ptr, lpWindowName:Byte Ptr) = "FindWindowA@8"
EndExtern

If FindWindow(Null,"Foo".tocstring())
	RuntimeError("Foo is already Running, this instance will now terminate")
EndIf

AppTitle = "Foo"
Graphics 200,200,0

WaitKey()