|
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
|
|
|
|
|
Well.. the scenario is the same com+ behave different on different environment right ?..
RegAsm command register your com into GAC and you also export the tbl. I need to confirm that weather you using the tlb which is exported in a developer / local environment and use this as references for your custom application.
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you.
Thanks
Md. Marufuzzaman
|
|
|
|
|
Hi!
In my developer computer I have registered myCom.dll at .\mycomdir\release and in my code I have #import "c:\mycomdir\release\myCom.tlb" raw_interfaces_only
In the application-server I have registered myCom.dll at the applications home-directory. So, both myCom.dll and myCom.tlb resides in the applications home-directory.
Best regards,
Bertil Morefält
MSc Bertil Morefält
|
|
|
|
|
Okay...Probably you set the COM visible = true from app-> assembly info & Register for COM Interop = true.. in this case you not need to register the COM using RegAsm command in your local machine. I think you can try to add your COM project in your setup and deployment project and set the self register = true... It will might be release your extra pain on thinking of various version of Microsoft Windows OS .
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you.
Thanks
Md. Marufuzzaman
|
|
|
|
|
Hi all,
I have a .NET(C#) DLL which I have to use from Visual Basic 6.0 application. I am using regasm tool to make tlb file and register the dll. Then I can use the tlb file from VB6.
Now I have to make an installer. I have heard that its possible from installer project to make tlb without using regasm tool, but did not get any sample yet.
Is it really possible to register .NET DLL without using regasm? If possible it would be great because I do not need to add any .NET framework in my installer.
If this is possible can anyone please give me a complete sample of this?
Please response.
modified on Saturday, September 12, 2009 4:48 AM
|
|
|
|
|
Yap... It's very easy. you can create an installer of your com+; You just take a setup & deployment project add the primary output files and set the property reg to com true..
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you.
Thanks
Md. Marufuzzaman
|
|
|
|
|
Thank you very much Maruf. That exactly what I wanted.
|
|
|
|
|