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

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


Instansiating a COM object in an ISAPI DLL

Thomas Steele -- tsteelemct@msn.com
Thursday, January 23, 1997

Environment:  MSVC++ 4.2b, Win95, NT 4.0

I am having difficulty instansiating a COM object from within a ISAPI DLL.  
Here is the code I am using:

CoCreateInstance(CLSID_KeEngine, NULL, CLSCTX_LOCAL_SERVER | 
CLSCTX_INPROC_SERVER, IID_KeEngine, (LPVOID *) &pKe)

I've tried various enumerations of the CLSCTX_* parameters with no luck.  I 
believe it may have something to do with threading models.  Any help would be 
greatly appreciated.

TomS



Kenneth A. Argo -- argo@rias.COM
Friday, January 24, 1997

[Mini-digest: 3 responses]

You should receive a value from CoCreateInstance which will tell you the problem.  What value are you receiving ?

Ken



----------
From:  Thomas Steele[SMTP:tsteelemct@msn.com]
Sent:  Thursday, January 23, 1997 10:08 AM
To:  mfc-l
Subject:  Instansiating a COM object in an ISAPI DLL

Environment:  MSVC++ 4.2b, Win95, NT 4.0

I am having difficulty instansiating a COM object from within a ISAPI DLL.  
Here is the code I am using:

CoCreateInstance(CLSID_KeEngine, NULL, CLSCTX_LOCAL_SERVER | 
CLSCTX_INPROC_SERVER, IID_KeEngine, (LPVOID *) &pKe)

I've tried various enumerations of the CLSCTX_* parameters with no luck.  I 
believe it may have something to do with threading models.  Any help would be 
greatly appreciated.

TomS


-----From: Mike Blaszczak 

At 15:08 1/23/97 UT, Thomas Steele wrote:
>Environment:  MSVC++ 4.2b, Win95, NT 4.0

>I am having difficulty instansiating a COM object from within a ISAPI DLL.  
>Here is the code I am using:

>CoCreateInstance(CLSID_KeEngine, NULL, CLSCTX_LOCAL_SERVER | 
>CLSCTX_INPROC_SERVER, IID_KeEngine, (LPVOID *) &pKe)

>I've tried various enumerations of the CLSCTX_* parameters with no luck.  I 
>believe it may have something to do with threading models.  

>Any help would be greatly appreciated.

For you to get any help, you'll need to provide at least _some_ description
of your problem.

Assuming everything is registered correctly, and you have the right CLSID, and
you have the right IID, and you have initialized OLE properly, the above call
will work just fine.

What problem are you noticing?  Are you finding that pKE really contains NULL?
What return code are you getting from CoCreateInstance()?  What behaviour
are you noticing that makes you think you have no luck?


.B ekiM
http://www.nwlink.com/~mikeblas/
Why does the "new" Corvette look like a 1993 RX-7?
These words are my own. I do not speak on behalf of Microsoft.

-----From: Roma 

Hello, 

Thomas Steele wrote:
> 
> Environment:  MSVC++ 4.2b, Win95, NT 4.0
> 
> I am having difficulty instansiating a COM object from within a ISAPI DLL.
> Here is the code I am using:
> 
> CoCreateInstance(CLSID_KeEngine, NULL, CLSCTX_LOCAL_SERVER |
> CLSCTX_INPROC_SERVER, IID_KeEngine, (LPVOID *) &pKe)
> 
Try the following:

IUnknown *pUnk;

CoCreateInstance(CLSID_KeEngine, NULL, CLSCTX_LOCAL_SERVER |
 CLSCTX_INPROC_SERVER, IID_IUnknown, (LPVOID *) &pUnk);

pUnk->QueryInterface(IID_KeEngine, (LPVOID *) &pKe);

At least,  CreateDispatch() member of the COleDispatchDriver class do
retrieve
IDispatch in two steps - you can check it in file oledisp2.cpp, line 78. 


-Roma



Bing Hou -- hou@tfn.com
Monday, January 27, 1997

Thomas,

I don't know if your ISAPI DLL is a COM Application. If it isn't, there is 
your problem right there. A COM application by definition must 
initilize/uninitilize COM lib. 

If it is, what does CoCreateInstance return?


Bing Hou
hou@tfn.com
=======================================================================
  Be like a postage stamp - stick to one thing until you get there.             
                                            - Margaret Carty
=======================================================================

______________________________ Reply Separator _________________________________
Subject: Instansiating a COM object in an ISAPI DLL
Author:  "Thomas Steele"  at Internet
Date:    1/23/97 3:08 PM


Environment:  MSVC++ 4.2b, Win95, NT 4.0
     
