1

Topic: Always to create new process at CoCreateInstance

Is available outproc the server which implements classes Class_A and Class_B. By call CoCreateInstance (Class_A) there is a new process, by repeated call CoCreateInstance (Class_A) there is one more process. But by call CoCreateInstance (Class_B) new process does not form, and one of existing is used already, and it is not necessary for me. How to achieve what CoCreateInstance always would create new process?

2

Re: Always to create new process at CoCreateInstance

Hello, Aniskin, you wrote: A> Is available outproc the server which implements classes Class_A and Class_B. By call CoCreateInstance (Class_A) there is a new process, by repeated call CoCreateInstance (Class_A) there is one more process. But by call CoCreateInstance (Class_B) new process does not form, and one of existing is used already, and it is not necessary for me. How to achieve what CoCreateInstance always would create new process? See here: http://rsdn.org/forum/atl/1988640.1 the Author: MTdev Date: 04.07.06 Write that flag REGCLS_SINGLEUSE for CoRegisterClassObject helps. But I did not check...

3

Re: Always to create new process at CoCreateInstance

Hello, okman, you wrote: O> Hello, Aniskin, you wrote: A>> Is available outproc the server which implements classes Class_A and Class_B. By call CoCreateInstance (Class_A) there is a new process, by repeated call CoCreateInstance (Class_A) there is one more process. But by call CoCreateInstance (Class_B) new process does not form, and one of existing is used already, and it is not necessary for me. How to achieve what CoCreateInstance always would create new process? O> see here: O> http://rsdn.org/forum/atl/1988640.1 the Author: MTdev Date: 04.07.06 O> Write that flag REGCLS_SINGLEUSE for CoRegisterClassObject helps. But I did not check... I use this flag, but it works within the limits of one class. As I already wrote, repeated call CoCreateInstance (Class_A) creates new process, as well as it is expected. But here call CoCreateInstance (Class_B) uses one of the existing. The second call CoCreateInstance (Class_B) uses the second of the existing. And only the third call CoCreateInstance (Class_B) creates new process.

4

Re: Always to create new process at CoCreateInstance

Hello, Aniskin, you wrote: A> Is available outproc the server which implements classes Class_A and Class_B. By call CoCreateInstance (Class_A) there is a new process, by repeated call CoCreateInstance (Class_A) there is one more process. But by call CoCreateInstance (Class_B) new process does not form, and one of existing is used already, and it is not necessary for me. How to achieve what CoCreateInstance always would create new process? Found the decision. On SO recommended to specify in LocalServer32 additional parameter which would define, which classes to register by means of CoRegisterClassObject in specific process.

5

Re: Always to create new process at CoCreateInstance

Hello, Aniskin, you wrote: O>> Write that flag REGCLS_SINGLEUSE for CoRegisterClassObject helps. But I did not check... A> I use this flag, but it works within the limits of one class. As I already wrote, repeated call CoCreateInstance (Class_A) creates new process, as well as it is expected. But here call CoCreateInstance (Class_B) uses one of the existing. The second call CoCreateInstance (Class_B) uses the second of the existing. And only the third call CoCreateInstance (Class_B) creates new process. There are functions CoSuspendClassObjects/CoResumeClassObjects which can help with implementation of so strange desires.

6

Re: Always to create new process at CoCreateInstance

A>> Is available outproc the server which implements classes Class_A and Class_B. By call CoCreateInstance (Class_A) there is a new process, by repeated call CoCreateInstance (Class_A) there is one more process. But by call CoCreateInstance (Class_B) new process does not form, and one of existing is used already, and it is not necessary for me. How to achieve what CoCreateInstance always would create new process? A> found the decision. On SO recommended to specify in LocalServer32 additional parameter which would define, which classes to register by means of CoRegisterClassObject in specific process. And why stop short finished? What for parameters?

7

Re: Always to create new process at CoCreateInstance

Hello, Temnikov, you wrote: A>> Found the decision. On SO recommended to specify in LocalServer32 additional parameter which would define, which classes to register by means of CoRegisterClassObject in specific process. T> and why stop short finished? What for parameters? It was primary in the register so: Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\CLSID \{CLASS_CLSID} \LocalServer32] = "C: \\Path \\ExeName.exe" and became so: Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\CLSID \{CLASS_CLSID} \LocalServer32] = "C: \\Path \\ExeName.exe-PARAM" And now by call CoCreateInstance (Class_A) at server start in command line the additional parameter-ClassA is transferred, and by call CoCreateInstance (Class_B) the parameter-ClassB is transferred, i.e. I know, the server is for what purpose triggered. In most COM the server at registration of classes I check presence  parameters. If there is a parameter-ClassA I cause only CoRegisterClassObject (ClassA) if parameter-ClassB I cause only CoRegisterClassObject (ClassB), etc. Thanks to it the free slots are not present, and each subsequent call creates new process irrespective of the transferred class.