>>>>> "Joost" == Joost Verburg <[EMAIL PROTECTED]> writes:

Joost> Like on Mac OS X, this is the standard
Joost> behavior for Windows applications.

Well, this may be the standard behaviour of office, but I doubt it is a real
standard...

Joost> A mutex should be created using CreateMutex and a unique
Joost> identifier. If this succeeds, the usual startup can continue.

Joost> After it has determined that LyX is already running, the HWND
Joost> of one of the current windows needs to be found. This can be
Joost> done by creating a unique window message with
Joost> RegisterWindowMessage and the unique identifier. This message
Joost> should be sent to all open windows using EnumWindows. In
Joost> GuiApplication.C, a WinEventHandler function can capture this
Joost> message and send a return value, so the calling process knows
Joost> that LyX is found.

Why is he mutex useful? Can't we just send the windows messages?

Joost> To open files in this process a WM_COPYDATA message with a
Joost> COPYDATASTRUCT can be used to send the filename (probably in
Joost> Unicode?), which will also be handled in the WinEventHandler.

Can't this be done with the first set of messages?

Joost> * Command line option

Joost> A command line option can be added to disable this behavior
Joost> (that is, start a new instance). I think this is better than a
Joost> preference because it allows one to create a shortcut to start
Joost> a new instance.

Yes.

Basically, I think the approach is sound, but there may be a need to
tweak it.

JMarc

Reply via email to