Lanching application

Bengt Richter bokr at oz.net
Wed Dec 24 20:49:38 CET 2003


On 23 Dec 2003 08:30:55 -0800, rob02omni at vodafone.it (Roberto) wrote:

>Hi Bengt,
>
>> 
>>  >>> import os
>>  >>> def startit(path): os.system('start %s' %path)
>>  ...
>
>well not really...
>
>Notepad is natively a multi-session program i mean it can run any
>number of itself cleanly.
>
>What i'm trying to accomplish is to launch an application that is not
>"multi-session". I know that this is possible (tricks in the
>process/applications threads) but i dont know how :)
>
>Any idea??

I'm not sure what you mean by "natively multi-session." ISTM that's the default. If an OS normally
launches programs in separate processes, UIAM the programs have to be programmed specifically
to _prevent_ running simultaneously. Various tricks can be used to accomplish that,
so if you have a program that "is not multi-session" because it is successfully
noticing that it is not the first instance to run, and exiting (some might communicate
parameters to the running instance before they do that), then ISTM you are asking
how to interfere with that program logic. E.g., if it is mutex-based, can you
prevent the second instance from seeing the mutex? What if it's based on a lock file,
or scanning current windows for title text? If there's a DLL using a shared memory section
to act as a mutex, maybe there's a way (OTTOMH I don't know of it, but I wouldn't be surprised.
I haven't had to deal with that situation) to tell windows always to create new instances of shared
sections for it, and maybe that's what you are asking, but then you'd have to know that that's the
mechanism that makes your app "single session."

Maybe telling us what app are you trying to launch multiple instances of, and on what windows version
would get more helpful responses? ;-)

Happy Holidays,

Regards,
Bengt Richter




More information about the Python-list mailing list