[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.rcp] Re: Single instance of the application is required

At least on windows there is a solution if you are used to 
C/C++/SmalltalkMT/Delphi.
The WinMain function always provides a handle to a previous instance of an 
executable.
Anything you have to do is to compare the hInstance (handle of the current 
application
instance) with the provided hPrevInstance. If they are different you just 
exit()
the program without entering a new event loop.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowfunctions/winmain.asp

As far as I have seen the C code for the eclipse.exe is provided in the 
eclipse installation,
so you could easily build a custom which is blocking a second application.
(have a look at 
plugins\org.eclipse.platform.source_3.1.0\src\org.eclipse.platform_3.1.0\launchersrc.zip)
You could also build your own startup executable using CDT - anything 
eclipse.exe does
(beside some sugar) is start java with the startup.jar.

Bye
Torsten

http://www.astares.de
----------------------------------------------------------
The only good reason for static typing is auto-completion.
----------------------------------------------------------