|
|
hi,
thanks for ur help..i am trying to develop this in vc++...ur help as nice though...i appreciate ur support...
thanks a lot...if there is anything u find..pls send it to me..
himanshu
|
|
|
|
|
The project I'm working on is moving from good old DCOM to COM+. I find it hard to solve one issue. Back in DCOM days, when you had data that had to shared by all the objects of a class, there was no problem holding inside the DCOM EXE server and letting all instances know of it (data such as a list of connected currently connected users, etc).
How do I do it in COM+, as all objects are created through surrogate DLLs ?
Thanks,
Omer.
|
|
|
|
|
If you are using a C++ server, it's simple, it's just a matter of creating a global DLL variable.
If you want to use the COM+ way, or for VB DLLs, you can use the Shared Property Manager (SPM), which is designed exactly for this.
I see dumb people
|
|
|
|
|
I need a whole Data structure (and not a simple one). If I understand correctly, what you suggest is to wrap it up with COM and pass it around to all instances this way or another. Isn't there a simpler solution ?
|
|
|
|
|
No you don't need to wrap it with a com object, simply you need to keep your data structure as a global variable to the dll module then provide a code that manipulate that structure with a multi-threaded-safe fasion and you are done.
if you want to avoid writing syncronization code you can rely on the sahred property manager as daniel advised.
AbuMalek
|
|
|
|
|
I would like to know how to implement a schedule in VC. I am familiar Java than VC. In Java I did use Timer and Thread. But in VC, I dont know.
Please drop to me some line if you know!
Thanks
|
|
|
|
|
Uhm, this forum is about COM. You probably want to ask your question in the Visual C++ forum.
When asking the question in the Visual C++ forum, also specify whether you're using ATL windowing, MFC or Win32. That would help people help you better.
--
If I had the ability to smooth talk like John Simmons, this post would be less sarcastic and more to the point.
|
|
|
|
|
I'm trying to insert an object from a file into a document. How does the filename get passed to the OLE server to open it up to display into the container application.
thanks
|
|
|
|
|
Dear experts,
I am looking for code tips on how to attach a template to a word document using a DLL or COM component.
I know word gives this feature in their menu using tools->Templates and addIn option, but I need this feature to be available as dll so that it can be called by programs that can automate the convertion of word document look and feel.
The dll function will receive the inputs - the word document and the template to attach and the output will be the word document with new template attached to it.
Any tips on this highly appreciated. Thanks
|
|
|
|
|
Hello!
How can I force my IE toolbar plugin to be visible at next start of IE after installation?
By default, user have to check my plugin in View->Toolbars->... menu to enable it. How can I do it automatically?
Thanks in advance for all answers!
Dmitry Yu. Babokin
|
|
|
|
|
hi,
i am a new developer looking for some help here..i am trying to develop a IE plugin as u must have created...what do i need to start with it..i dont have any idea..
please help..
regards
Himanshu
|
|
|
|
|
I've been working with COM for many years now but never really had much need
for any threading models except MTA's. Now I'm working on a project where it
does matter and, after reading some articles and docs in MSDN, have a few
questions:
Basically, I'm writing this BHO that gets initialized with every instance of
Internet Explorer. I use CreateFileMoniker to get an IMoniker for the config
file then use IMoniker::BindToObject to bind it to a configuration object. I
would like each instance of my BHO to call a single instance of this
configuration file. Would the STA threading model help me acheive this
singleton approach?
Also, if this instance approach is possible, does each instance of the BHO
(say, in FinalConstruct()) need to go through the whole Moniker bit, or does
only the first instance of the BHO? I'm also a little new on monikers (I've
used them a little before and understand all the docs well-enough), so I'm
not exactly sure about using monikers within multiple threads (the ROT is
only supposed to hold one instance of the moniker no matter how many times I
use CreateXXXXMoniker, right?).
PS: I've been looking for some decent online examples (including in the MSDN
library) to fill-in the gaps (so to speak) dealing with monikers and
threading but have found none. Anyone know of any URL's?
TIA
"Well, I wouldn't say I've been missing it, Bob." - Peter Gibbons
|
|
|
|
|
I think that the Threading Models and the Monikers are separate entities.
Threading Model is a type of apartment of COM object.
Moniker is a way to get a pointer to an object. Moniker as COM object has own Threading Model. Even it has own custom "by value" marshalling.
About BindToObject, look at MSDN "IMoniker—File Moniker Implementation".
As far as I know, pMoniker->BindToObject(pBindContext,NULL,riid,&pObj) will return the same object (i.e. singleton):
1) if pMoniker was created with the same lpszPathName and pBindContext is the same, i.e.
CreateFileMoniker(lpszPathName, &pMoniker1);
CreateFileMoniker(lpszPathName, &pMoniker2);
pMoniker1->BindToObject(pBindContext,NULL,riid,&pObj1);
pMoniker2->BindToObject(pBindContext,NULL,riid,&pObj2);
// here pObj1 == pObj2. It does not depend on type of object being bound.
2) if pMoniker was created with the same lpszPathName and object is registering itself or by moniker in ROT with the equal moniker, i.e.
pRunningObjectTable->Register(grfFlags,pObject,pFileMoniker,&dwRegister)
pBindContext has no meaning.
Simply speaking, moniker searches similar moniker in ROT or in a binding context. If no success, moniker will create new object.
Sorry, if I am not able to explain such complicated subject more cleanly.
With best wishes,
Vita
|
|
|
|
|
Thank you. I do realize that they are different topics but this was meant as a two-part question. And actually, I don't find this complicated at all. I have actually written some applications that interact with the ROT (don't ask :-P) but didn't realize that each call to BindToObject() produces the same object reference. You've explained it well enough for me.
"Well, I wouldn't say I've been missing it, Bob." - Peter Gibbons
|
|
|
|
|
I'm sorry if my question is a bit doom. I'm new to COM. I read the Developer's Workshop to COM and ATL by Andrew W. Trolsen. It's quite good but I doubt on something.
I don't know why MS must have DLLGetClassObject to return iclassfactory. IMHO, returning iunknown inside the coclass should be easier, so that the developer can query interface immediately.
If you know why, please enlightening me in a simple and clear answer, coz I'm very new to COM.
|
|
|
|
|
|
Thank you for promptly reply. Your article is really good. But I don't know why it must be IClassFactory. Why not be...
hr = CoGetClassObject(CLSID_CoCar, CLSCTX_INPROC_SERVER,
NULL, IID_IUnknown, (void**)&pUnk);
hr = pUnk->QueryInterface(IID_ICreateCar, (void**)&pICreateCar);
or Implementing CreateInstance in IUnknown
instead of letting CoGetClassObject create IClassFactory and then use IClassFactory to create IUnknown.
Thank you
|
|
|
|
|
doromoji wrote:
instead of letting CoGetClassObject create IClassFactory and then use IClassFactory to create IUnknown.
Because that's how COM is designed. The class factory is a mandatory intermediate step.
Class factories were designed to allow client apps to create multiple instances of an object, using the IClassFactory interface. In practice, I have yet to see a real world use of that design.
So, while you are right in the "direct use" you suggest, I am afraid you can't do much about it : the COM library is a native library of the operating system. Imagine it would break hundreds of thousands of real world COM apps only to satisfy the need of one customer (or several).
Besides that, MS is not investing in COM anymore. The .NET CTS provides the best of COM without the hassles.
|
|
|
|
|
[quote]
Class factories were designed to allow client apps to create multiple instances of an object, using the IClassFactory interface.
[/quote]
Not only. The main reason is that the EXE server must expose something to have access to him. It is a class factory, but no object itself.
For DLL server it is possible to solve without a class factory but it was done with compatible way.
With best wishes,
Vita
|
|
|
|
|
Thank you all.
|
|
|
|
|
Is ODL an alternative to IDL to provide interfce definitions
Also can I compile it with MIDL and get the necessary header for the interfave
|
|
|
|
|
I would like to take an existing application that I created and create and object so I can embed into other documents. For example in Microsoft Word. I can insert a Excel worksheet object into word (Insert>Object) and toggle between the two applications. Any ideas on how I can achieve this.
Thanks
|
|
|
|
|
In the most generic way, the answer is you have to implement the object container. As a start-up code I would like to recommend you the ActiveX Control Test Container sources (I guess available somewhere on microsoft msdn site) or sample called I guess VBLite (described in article Extending ATL 3.0 Control Containment to Help You Write Real-world Containers)
hope this helps
|
|
|
|
|
Hi all,
Can anyone point me in the right direction of information about using the Excel grid in a VC++/MFC app? I'm just looking to get the grid on a view / dialog, maybe manipulate some rows / columns (via code), etc.
Is this even doable?
Dylan
"In meetings, the person who is least competent usually does the most talking. Talking is a direct substitute for competence, at least in the minds of other people. Five minutes after you leave a meeting, you won't remember what anyone said but you will remember who did most of the talking. Withing a day your mind will translate that into a notion that the talker was unusually knowledgeable" - Scott Adams, Dilbert and the way of the weasel
|
|
|
|