I am having difficulty instansiating a COM object from within a ISAPI DLL.  
Here is the code I am using:
     
CoCreateInstance(CLSID_KeEngine, NULL, CLSCTX_LOCAL_SERVER | 
CLSCTX_INPROC_SERVER, IID_KeEngine, (LPVOID *) &pKe)
     
I've tried various enumerations of the CLSCTX_* parameters with no luck.  I 
believe it may have something to do with threading models.  Any help would be 
greatly appreciated.
     
TomS



Bing Hou -- hou@tfn.com
Monday, January 27, 1997

[Mini-digest: 3 responses]

Thomas,

I've come across a KB article Q156223 that is entitled "How To Lunch OLE 
Servers from ISAPI Extensions". It has something to do with running on the 
IUSR_computername account which is not permitted to lunch a server by OLE. 
The article tells you how to do it.

     
Bing Hou
hou@tfn.com
=======================================================================
  Be like a postage stamp - stick to one thing until you get there.             
                                            - Margaret Carty
=======================================================================
     
______________________________ Reply Separator _________________________________
Subject: Instansiating a COM object in an ISAPI DLL
Author:  "Thomas Steele"  at Internet 
Date:    1/23/97 3:08 PM
     
     
Environment:  MSVC++ 4.2b, Win95, NT 4.0
     
I am having difficulty instansiating a COM object from within a ISAPI DLL.  
Here is the code I am using:
     
CoCreateInstance(CLSID_KeEngine, NULL, CLSCTX_LOCAL_SERVER | 
CLSCTX_INPROC_SERVER, IID_KeEngine, (LPVOID *) &pKe)
     
I've tried various enumerations of the CLSCTX_* parameters with no luck.  I 
believe it may have something to do with threading models.  Any help would be 
greatly appreciated.
     
TomS
-----From: "Thomas Steele" 

The return code from CoCreateInstance() was 800401F0 (CO_E_NOTINITIALIZED).  
My bad! I had been calling AfxOleInit() but I now realize that this does not 
initialize the COM libraries. I tried CoInitialize() and all is well.  Thanks 
to all.

TomS.

----------
From: 	owner-mfc-l@majordomo.netcom.com on behalf of Kenneth A. Argo
Sent: 	Friday, January 24, 1997 1:46 PM
To: 	mfc-l; Thomas Steele
Subject: 	RE: Instansiating a COM object in an ISAPI DLL

[Mini-digest: 3 responses]

You should receive a value from CoCreateInstance which will tell you the 
problem.  What value are you receiving ?

Ken



----------
From:  Thomas Steele[SMTP:tsteelemct@msn.com]
Sent:  Thursday, January 23, 1997 10:08 AM
To:  mfc-l
Subject:  Instansiating a COM object in an ISAPI DLL

Environment:  MSVC++ 4.2b, Win95, NT 4.0

I am having difficulty instansiating a COM object from within a ISAPI DLL.  
Here is the code I am using:

CoCreateInstance(CLSID_KeEngine, NULL, CLSCTX_LOCAL_SERVER | 
CLSCTX_INPROC_SERVER, IID_KeEngine, (LPVOID *) &pKe)

I've tried various enumerations of the CLSCTX_* parameters with no luck.  I 
believe it may have something to do with threading models.  Any help would be 
greatly appreciated.

TomS


-----From: Mike Blaszczak 

At 15:08 1/23/97 UT, Thomas Steele wrote:
>Environment:  MSVC++ 4.2b, Win95, NT 4.0

>I am having difficulty instansiating a COM object from within a ISAPI DLL.  
>Here is the code I am using:

>CoCreateInstance(CLSID_KeEngine, NULL, CLSCTX_LOCAL_SERVER | 
>CLSCTX_INPROC_SERVER, IID_KeEngine, (LPVOID *) &pKe)

>I've tried various enumerations of the CLSCTX_* parameters with no luck.  I 
>believe it may have something to do with threading models.  

>Any help would be greatly appreciated.

For you to get any help, you'll need to provide at least _some_ description
of your problem.

Assuming everything is registered correctly, and you have the right CLSID, and
you have the right IID, and you have initialized OLE properly, the above call
will work just fine.

What problem are you noticing?  Are you finding that pKE really contains NULL?
What return code are you getting from CoCreateInstance()?  What behaviour
are you noticing that makes you think you have no luck?


.B ekiM
http://www.nwlink.com/~mikeblas/
Why does the "new" Corvette look like a 1993 RX-7?
These words are my own. I do not speak on behalf of Microsoft.

-----From: Roma 

Hello, 

