|
Thanks for your help everybody. I have given up on this now - 2 days of trying and got nowhere - changed every name, replaced every UUID, searched every file and yet the original name persists or the thing doesn't work at all. I have decided to spend the next 3 months rewriting it in .NET - hopefully I will never have to touch COM again.
Rugby League: The Greatest Game Of All.
|
|
|
|
|
Hi!
I have one question to ask:
If I caught an Appointment window by means of InspectorEvents & ConnectionPoints and created a popup button in the Actions menu,
how do I make the button respond to my sink event?
Thanks!
|
|
|
|
|
Please find the article:
Building an Office2K COM addin with VC++/ATL
By Amit Dey
There is very good example.
================================
Useful links
|
|
|
|
|
All,
Can someone please provide me with the code for the following:
A COM object called Person with a property of Children and a property of Name
A COM Collection of Person elements as the Children property of a Person.
I wish to be able to use the following code in VB.
Dim objP as new Person
objP.Name = "dad"
dim objC as new Person
objC.Name = "child1"
objP.Children.Add objC
for each objC in objP
msgbox objC.Name
objC.Name = "already looped through"
next objC
Apologies, I have looked everywhere and cannot find an example of a read/write collection. I tried the collection wizard(s) supplied on this site, but then none of my creation code works in VB ("cannot create object").
AAGH!
Cheers,
Kieron
|
|
|
|
|
The object objP should implement the property:
[propget, restricted, id(DISPID_NEWENUM)]<br />
HRESULT _NewEnum([out, retval] IUnknown** retval);
The property should return the IUnknown interface of an object implementing IEnumVARIANT . It is the DISPID_NEWENUM + IEnumVARIANT combination that VB/VBS uses to accomplish For Each .
If you are implementing the COM objects in C++ and ATL, you may want to take a look at the MSDN documentation for CComEnumOnSTL , and use that to implement your collection.
--
Din mamma.
|
|
|
|
|
Hi all
I have a com that uses MFC.
When I register the com in a machine with Visual Studio everything is fine. But when I try to register the com in a machine without MFC it shows a error "Not all components could be loaded". Is it because I dont have visual studio installed in the target machine. ?
What files should I deploy with MyCom.dll to make it run everywhere..?
Thanks in advance
Regards
|
|
|
|
|
use Dependency walker tool comes with visual studio to c the dependecies of ur com dll. if mfc4x.dlls are not there in the mechine , then u have to copy that...
rgds.. mil10.
|
|
|
|
|
Hi
Thank you Mil
I will try it..
Regards
Shiraz
|
|
|
|
|
Hi all
In my com I want to accept a filename and open the specified file.
The client will call
mycom->open(char * filename)
How should be my com taking care of it. ?
Please Help me...am new to com..
Regards
|
|
|
|
|
To pass a string into a COM method, use a BSTR type parameter:
e.g. HRESULT IMyComInterface::Open(BSTR Filename);
which would be called like this (error handling and COM object creation omitted for clarity):
BSTR Filename = ::SysAllocString(L"c:\\myfile.txt");
HRESULT hR = pIMyComInterface->Open(Filename);
::SysFreeString(Filename);
HTH
|
|
|
|
|
Thank you for immeadiate response
But inside my com I want to get the string back without using MFC ie CString. How do i do it ?
ie char * filename = ( BSTR convertto string) BSTR file.
Regards
|
|
|
|
|
I think I understand what you're asking, does this help?
_bstr_t Tmp(Filename);
char* pFileToOpen = Tmp.operator char*();
(where Filename is the incoming BSTR parameter)
|
|
|
|
|
Hi
Thanks for your help Rory Solley.
In fact I tried this one, which I found in some previous message posts.
/*********************************
USES_CONVERSION;
const char *text = OLE2A(BSTRstring);
*********************************/
Thanks once again.
Regards
|
|
|
|
|
A BSTR is internally a WCHAR* that points to the beginning of the string. The length of the string is placed before the first character in memory.
You can assign a BSTR to a CString simply by constructing the CString object:
CString s = CString( file );
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Rory Solley wrote:
::SysFreeString(Filename);
Are u sure you want to do this? Your client will crash on this line.
The Caller allocates a BSTR and the CALLEE(in this case the COM object) frees it on a method call.
The Caller need to allocate and free the BSTR on an Event Interface ONLY.
prashu
|
|
|
|
|
I have an ATL COM class that will have to copy itself often.
The COM class holds data internally using an STL list.
Copying the data using a SAFEARRAY or even an intermediate buffer will be a performance issue.
Why not just cast STL iterators down to ULONGs
I have defined an interface method that has two parameters. This interface is implemented by the ATL COM class in question.
The IDL
<code>
HRESULT Copy([in] ULONG Begin, [in] ULONG End );
</code>
The ATL code
<code>
STDMETHOD(Copy)( ULONG Begin, ULONG End )
{
std::list<type>::iterator it = *( (std::list<type>::iterator*) Begin );
std::list<type>::iterator sentinel = *( (std::list<type>::iterator*) End );
for( ; it != sentinel; ++it )
{
}
}
</code>
Calling the method
<code>
other->Copy( (ULONG)&m_list.begin(), (ULONG)&m_list.end() );
</code>
The ATL COM class in question is an inproc server. It probably does not need to marshall because everything runs in the same apartment. One concern is that the OS may create a surrogate process and this method may be marshalled. Will this cause problems?
Any thoughts and/or feedback appreciated!!
mike
|
|
|
|
|
Hi Guys,
Has anyone run into the issue where two custom programmed activeX controls will not run in the same application? I have ran into this morethan once in my very short activeX experience. Anyone else? ANyone know of a solution? I have tried mulitple configurations, for instance creating the controls in the same project, or in different projects, neither works. I have tried some advanced options, windowless activtion etc, but havn't hit upo the right combination.
Any help? Please? Pretty Please?
Thank all,
Jonathan Brown
|
|
|
|
|
I remember running into a commerical tool a while back that would let you take almost any windows program (the exe) and convert it to a ocx. That ocx control could then be placed in any usual activex container.
For example, you would run this on notepad.exe and get notepad.ocx that you might embed on a web page for example.
Ignoring for the sake of argument why I would want to do this, does anyone know of such a tool?
Thanks,
--Tim
|
|
|
|
|
Dear All,
So far, I have build a COM server,1 DLL. Then I use
#import "..\bin\MyCOMServer.dll"
however, the compiler, Visual C++ 6.0 tell me that:
fatal error C1083: Cannot open type library file: '..\bin\MyCOMServer.dll': No such file or directory
Any comments?
Thank you
David
|
|
|
|
|
Check your path where .tlb file and DLL exists...
Just a thought....
"is ur component registered?"
modified 21-Apr-21 21:01pm.
|
|
|
|
|
I have register it by regsrv32.exe.
However, even I explicity use the path such as follows:
#import "F:\MyProgram\MyServer.dll"
The result is same.
Any further suggestion?
|
|
|
|
|
Have you either (a) explicitly registered the type library
or (b) included it as a resource in your server DLL?
If no to both of these, try #import and specify the .TLB file, not the DLL.
Steve S
|
|
|
|
|
_David_Lee_ wrote:
#import "F:\MyProgram\MyServer.dll"
Just a thought, but shouldn't that be
#import "F:\\MyProgram\\MyServer.dll" ?
I Dream of Absolute Zero
|
|
|
|
|
#import doesn't seem to support paths with dots in. It's usually OK if the file appears in the same directory.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Have to disagree. I have lots of stdafx.h files here in many projects which use
#import "..\bin\component.tlb"
or
#import "..\bin\component.dll"
that work fine
Steve S
|
|
|
|