|
Hi,
In an ATL COM+ application how do I instantiate a well-behaved COM+ object marked as noncreatable?
I read that when instantiating COM+ applications the right way to do it is using the IObjectContext::CreateInstance rather than using CoCreateInstance. However neither is available when using noncreatalbe objects.
If I do it using CComPtr will the object be created in the current context and therefore be well behaved?
Thanks.
-- modified at 0:03 Monday 22nd May, 2006
|
|
|
|
|
AFAIK objects marked non-creatable cannot be instantiated using COxxx APIs. The component will provide a special method to get those object if at all those objects need to be accessible outside.
S o h a i l K a d i w a l a
modified 21-Apr-21 21:01pm.
|
|
|
|
|
Yes, that is so when instantiating outside the COM+ project. What I'm talking about is when instantiating within COM+. Basically, I have a coclass 'A' and a non-creatable 'B'. I want to know the best way to instantiate B from A. If I was instantiating 'A' from another coclass 'C', the right way to do it is using the IObjectContext::CreateObject method. However, that cannot be used to instantiate non-creatable classes, i believe.
|
|
|
|
|
I'm trying to modify a simple ActiveX control, to add some interaction.
When IOleObject::DoVerb is called with OLEIVERB_INPLACEACTIVATE, the control's window is created, and its window procedure gets WM_PAINT and paints the window.
But the control's window procedure still doesn't get mouse messages. Instead, the IUnknown::QueryInterface gets a request for IProxyManager (00000008-0000-0000-c000-000000000046) each time I move or click the mouse. IProxyManager isn't even documented in MSDN.
So, what can I do to get IE to send mouse messages to the window procedure instead of to IProxyManager?
The ActiveX control is being displayed in IE6 from an OBJECT tag. The DLL has been developed using the MS Platform SDK (without MFC or ATL).
Thanks,
Allie
|
|
|
|
|
Hi,
I'm using IE WebBrowser embeded object in my client application.
Is there any way to be informed that server is sending some cookie to my custom browser (without IE cookie "prompt" dialog) before accepting it ?
My client property is set to always allow 1st party cookies and I need to block one specific 1st party cookie from specific domain (guess by cookie name) and accept all other cookies from the same domain.
I've tried to use OnNavigateComplete2 event, but it looks it's too late to block cookie there, I also guess to block cookie it should be enaugh to set
WebBrowser.Document.Cookie to empty string).
Thanks in advance for help!
|
|
|
|
|
Hi
I'm very new to the Windows/COM development environment (coming from embedded/Unix).
I'd like to create a COM/DLL (using C++) that contains and exports an enum type.
I want the enum type to show up in the Visual Studio Object browser after I add the DLL to the "References" folder in the client application. I've used "[export]" before the enum in the header file.
I've also tried including the header file in the serverdll.idl file.
So far the enum hasn't showed up in the Object Browser.
Any help or suggestions would be appriciated.
Thanks
Robert Ernst
codeproject@theernsts.org
|
|
|
|
|
open the .idl file of the interface
put the definition of the enum inside the Library after the definition of the coclass
as follows
typedef enum tagEchoType
{
EchoTypeHelloWorld = 0,
EchoTypeGoodbyeWorld = 1
} EchoType;
thats enough
Knock out 't' from can't,
You can if you think you can
-- modified at 1:54 Friday 19th May, 2006
|
|
|
|
|
I've tried placing the enum in the .idl file, but the type still doesn't show up in the DLL, based on browsing with the Object Viewer
I've inserted the enum in the .idl file both manually, and using attributes: So I have:
File: employee.cpp
#include <oaidl.h>
[ module(dll, name = "TestEmployee", helpstring = "TestEmployee 1.0 Type Library") ];
[ emitidl ];
[dual]
__interface IEmployee : IDispatch
{
[id(1)] HRESULT DoWork(BSTR bstrTask);
};
[export]
enum Status {EMPLOYEED, UNEMPLOYEED} Status_t;
File:employee.idl
...
[
uuid(38884C05-8FF2-3A53-83D3-837E34D61785),
dual
]
#line 27 "c:\\samples\\com\\employee.cpp"
interface IEmployee : IDispatch {
#line 29 "c:\\samples\\com\\employee.cpp"
[id(1)] HRESULT DoWork([in]BSTR bstrTask);
};
#line 33 "c:\\samples\\com\\employee.cpp"
enum Status {
EMPLOYEED = 0,
UNEMPLOYEED = 1,
};
The linker command is:
cl employee.cpp /LD /link /IDLOUT:employee.idl
Am I missing something in the Linker command?
Thanks
Robert Ernst
|
|
|
|
|
Robert Ernst wrote: I've tried placing the enum in the .idl file, but the type still doesn't show up in the DLL, based on browsing with the Object Viewer
The following code is generated by the Application wizard of the ATL COM Componenet.
I am simply added the enum inside the code is works fine.
I have tested under VB6.0 and VC++6.0 Object Browser
import "oaidl.idl";
import "ocidl.idl";
[
object,
uuid(7CB363A8-69EB-48BE-9E20-BD1B5CC87F76),
dual,
helpstring("Itest Interface"),
pointer_default(unique)
]
interface Itest : IDispatch
{
};
[
uuid(8D40959D-E348-4220-971A-61CA27F53C45),
version(1.0),
helpstring("test11 1.0 Type Library")
]
library TEST11Lib
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");
[
uuid(8F71F9BF-8982-4804-A22C-FA3A7E7C225C),
helpstring("test Class")
]
coclass test
{
[default] interface Itest;
};
typedef enum tagTestEnum
{
Bad=0,
Good=1
}TestEnum;
};
Hope this code helps you
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
BINGO!! That was it.
My enum definition wasn't inside the library TEST11Lib {} declaration.
Once I placed it inside the library <libname> {} block it worked.
Thanks so much for your help!
Robert Ernst
codeproject@theernsts.org
|
|
|
|
|
I suppose that an EXCEPINFO structure filled by IDispatch::Invoke should be cleared after use. Do I have to do this manually, or is there an API function for this?
"God doesn't play dice" - Albert Einstein
"God not only plays dice, He sometimes throws the dices where they cannot be seen" - Niels Bohr
|
|
|
|
|
In the latest version of VS, EXCEPINFO structure is replaced with EXCEPINFO class.
So i don't think we need to manually clear that.
Appu..
"If you judge people, you have no time to love them."
|
|
|
|
|
nicenaidu wrote: So i don't think we need to manually clear that.
Except that I'm doing it through the straight C++ IDispatch class . No fancy ATL classes or .NET wrappers are going to help me here.
"God doesn't play dice" - Albert Einstein
"God not only plays dice, He sometimes throws the dices where they cannot be seen" - Niels Bohr
|
|
|
|
|
Hi Guyz,
Can anybody explain me the difference between Early and Late Binding ??
Please give me Examples in VC++ .
Thanks in advance.
Appu..
"If you judge people, you have no time to love them."
|
|
|
|
|
In context to OLE Automation(Since this is the COM lobby)
Late binding is :
Binding the object library in code at run-time
Av's of late binding
1)The main advantage is that code which uses late binding is more certain to be version-independent
Early binding is :
exposing the object model during design-time, as opposed to during run-time.
Av's of early binding
1)Your code will run considerably faster, because it can all be compiled up front. With late binding, the code relating to an application you declared as an object has to, in effect, be compiled as it runs.
2)Because your code can all be compiled up front, debugging is far easier – select Debug + Compile, and the compiler will be able to spot syntax errors which would have been missed had you used late binding.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Early binding means binding at compile time
The functions are selected and linked at compile time
for e.g Function overloading and Operator overloading
Late Binding means binding at Run time
The selection of the function to be call is at run time
For e.g Virtual functions
Knock out 'T' from CAN'T ,
You 'CAN' if you think you 'CAN'
|
|
|
|
|
Thanks buddies.
Appu..
"If you judge people, you have no time to love them."
|
|
|
|
|
While trying to convert the Html file to image file
Approach is after getting IHtmlDocument2 interface pointer that is passed to the function CCreateImage ,in that we need the IHtmlElementRender interface pointer which is not getting there ? Already included mshtml.h file.
Thanking You
Regards
Shikha
Shikha
Netstudio Pune
|
|
|
|
|
Are you using studio 6.0 ?
because i am not found the prototype of the IHtmlElementRender interface in the header mshtml.h
try using the mshtml.h header provided with vs2003 platformSDK
Knock out 'T' from CAN'T ,
You 'CAN' if you think you 'CAN'
|
|
|
|
|
|
I am using a web browser control in my application. I am using IHTMLElementRender interface at some place to convert the HTML file to image. I am getting the error IHTMLElementRender not defined. Which files I need to include for its defination?
|
|
|
|
|
following files needed
Mshtml.h, Mshtml.idl
Knock out 'T' from CAN'T ,
You 'CAN' if you think you 'CAN'
|
|
|
|
|
Thanks for urgent reply.
I already included the Mshtml.h, but still getting the rooro.
How to include the "Mshtml.idl" ?
is just #include <mshtml.idl> in a file which uses IHTMLElementRender is sufficient?
|
|
|
|
|
Try to import the mshtml.dll file as following
#import "dllpath\mshtml.dll" raw_interfaces_only, raw_native_types, no_namespace, named_guids
ignore .idl file
Knock out 'T' from CAN'T ,
You 'CAN' if you think you 'CAN'
|
|
|
|
|
The definition of the IHTMLElementRender interface is provided with PlatformSDK of the VS2003.
You can use mshtml.h header file of PlatformSDK
Knock out 'T' from CAN'T ,
You 'CAN' if you think you 'CAN'
-- modified at 6:06 Thursday 18th May, 2006
|
|
|
|