Thomas Steele wrote:
> 
> Environment:  MSVC++ 4.2b, Win95, NT 4.0
> 
> I am having difficulty instansiating a COM object from within a ISAPI DLL.
> Here is the code I am using:
> 
> CoCreateInstance(CLSID_KeEngine, NULL, CLSCTX_LOCAL_SERVER |
> CLSCTX_INPROC_SERVER, IID_KeEngine, (LPVOID *) &pKe)
> 
Try the following:

IUnknown *pUnk;

CoCreateInstance(CLSID_KeEngine, NULL, CLSCTX_LOCAL_SERVER |
 CLSCTX_INPROC_SERVER, IID_IUnknown, (LPVOID *) &pUnk);

pUnk->QueryInterface(IID_KeEngine, (LPVOID *) &pKe);

At least,  CreateDispatch() member of the COleDispatchDriver class do
retrieve
IDispatch in two steps - you can check it in file oledisp2.cpp, line 78. 


-Roma

-----From: "Thomas Steele" 

Well, all is not entirely well.  The return value from CoCreateInstance is now 
REGDB_E_CLASSNOTREG.  However, to my knowledge I've registered the COM object 
properly.  It works when I instansiate it from a local application.  Is there 
some special registry entries to allow network access to the COM object?

----------
From: 	owner-mfc-l@majordomo.netcom.com on behalf of Kenneth A. Argo
Sent: 	Friday, January 24, 1997 1:46 PM
To: 	mfc-l; Thomas Steele
Subject: 	RE: Instansiating a COM object in an ISAPI DLL

[Mini-digest: 3 responses]

You should receive a value from CoCreateInstance which will tell you the 
problem.  What value are you receiving ?

Ken



----------
From:  Thomas Steele[SMTP:tsteelemct@msn.com]
Sent:  Thursday, January 23, 1997 10:08 AM
To:  mfc-l
Subject:  Instansiating a COM object in an ISAPI DLL

Environment:  MSVC++ 4.2b, Win95, NT 4.0

I am having difficulty instansiating a COM object from within a ISAPI DLL.  
Here is the code I am using:

CoCreateInstance(CLSID_KeEngine, NULL, CLSCTX_LOCAL_SERVER | 
CLSCTX_INPROC_SERVER, IID_KeEngine, (LPVOID *) &pKe)

I've tried various enumerations of the CLSCTX_* parameters with no luck.  I 
believe it may have something to do with threading models.  Any help would be 
greatly appreciated.

TomS


-----From: Mike Blaszczak 

At 15:08 1/23/97 UT, Thomas Steele wrote:
>Environment:  MSVC++ 4.2b, Win95, NT 4.0

>I am having difficulty instansiating a COM object from within a ISAPI DLL.  
>Here is the code I am using:

>CoCreateInstance(CLSID_KeEngine, NULL, CLSCTX_LOCAL_SERVER | 
>CLSCTX_INPROC_SERVER, IID_KeEngine, (LPVOID *) &pKe)

>I've tried various enumerations of the CLSCTX_* parameters with no luck.  I 
>believe it may have something to do with threading models.  

>Any help would be greatly appreciated.

For you to get any help, you'll need to provide at least _some_ description
of your problem.

Assuming everything is registered correctly, and you have the right CLSID, and
you have the right IID, and you have initialized OLE properly, the above call
will work just fine.

What problem are you noticing?  Are you finding that pKE really contains NULL?
What return code are you getting from CoCreateInstance()?  What behaviour
are you noticing that makes you think you have no luck?


.B ekiM
http://www.nwlink.com/~mikeblas/
Why does the "new" Corvette look like a 1993 RX-7?
These words are my own. I do not speak on behalf of Microsoft.

-----From: Roma 

Hello, 

Thomas Steele wrote:
> 
> Environment:  MSVC++ 4.2b, Win95, NT 4.0
> 
> I am having difficulty instansiating a COM object from within a ISAPI DLL.
> Here is the code I am using:
> 
> CoCreateInstance(CLSID_KeEngine, NULL, CLSCTX_LOCAL_SERVER |
> CLSCTX_INPROC_SERVER, IID_KeEngine, (LPVOID *) &pKe)
> 
Try the following:

IUnknown *pUnk;

CoCreateInstance(CLSID_KeEngine, NULL, CLSCTX_LOCAL_SERVER |
 CLSCTX_INPROC_SERVER, IID_IUnknown, (LPVOID *) &pUnk);

pUnk->QueryInterface(IID_KeEngine, (LPVOID *) &pKe);

At least,  CreateDispatch() member of the COleDispatchDriver class do
retrieve
IDispatch in two steps - you can check it in file oledisp2.cpp, line 78. 


-Roma





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