|
Make sure that you have- updated the IDL-file
- rebuilt the typelibrary without warnings and/or errors
- rebuilt the server without warnings and/or errors
- re-imported the typelib in the client (the *.tli and *.tlh files should be updated)
- that the parameter list of the function has changed in the client code
- rebuilt the client without warnings and/or errors
BTW, I really hope this server and its interface haven't been distributed yet.
If they are, you're breaking one important rule of COM.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
shivako wrote: I have modified a method of a com interface
That's GAME OVER .
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I am using following dll's in VC++
mso.dll
vbe6ext.olb
namespace Office
comutil
I am getting following build errors:
Error 96 error LNK2005: "void __stdcall _set_com_error_handler(void (__stdcall*)(long,struct IErrorInfo *))" (?_set_com_error_handler@@YGXP6GXJPAUIErrorInfo@@@Z@Z) already defined in comsupp.lib(comsupp.obj) comsuppwd.lib
Error 97 error LNK2005: "void __stdcall _com_issue_error(long)" (?_com_issue_error@@YGXJ@Z) already defined in comsupp.lib(comsupp.obj) comsuppwd.lib
Error 98 error LNK2005: "void __stdcall _com_issue_errorex(long,struct IUnknown *,struct _GUID const &)" (?_com_issue_errorex@@YGXJPAUIUnknown@@ABU_GUID@@@Z) already defined in comsupp.lib(comsupp.obj) comsuppwd.lib
Error 99 error LNK2005: "long __stdcall _com_dispatch_propget(struct IDispatch *,long,unsigned short,void *)" (?_com_dispatch_propget@@YGJPAUIDispatch@@JGPAX@Z) already defined in comsupp.lib(comsupp.obj) comsuppwd.lib
Error 100 error LNK2005: "long __cdecl _com_dispatch_propput(struct IDispatch *,long,unsigned short,...)" (?_com_dispatch_propput@@YAJPAUIDispatch@@JGZZ) already defined in comsupp.lib(comsupp.obj) comsuppwd.lib
Error 101 error LNK2005: "void (__stdcall* __errorPfn)(long,struct IErrorInfo *)" (?__errorPfn@@3P6GXJPAUIErrorInfo@@@ZA) already defined in comsupp.lib(comsupp.obj) comsuppwd.lib
Error 102 error LNK2005: "long __stdcall _com_dispatch_raw_propget(struct IDispatch *,long,unsigned short,void *)" (?_com_dispatch_raw_propget@@YGJPAUIDispatch@@JGPAX@Z) already defined in comsupp.lib(invkprxy.obj) comsuppwd.lib
Error 103 error LNK2005: "long __cdecl _com_dispatch_raw_propput(struct IDispatch *,long,unsigned short,...)" (?_com_dispatch_raw_propput@@YAJPAUIDispatch@@JGZZ) already defined in comsupp.lib(invkprxy.obj) comsuppwd.lib
Error 104 fatal error LNK1169: one or more multiply defined symbols found
Please give me clue to solve this issue.
I am new to VC++ stuff.
Thanks in advance.
Regards,
Gtag
|
|
|
|
|
Well, you're including multiple versions of the COM support library - I see comsupp.lib and comsuppwd.lib for a start.
You need to examine your project settings to see where the libraries are being pulled into your project.
I presume you're using #import to interface to mso.dll and vbe6ext.olb?
How are you 'using' comutil, by the way?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
#import \
"C:\Program Files (x86)\Common Files\Microsoft Shared\OFFICE12\mso.dll"\
rename("DocumentProperties", "DocumentPropertiesXL"),\
rename("RGB", "RBGXL")
//Microsoft VBA Objects
#import \
"C:\Program Files (x86)\Common Files\Microsoft Shared\VBA\VBA6\vbe6ext.olb"raw_interfaces_only,\
rename("Reference","ignorethis"),rename("VBE","XLVBE")
//Excel Application Objects
#import "C:\Program Files (x86)\Microsoft Office\Office12\EXCEL.EXE"\
rename("DialogBox", "DialogBoxXL"),rename("RGB", "RBGXL"),\
rename("DocumentProperties", "DocumentPropertiesXL"),\
rename("ReplaceText", "ReplaceTextXL"),\
rename("FindText", "FindTextXL"),\
rename("CopyFile", "CopyFileXL"),\
rename("VBE","XLVBE"),\
exclude("IFont", "IPicture") no_dual_interfaces
In property pages->linker->input -->additional dependencies i mentioned comsuppw.lib and comsupp.lib.
Please tell me what and all I need to check in project settings.
#include "comutil.h"
#pragma comment(lib, "comsuppw.lib")
|
|
|
|
|
Your #imports are fine.
I've just looked at a project of mine that #imports Excel and I don't #include comutil.h and I don't mention comsupp or comsuppw at all.
In fact, after some investigation, I can say that you don't need to mention them at all. The .tlh file created by the #import includes comdef.h, which in turn a) #includes comutil.h and b) uses #pragma comment to reference the correct comsuppxx library.
So to fix your issue, get rid of your #pragma comments and get rid of references to comsuppxx libraries in your linker input properties.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi,
Thank you.
I have removed from linker and removed #includes even. Project is building but basic functionality is not working.
I can put this way:
I have one VC++ application built on older version which includes macros and these macros functionality depend on some lib which uses comsupp.lib I guess.
Now I have to add some function to read excel data which uses mso.dll and other libraries which I mentioned , these use comsuppw.lib.
Both the things I need but if I am removing reference to comsupp.dll macros functionality is not working.
Is there any way to make both the things working using single com dll.
Thanks in advance.
Regards,
Gtag
|
|
|
|
|
The only difference between comsupp and comsuppw is that comsupp uses ASCII strings, comsuppw uses wide character strings.
Anyway - it's very hard to suggest ANYTHING when the only statement you've given is 'functionality is not working'.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I am retrying the same thing, want to make sure that only bcoz of linker reference its not working or any other reason.
Hey please suggest if you know any other way, I am ready to do R and D.
Pleasee.
|
|
|
|
|
Well - as I said, the only difference between comsupp and comsuppw is the string/character type they use - seems to me that maybe you've probably got an issue with string handling somewhere.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hey its working. Now even functionality is working perfectly.
There was some problem in previous old application, I resolved it.
Thank you very much.
Regards,
Gtag
|
|
|
|
|
There is a problem in my coding. I want to take the dates which store in a txt file like this:
Name,Reports_to,Alias,Title,Office,Team,CompanyCount
Gino Sega, Rajesh Munshi, ginos, SENIOR GROUP PROGRAM MANAGER, 40/3274, SENIOR GROUP PROGRAM MANAGER, MICROSOFT: 9 Chinasoft: 11
Anand Menon, Gino Sega, anandme, PROGRAM MANAGER LEAD 2, 40/3273, PROGRAM MANAGER LEAD 2, MICROSOFT: 3 Chinasoft: 11
Anthony van Gemert, Anand Menon, anvang, PROGRAM MANAGER, 40/3247, PROGRAM MANAGER,
Indra Puri, Anand Menon, ipuri, PROGRAM MANAGER II, 40/3292, PROGRAM MANAGER II,
Urmila Singhal, Anand Menon, urmilas, PROGRAM MANAGER 2, 40/3288, PROGRAM MANAGER 2, Chinasoft: 11
And I want open the txt file with Visio2007 and then get the Visio imange,
how do I can do it by C#? That is say how can I make the visio open the txt file by himeself according C# code.
|
|
|
|
|
whats up guys reccomend any good reads?
Fat Smash diet
|
|
|
|
|
Iain M Banks - Consider Phlebas, The Player of Games
Almost anything by J.G.Ballard
That'll do you for a start.
Oh wait...did you mean COM books? Inside COM[^], then
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi,
I have creating shared add-in in C# and then am then using Shim on top of it.
Shared add-in has some user defined functins.once you type the UDFs in Excel, it will log in to server using username and password,creates sessions and get the data.
I am planning to move VSTO. Is it possible to introduce VSTO instead of Shim on top of shared add-in?
how can I do it? can any one share the thoughts?
Thanks
|
|
|
|
|
I have (I think for some of you) a simple question. I have an .vcproj project (no ATL support and no MFC support) and a I have an .exe file. Within this .exe file should be an COM Server that runs on WinVista. Now I need an connection from my .vcproj project to that COM server. Is there anywhere an step by step tutorial with that I can do such something? I’ve heard in several forums that it is the easiest way to create an ATL project and implement this .exe file. This works also if I create a new ATL project. A new .h file will be created with all the Methods and so on out of the .exe file.
But what should I do with an non ATL/MFC supported project? Is there also a way to work with such an project and an COM server?
The main problem I have is that I need to work later with some events of the COM server, and this should be also very complicated with no ATL support?
It would be nice if someone could send me some information (Step by Step tutorial / simple example how events could be called and so on). I’ve found some things but no complete running example with an event handling.
Thanks for any hints.
System: WinVista, Visual Studio 2005
|
|
|
|
|
Just add the ATL header files in - that's all you need - that's all that "ATL Support" actually means. Doing stuff with COM without ATL is just too much like hard work.
You remember that Excel connection point sample of mine I linked to? That consists of a single .cpp file, whose 'ATL Support' consists of these three lines:
#include <atlbase.h>
#include <atlstr.h>
#include <atlcom.h>
And the atlstr.h isn't needed for COM.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
modified on Thursday, September 10, 2009 11:35 AM
|
|
|
|
|
Thanks for your help, Stuart. I try now to implement MFC + ATL support and then I can implement all the COM classes out of the .exe file directly with Visual Studio.
Regards,
Jürgen
|
|
|
|
|
Ignore MFC - you don't need it for a simple connection point sink.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
ok, thanks.
Now I made the following steps in Visual Studio:
-> Add Class --->Simple ATL-Object with Connection Points. With that the ATL support was added to my project.
After that the project could be compiled without any problem.
Now I click with the right mouse on the new class I've created with the ATL OBject and choose "Implement interface". With that I can now navigate to the .exe file and implement all the interfaces I need.
And now after that I got the following message after I tried to compile it:
Program Files\Microsoft Visual Studio 8\VC\atlmfc\include\atlcom.h(1868) : error C2259: 'ATL::CComObject<Base>': Instance of abstract class could not be built1> with
1> [
1> Base=CEGR_COM
1> ]
1> because of the following member:
1> "HRESULT ICOLE::cSetLanguage(BSTR,VARIANT_BOOL *)": is abstract
1> c:\dev\cw_source\vitra scene\release\configurator.tlh(605): Siehe Deklaration von 'ICOLE::cSetLanguage'
1> "HRESULT ICOLE::cSetDefaultCurrency(BSTR,VARIANT_BOOL *)": ist abstract
.
.
.
.
.
Ok, all these function bodys are now in an TEST_COM.h and in the configurator.tlh file. The TEST_COM.cpp is empty. I don't know why this error message now will come up. The error message will come only for a few of the functions in the .tlh file, not for all.
.
.
.
virtual HRESULT __stdcall get_DimensionZ (
/*[out,retval]*/ double * Value ) = 0;
virtual HRESULT __stdcall put_DimensionZ (
/*[in]*/ double Value ) = 0;
virtual HRESULT __stdcall get_ErrorCode (
/*[out,retval]*/ short * Value ) = 0;
virtual HRESULT __stdcall put_ErrorCode (
/*[in]*/ short Value ) = 0;
virtual HRESULT __stdcall cInitializeProperties ( ) = 0;
// All the functions below will cause an error message
virtual HRESULT __stdcall cSetLanguage (
/*[in]*/ BSTR pLanguage,
/*[out,retval]*/ VARIANT_BOOL * Result ) = 0;
virtual HRESULT __stdcall cSetDefaultCurrency (
/*[in]*/ BSTR pCurrency,
/*[out,retval]*/ VARIANT_BOOL * Result ) = 0;
virtual HRESULT __stdcall cShowCatalogChooser (
/*[out,retval]*/ VARIANT_BOOL * Result ) = 0;
.
.
.
Any ideas?
|
|
|
|
|
I don't think you've gone around this quite right - I thought you wanted to catch events raised by the COM server in the EXE file?
If this understanding is correct, then you don't need to re-implement the interfaces exposed by the EXE's COM server to do that - instead, you just need to instantiate the COM object implemented in the EXE and implement a connection point sink that you link to the instantiated object.
Please let me know if I've understood your situation correctly (although I'll be mostly off-line over the weekend).
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Yes, you understand it correct. I want to catch events from this server in the .exe file.
At first I worked with an .c / .h / .idl file that have been created from the .exe server. With these I could create an ComPtr and I could call some methods with this pointer. This step works in my old project:
CComPtr<icole2> tCOLE;
hr = CoInitialize(0);
hr = CoCreateInstance(CLSID_COLEv2, 0, CLSCTX_LOCAL_SERVER, IID_ICOLE2, (void**)&tCOLE);
tCole->.... //here I could call the methods out of the ICOLE2.
This worked also perfect.
Now I had the problem that I must catch also some events from the server. And here I didn't know how I should go on. Some people on different forums called me to work with atl because this should be easier. So now I tried to do that all with ATL. The main problem now is, that I didn't exactly know what I must do. I didn't found anywhere an example / tutorial that explains everything step by step.
|
|
|
|
|
 Here's a full example using ATL and #import - the comments should be informative, I hope It references the Excel COM server, obviously running in a separate process. It tells Excel it wants to catch application-specific events (as defined by the interface AppEvents), by telling it what object to send the events to.
