-
February 17th, 2000, 01:11 PM
#1
custom build vs. automation error
I build a ATL COM dll using MFC as shared dll. This dll is used by a VB dll, which is called by VB exe.
The VC dll is OK when used by VB project on the same machine (when build vc dll, it is registered by compiler at the same time). But when install VB exe to other machine, the install program (install shield) failed to register the VC dll (same when registor the dll after manually) and when run VB exe and got automation error.
I guess I have to do something on VC project->settings->custom build, but how? Do locations of VC dlls, VB dlls and exeutables matter? Any help would be appreciated. Thanks.
-
February 18th, 2000, 03:06 AM
#2
Re: custom build vs. automation error
Hi
I think you can use two way to do:
1) You can link MFC as static library and compile your companent with MinDependency.
2) You can install MFC shared DLL with your product. Expecialy draw attention to ATL.dll, your can install and register it. You companent use ATL.dll by COM interface in default.
Helped ?
Regards.
-
February 18th, 2000, 04:18 PM
#3
Re: custom build vs. automation error
Thanks.
I tried the first option and the dll can be registered, but dll functions inside don't work properly, especially those dealing with BSTRs.
I am going to try the second option you suggested.
-
February 24th, 2000, 03:53 AM
#4
Re: custom build vs. automation error
Hi
Are you sure, then trouble in first method tied with BSTR? BSTR is basic standart, and i often use it and never had any problem.
Regards
-
February 24th, 2000, 10:41 AM
#5
Re: custom build vs. automation error
Yes. I have some methods to process sent in BSTR. But when I cast BSTR into LPSTR and compiled with
MinDependency mode, I get garbage afterwards. Such as:
USES_CONVERSION;
LPSTR pChar;
pChar = (LPSTR)bStrKey;
while bStrKey is sent in BSTR, might from VB client. pChar is OK if compiled with debug version. Something is missing with this Macro during the compilation?
-
February 24th, 2000, 10:51 AM
#6
Re: custom build vs. automation error
Also, be sure to use the correct version of ATL.DLL -- there's one for Win95/98, and one for NT. The Redist directory on your VC6 CDs has them both.
-
February 24th, 2000, 11:11 AM
#7
Re: custom build vs. automation error
Oh i think you wrong convert BSTR to LPSTR. Only not (LPSTR)...
If you use conversion, then W2A, but it convert from unicode to ansi... I never use USES_CONVERSIONS, try like this :
CString CStr;
LPSTR pszStr;
CStr = bstrStr;
pzsStr = CStr;
It worked correct in all case.
Also try _bstr_t
_bstr_t CStr;
LPSTR pszStr;
CStr = bstrStr;
pzsStr = CStr;
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|