15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Ole Server Instance limitations

rwagner -- rwagner@genre.com
Wednesday, September 11, 1996

Environment: VC++4.1/MFC/OLE, MSDN( basic ), Win95 / Windows NT3.51

Hello,

I am continuing to implement an OLE automation server, with which I am sorting 
out a number of problems with Microsoft.  They are so busy with the previous 
request (which I posted here this morning) that they cannot address this second 
problem that we're having, to wit...

I'm calling:
    AfxOleInit();
    m_ICMD.CreateDispatch("CM.Document");

...from the client which brings up the server's exe just fine.  The problem is, 
I designed this project with multiple clients talking to ONE instance of a 
server, which contains multiplpe instances of its OLE object, in an integrated 
environment.  The literature (mostly SDK oriented) suggested that multiple 
calls to an interface from various clients would instantiate fresh interfaces 
but they would all be in the process space of a single server.exe.

However, pView tells me that a SEPERATE server.exe, with a seperate PID, is 
instantiated for each client, producing a one-to-one correspondence between 
instances of client and server.  This won't work for me, since I need several 
clients to be able to retrieve messages (via IDispatch get/Set calls) from a 
single server and update the server's data.  If this is unclear, I can provide 
further details

Again, Thanks !



Chandra Venkatraman -- chandru@fcpl.co.in
Thursday, September 12, 1996

[Mini-digest: 4 responses]

----------
From: 	rwagner[SMTP:rwagner@genre.com]
Sent: 	Wednesday, September 11, 1996 7:53 AM
To: 	mfc-l
Cc: 	Vishnu Tambi/GRS/GRN; Bo Hedberg/GRS/GRN
Subject: 	Ole Server Instance limitations

Environment: VC++4.1/MFC/OLE, MSDN( basic ), Win95 / Windows NT3.51

Hello,

I am continuing to implement an OLE automation server, with which I am sorting 
out a number of problems with Microsoft.  They are so busy with the previous 
request (which I posted here this morning) that they cannot address this second 
problem that we're having, to wit...

I'm calling:
    AfxOleInit();
    m_ICMD.CreateDispatch("CM.Document");

...from the client which brings up the server's exe just fine.  The problem is, 
I designed this project with multiple clients talking to ONE instance of a 
server, which contains multiplpe instances of its OLE object, in an integrated 
environment.  The literature (mostly SDK oriented) suggested that multiple 
calls to an interface from various clients would instantiate fresh interfaces 
but they would all be in the process space of a single server.exe.

However, pView tells me that a SEPERATE server.exe, with a seperate PID, is 
instantiated for each client, producing a one-to-one correspondence between 
instances of client and server.  This won't work for me, since I need several 
clients to be able to retrieve messages (via IDispatch get/Set calls) from a 
single server and update the server's data.  If this is unclear, I can provide 
further details

Further Details as to what is expected of the Server and the Client's Interaction and how... would be appreciated.

Chandru

-----From: CraigTT@ccmail01.PE-Nelson.COM

     There's a flag OLE_SERVER_SINGLE that is used with OleRegisterServer 
     that sounds like it should make the server do what you want.  Is this 
     how you're registering your server?  From my search on MSDN there's 
     little documentation available.  I also couldn't find an 
     OleRegisterServer in the MFC source (4.0).
     
     Tim Craig


-----From: MARGHAL@gw2k.com

The answer to your question may lie with the ConnectTemplate member function 
in the COleTemplateServer class.The third parameter to ConnectTemplate is a 
boolean called bMultiInstance which is documented as follows:  

"bMultiInstance   Indicates whether a single instance of the application can 
support multiple instantiations. If TRUE, multiple instances of the 
application are launched for each request to create an object."

The writers of ClassWizard apparently assume that if you chose to use the 
SDI
model, that you want a new instance of the server for each client. 
ClassWizard sets bMultiInstance to TRUE when you ask it to create an SDI 
application; ClassWizard sets bMultiInstance to FALSE when you ask it to 
create an MDI application.  

Al Margheim

-----From: Kannan Avudai 

I have faced similar problem and found that it is because the OLE server
and the Client were running in different user(security) context. This 
problem is also documented in the KB(i could not recall the article numbers).

Hope this helps.

Kannan

---------------------------------------------------------------------------
Kannan Avudai
VeriFone                                	kannan@eit.com
Internet Commerce Division			kannan_a1@verifone.com
800, El Camino Real,				Phone (Off) : 415-463-2314
Menlo Park, CA 94025				      (Res) : 415-577-8719
---------------------------------------------------------------------------





| Вернуться в корень Архива |