|
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
|
|
|
|
|
Hi,
I'm working on an intranet site where users can bring up their excel spreadsheet (accounting template) and complete their quarterly numbers. It was easy to create this page by taking the xls file in Windows Explorer and dropping it on a FrontPage web page. Really neat stuff, it looks and acts just like excel but with many limitations. I want the users to enter their info in and then save the spreadsheet - not to their computer (which they can by clicking on the export button which goes to excel) but back to the web server. Does anyone have any suggestions on how to do this with an existing spreadsheet/workbook? Any example code?
Thanks,
Mike
|
|
|
|
|
Hi there,
Can We have same ProgId for two different compoenents?
If yes,
(say "MyApp.MyDll.1" is the ProgId for both Components)
Then what will happen if an application is using "MyApp.MyDll.1"?
modified 21-Apr-21 21:01pm.
|
|
|
|
|
No. Only the component that was registered last would have it.
Edward
|
|
|
|
|
You can, however have a version-independent ProgID. If someone requests that ProgID, it'll use the version specified in the CurVer subkey.
For example, you have 3 versions of a COM object: MyApp.MyObject.1 , MyApp.MyObject.2 , and MyApp.MyObject.3 . You can have a ProgID of MyApp.MyObject , and if you want them to use version 3, set the CurVer 's default value to MyApp.MyObject.3 .
|
|
|
|
|
Thanx.
ian mariano wrote:
"We are all wave equations in the information matrix of the universe"
I liked ur quote
Have a nice day.
modified 21-Apr-21 21:01pm.
|
|
|
|