|
HI,
Say I have a MFC application. On InitInstance or InitDialog I want to check if there is any COM server(registered) that belongs to the application.(I don't know any CLSID)Is it possible to do that. If so then I wan't to add an item in the menu for each com server I find.
|
|
|
|
|
Hi,
Information about registered COM objects is stored in the registry. You can try the CLSIDFromProgID function to check if specified ProgID is registered. You can also create an instance of the object and then release it, to be 100% sure that all pieces in place.
Regards,
Alex Gorev,
Dundas Software.
|
|
|
|
|
Hi,
COM object is a binary file, and dll also binary file.
what is difference between them (internally)?
thanks,
koteswara
|
|
|
|
|
Hi,
COM object can be stored in the DLL or EXE file. When a COM object is stored in the DLL the only difference with the usual DLL file, is that the COM DLL must have several COM related methods:
DllGetClassObject
DllRegisterServer
DllUnregisterServer
DllCanUnloadNow
See description of these functions in MSDN for more details...
Regards,
Alex Gorev,
Dundas Software.
|
|
|
|
|
Hello Everybody
I have written what I think to be a comprehensive, seven-step tutorial which is easy enough for beginners to use, and posted it on The Code Project to help you get started on DCOM programming. It guides you through using and doing:
+ Implementing a DCOM server as a Windows NT Service;
+ using the ATL COM AppWizard;
+ using all of the Visual C++-IDE features like New ATL Object Wizard, Add Method to Interface, etc etc
- implementing Connection Points:
+ Over the network with DCOM
+ On the client side with MFC and ClassWizard (!)
+ MFC and AppWizard and ClassWizard on the client side
Full source code provided for each step of the tutorial, and a full client that reports status is provided with the last step, plus a source code archive and Questions and Answers page.
Check it out! It's as yet an "unedited reader contribution" but I want to invite you to look at it anyway and let me know what you think. Feedback is so very needed on this kind of a project.
The tutorial starts with Step 1. Enjoy!
(NOTE: "Step 1" above is a hyperlink to the tutorial.)
|
|
|
|
|
Hi,
what is exact difference between aggragation and containment.
aggregation is 'has a' relationship between classes.
Inheritence is 'is a' relationship. is it correct?
what about containment?
send me msdn links
thanks,
- Koteswara,
pkoti@staff.juno.com
|
|
|
|
|
Hi,
In C++ you can use inheritance, which is 'kind-of' relationship, or composition, which is 'has-a' relationship. You also can use the private inheritance, which is just a syntactic variant of composition.
Aggregation and containment are related to the COM. Aggregation is exposing a binary sub-object to the client as is using the QueryInterface. Not all classes are aggregatable and you may want to expose only part of the object's functionality, in this case you can use containment.
The best source of information on this topic is the Don Box's book "Essential COM".
Regards,
Alex Gorev,
Dundas Software.
|
|
|
|
|
In simple terms aggregration means that the COM Component has an Internal Interface which is doing all your work though you are talking to front interface which redirects your job to its internal interface. As far as containment is correctly interpreted by me refers to the interface by which COM is exposing the rest of the interface contained inside it.
|
|
|
|
|
I developing a webbrowser using CHtmlView.
But this browser is not repaint properly.
That is, i want to use CView::Invalidate() for browser repaint.
But this function is not work.
Anybody have sample code.
Thanks in advance.
dooly
|
|
|
|
|
To have the view repaint, call CHtmlView::Refresh(). CHtmlView doesn't behave like a normal MFC view because all it does is wrap the WebBrowser control.
|
|
|
|
|
Thank you for your reply.
|
|
|
|
|
You can use CHTMLView::GetHTMLDocument to get the dispatch pointer for the document. Then you can get the window for the document. If you use Spy++, you will see that this has a classname of "Internet Explorer_Server". The following code will get you the handle to the window so that you can call InvalidateRect and UpdateWindow on it.
IOleWindow* pOleWindow = NULL;
HWND hWnd = NULL;
// pDispatch is the IDispatch pointer retrieved from GetHTMLDocument of CHTMLView.
HRESULT hr = pDispatch->QueryInterface(IID_IOleWindow,(LPVOID*)&pOleWindow);
if (SUCCEEDED(hr) && pOleWindow)
{
hr = pOleWindow->GetWindow(&hWnd);
// Ouput the classname to the debugger for verification
if (SUCCEEDED(hr))
{
TCHAR szClassName[256];
GetClassName(hWnd, szClassName, 256);
OutputDebugString(szClassName);
OutputDebugString(TEXT("\n"));
}
pOleWindow->Release();
pOleWindow = NULL;
}
I hope this helps,
-Erik Thompson
|
|
|
|
|
Thank you for your reply.
|
|
|
|
|
Hi,
I successfully crea the .chm file. But i want GUI like MSDN help.
Like two panes, on clicking an item in the left pane should give its contents on
right pane.
Thanks,
- Koteswara
|
|
|
|
|
A GUI comes with Windows which is like MSDN!
|
|
|
|
|
Hi,
I can't figure out how to implement each interface in separate C++ class(not COM object) with ATL.
|
|
|
|
|
why cant we have two methods with same name but different arguments in an interface ? I tried it in VB and VC it is giving problems
|
|
|
|
|
Hi,
If you want to use your object with late binding, there is no way the GetIDsOfNames method of the IDispatch will know which ID to return, if it has two methods with the same names. So the problem is that the clients like VB or ASP do not know what to do with that kind of the objects.
As I heard this problem will be fixed in the new version of VB and C#.
Regards,
Alex Gorev,
Dundas Software.
|
|
|
|
|
What you're talking about is called "overloading functions." Polymorphism is a different thing entirely!
Plus, you *can* have such methods if they are in an IUnknown-based (custom) interface, but you have to promise never to use it with VB...
Brian Hart
|
|
|
|
|
COM. I realize that I have to use automation-compatible data types such as VARIANTs
and SAFEARRAYs. However, I'm having difficulty figuring-out exactly how to define the
method in IDL and interpret the data on the server side.
The data is a set of 29 variables, most of which are integers. Some are floats, with one
string and couple of arrays thrown in for good measure. Obviously it would be tedious
to set-up and use a method with 29 parameters. So, I'd like to pass all of the data in
one chunk if I can. Additionally, there will be 2 other chunks of data returned to the
client in the same method ... but that's a different question. The only thing I'm
trying to do now is get the chunk of data to the server.
In all that I've read, it seems that the best way to pass the chunks of data is using
arrays of VARIANTs. Is that true ? If so, how do I define the method interface in
IDL and how do I unpack the data on the server ?
Any guidance would be helpful.
Thank you,
Keith Gemeinhart
|
|
|
|
|
Hi Keith,
You absolutely right... You have an option of passing 29 parameters to the method or you can use safearray. But safearrays are difficult to work with if you have different type of data like integers and strings...
The third option you have, which is the best if you have very complicated data that you need to pass/return to/from the method, is to use a COM object. You create a COM object with the different type of properties and pass/return it by interface pointer. The big advantage is that you can access the properties by names and even associate help strings with each property. The only issue is the performance... if you need to make many calls to such a method, it will take a lot of time to create and initialize the parameters object.
Regards,
Alex Gorev,
Dundas Software.
|
|
|
|
|
Thanks for your reply. I have solved the problem ... and
in the near future, I will post a short description of how I
did it.
-Keith
|
|
|
|
|
Hi
How do i show IE default context menu when user right click
on a WINDOW only ActiveX control...?
thanks
tomer
websplit
|
|
|
|
|
Hi,
I created a atl com dll (full control) that consists of a simple object "a". I tried to fire events from the simple object "a" to the full control but I noticed that the full control did not receive the events. However, when I tried to created a new simple object with a sink interface within the ful control, it manage to receive the events fired from the simple object "a".
Why. What should I did in order for the full control to receive the events.
I call
HRESULT hr = AtlAdvise(mp_Mixer, this->GetUnknown(),DIID__IMixerCtrlEvents, &m_dwCookieMixerCtrl);
and hr return "0".
|
|
|
|
|
Hi,
You have to implement the sink in the client to be able to advise for the events. Check the arctile from MSDN ID:Q181277 "SAMPLE: AtlSink Uses ATL to Create a Dispinterface Sink" for more details...
Regards,
Alex Gorev,
Dundas Software.
|
|
|
|