#include <iostream>
#include <atlcom.h>
#import "libid:00020813-0000-0000-C000-000000000046" version("1.6") auto_search no_dual_interfaces raw_dispinterfaces rename("DialogBox", "excelDialogBox") rename("RGB", "excelRGB") rename("DocumentProperties", "excelDocumentProperties") rename("SearchPath", "excelSearchPath") rename("CopyFile", "excelCopyFile") rename("ReplaceText", "excelReplaceText")
_ATL_FUNC_INFO SheetChangeInfo = { CC_CDECL, VT_EMPTY, 2, { VT_DISPATCH, VT_DISPATCH } };
class ExcelAppEventHandler : public IDispEventSimpleImpl<1, ExcelAppEventHandler, &__uuidof(Excel::AppEvents)>
{
public:
ExcelAppEventHandler(bool& doneFlag) : done_(doneFlag) { done_ = false; }
BEGIN_SINK_MAP(ExcelAppEventHandler)
SINK_ENTRY_INFO(1, __uuidof(Excel::AppEvents), 0x0000061c, &ExcelAppEventHandler::SheetChange, &SheetChangeInfo)
END_SINK_MAP()
void _stdcall SheetChange(IDispatch * Sh, struct Excel::Range * Target)
{
done_ = true;
}
private:
bool& done_;
};
_bstr_t GetActiveWorkbookName(Excel::_ApplicationPtr xl)
{
if (Excel::_WorkbookPtr wb = xl->ActiveWorkbook)
{
try
{
return wb->FullName;
}
catch(_com_error& e)
{
std::cout << "EXCEPTION!!!\n";
std::cerr << CT2CA(e.ErrorMessage()) << std::endl;
bool done;
ExcelAppEventHandler app(done);
if (SUCCEEDED(app.DispEventAdvise(xl)))
{
MSG msg;
while (!done && GetMessage(&msg, NULL, 0, 0) > 0) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
app.DispEventUnadvise(xl);
return GetActiveWorkbookName(xl);
}
}
}
return _bstr_t();
}
int _tmain(int argc, _TCHAR* argv[])
{
CoInitializeEx(0, COINIT_APARTMENTTHREADED);
{
Excel::_ApplicationPtr xl;
if (SUCCEEDED(xl.GetActiveObject(__uuidof(Excel::Application))))
{
std::cout << "Getting name\n";
std::cout << GetActiveWorkbookName(xl) << std::endl;
}
}
CoUninitialize();
return 0;
}
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Juergen_80 wrote: Now I need an connection from my .vcproj project to that COM server. Is there anywhere an step by step tutorial with that I can do such something?
I think that "#import directive" is only what you need if you are simply a client of this COM exe server.
Also don't forget about CoInitialize/CoInitializeEx functions before using COM objects and CoUninitialize after.
With best wishes,
Vita
|
|
|
|
|
Hi!
I have an application in MFC unmanaged code compiled with VS2008. My application call a strong-named com-module, registered with RegAsm myCom.dll /tlb:myCom.tlb /codebase, and gacutil /i myCom.dll. myCom-module is coded in c# and compiled with VS2008.
My customer runs my application on a citrix-server through a citrix-client. For most of my customer all works fine but for a few customer the application fails to call my Com-module when they run my application from there workstation, but if they try with the same login from another computer there is no problem at all.
Any clue how to solve my problem?
Best regards,
Bertil
MSc Bertil Morefält
modified on Thursday, September 10, 2009 10:21 AM
|
|
|
|
|