|
I have a bad answer for you, and then a question.
I have seen this type of question many other places and I have never seen an answer. My suggestion would be to simply use more than one version of your .dll. It would be nice to be able to use only one .dll for any system, but, as an example, check out the Microsoft Internet Explorer update page... there are different d/ls for different versions of windows. I think you have the same type of situation. It ain't pretty, but it may be the only solution. Hopefully someone can jump in and give a better answer...
And now my question: I was wondering what resources you used for your project, besides the article you referenced in your post. Specifically, I am getting ready to start a project using COM to automate Word and I am looking for a resource on this, objects, functions, etc. More specifically I want to be able to select document properties, search for and open templates, write text to the document, and print. I have gotten lost on wild goose chases in MSDN docs and I just need a nudge in the right direction.
Please let me know if you can help.
Thanks,
tym!
|
|
|
|
|
I am not sure if I am the best person to answer this. I tried to use MSDN and they have a wealth of information. Unfortunately, I understood about 1% of all the information. There are many articles out there, the one I reference in the above posting written by Amit Dey, there is another written by Christian Staffe, both are on this website. Plus, between this website and CodeGuru.com, you can pick up a lot of information. The bad thing is that it is not all straight forward, unless you are an experience COM/ATL programmer. Another bad thing is that many examples are written with ATL and many others are NOT. So it is a bad mix. If you keep digging, you can find a lot. If you are wanting to select document properties, open templates, print, etc, you can find basic functions/info on these websites. If you are wanting to add a button/toolbar/menu, that is a whole 'nother ballgame!
|
|
|
|
|
I think I understand DCOM, I know I understand COM, but marketing people have made some things tough on me to figure out.
For example, what is the difference between DCOM and CIS (COM Internet Services) ?
Where does COM+ fit in the picture, I know COM+ is MTS/COM packaged, but is DCOM and CIS still seperate from COM+?
COM+ is used for distributed computing, but I assume this is different than the distributed computing that DCOM implements?
Thanks in Advance.
Soliant | email
"the result is that VC7 is the only compiler to generate optimized MSIL" - Stanley Lippman
|
|
|
|
|
Hi all, I finally was able to get my Word Automation project to work, somewhat. I was never able to find a way with Office 97 but Office 2000 and XP, I was able to find a way. But I am having one problem. When I launch Word from my application, everything seems to work fine. Except when I decide to open an existing word document. It opens the document but it does it in an entirely new Word window, not in the existing window like it usually does. Any ideas what might be causing this? Any ideas how to get around this?????? I am stumped...
|
|
|
|
|
Hi, this is an uninformed, inexperienced answer, but maybe it will help.
Have you tried checking for an existing instance of word before opening the doc? I am brand new to COM, but it seems like there should be a way to check for this and then open a communication to the existing instance. I don't know what your code is like, but if you're just using system calls or something to open the doc and leave it up to windows file associations to do the right thing, that might be the problem.
Sorry if this is of no help, but no one else had an opinion...
tym!
|
|
|
|
|
If you used the Amit Dey article, I have had this problem as well. And I have not come up with a way to check for an existing instance, since it uses ATL...
|
|
|
|
|
The problem is:
How to handle dynamically in a C++ (ATL) CLIENT some
ActiveX control collection properties like in VB ?
(Item, Add, Remove, etc.)
Example:
A control is dynamically created from its ProgID.
COMCTL.ListViewCtrl.1 (common listview control)
We have access to its IUnknown & IDispatch pointers.
Automation approach, using ITypeInfo, TYPEATTR, etc., doesn't
seem to permit a correct access to the ListItems property
(ICollectionXXX like,I think)...
I found a PROPGET/PROPPUT ListItems property but I don't known
how to use them: these two functions take one argument and have
no result...
please help me !
|
|
|
|
|
ATL/WTL are way too cool:
In your header add:
1. #import "C:\WINNT\System32\MSCOMCTL.OCX" no_namespace, named_guids
2. IListViewPtr m_myListView; // new member
3. Access like this:
GetDlgControl(IDC_LISTVIEWCTRL1, __uuidof(IListView), (void**)&m_myListView);
IListItemsPtr IListPtr = m_myListView->GetListItems();
ÿVOTD: 1 "Now faith is being sure of what we hope for and certain of what we do not see."
2 "This is what the ancients were commended for" - Hebrews 11:1-2
|
|
|
|
|
Thanks Ernest
BUT... this is not exactly what I'm looking for...
ProgID is unknown at compile time. We have to read the type library at runtime...
So, is there an #import-like command that would do the job at runtime ?
|
|
|
|
|
Ok... I finally implemented a TLB browser and everything works.
But one strange thing: 'GetListItems' method definition changes !
something like:
in the Type Libray -> ListItems GetListItems( )
ITypeInfo from IDispatch -> GetListItems( arg )
Does somebody know why ?
|
|
|
|
|
Hello guys,
i have made a COM object called IJeremy it has a method called SetMsg which takes an IMessage* as an [in] param.
This object fails to compile - it tells me:
error MIDL2025 : syntax error : expecting a type specification near "IMessage"
What is the best way around to get it to work?
Could i sort of #include the IDL files of IMessage?
Thanks for the help,
Jeremy
Jeremy Pullicino
Professional C++ Developer
Amature COM developer
Done any hacking lately?
|
|
|
|
|
You need to define IMessage in the IDL file!
Jeremy Pullicino wrote:
Could i sort of #include the IDL files of IMessage?
yes, you can #import it!
ÿVOTD: 1 "Now faith is being sure of what we hope for and certain of what we do not see."
2 "This is what the ancients were commended for" - Hebrews 11:1-2
|
|
|
|
|
Hi, I have a Automation COM object which has one property, which is of type long. This works, and now I want to create another property, but not of type long, but of type IDispatch. Basically I want to return another COM object from a property. I've tried setting the property type from the IDL to LPDISPATCH and LPUNKNOWN, but I keep getting errors from VBScript.
Does anyone know how to have a property of type 'IDispatch' in a COM Automation Object?
Thanks,
James Pullicino
Drinking In The Sun
Forgot Password?
|
|
|
|
|
Hi!,
I'm far off a COM guru. I need my app to use the IShellLink interface... I have initialized both com (CoInitialize) and OLE (drag & drop works fine already). I followed the tutor I have and did it like
IShellLink* sl;
res = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void **)&sl);
but this fails... Dunno why, none of the documented return values is returned (there are 3 of them).
Many Thanks for much help!
|
|
|
|
|
What OS are you running on? How are you checking the return value?
Todd Smith
|
|
|
|
|
|
We have an application consisting of any type of component available on the Windows platform :
* MFC ocx and dll,
* ATL DLL and EXE servers,
* some VB stuff and
* a MFC startup application.
Using the debug heap from Microsoft we have already found new/delete mem-leaks, but we have currently no choise to find those COM memory leaks.
I have began working on an IMallocSpy implementation to be registered in COM to show the amount of open leaks, but what I don't understand is how I could implement that kind of stuff to display the C-Class-Name, FunctionName and LineNumber where that open memory block will be allocated.
I tried to use the compiler macros __FILE__ and __LINE__ in my IMallocSpy implementation, but that shows - of course - the filename and the line of my IMallocSpy file....
Could somebody help me out ?!
Best regards
Andi
|
|
|
|
|
Take a look at Compuware DevPartner (www.compuware.com[^]). This product contains error detection tools formerly known as BoundsChecker. It's not cheap, but it's worth every penny.
Vagif Abilov
MCP (Visual C++)
Oslo, Norway
If you're in a war, instead of throwing a hand grenade at the enemy, throw one of those small pumpkins. Maybe it'll make everyone think how stupid war is, and while they are thinking, you can throw a real grenade at them.
Jack Handey, Deep Thoughts
|
|
|
|
|
Hi, I'm very new to ActiveX and I have just made an ActiveX version of Chris Maunder's CGridCtrl. I am having terrible problems with memory leaks when my application terminates. Has anybody else tried to make an ActiveX version of this class? I've made sure that DestroyWindow() is called in the ActiveX portion.
Is there anything obvious anyone can think of without looking at the code?
Many thanks,
Alan Dugdall
|
|
|
|
|
I have written an ActiveX control (full control) using the MFC AppWizard. I have a property page for it too. I have created a dialog-based app to try this control.
When I change the value of the property using the property page I created (from inside the VC++ dialog editor), the change is not getting reflected in the control. But I get the expected result when I change it in the "All" tab.
I think I have missed out something while creating the control.
My question:
How do I make the value in the property page for a particular property and the same property's value in the "All" tab in VC++ dialog editor tally?
Thanks!
Logic is a systematic method of coming to the wrong conclusion with
confidence.
|
|
|
|
|
how to register a com?
how to unregister the coms that are currently register?
what is the difference between com and com+?
r00d0034@yahoo.com
|
|
|
|
|
If it is a COM dll or OCX, you'll need to use RegSvr32.
If it is a COM Exe then the usual way nameof.exe /RegServer
Michael
Time flies like an arrow. Fruit flies like a banana
|
|
|
|
|
Each time I do a Form or Dialog project I'm surprised that Visual Studio resource editor offers so few features.
For example I would like to be able to resize a control to an exact size or to position it on the window at a precise offset. Well all this is only possible when editing manually the .rc file.
I know that .Net now offers a new kind of UI editing with the Forms but this is only dedicated to .Net technology and runtime - and my need is for C++, just C++.
So, is there somewhere such an editor or do you feel the need of such an editor ?
Yarp
http://www.senosoft.com/
|
|
|
|
|
I have an ATL COM object which generates events using Connection Points, can I receive the events in VBScript?
Sonork 100.15206;PavelK
|
|
|
|
|
See following thread:
"VBScript and COM Inf. with ByRef"
Marco
|
|
|
|