CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Jun 1999
    Posts
    28

    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.


  2. #2
    Join Date
    Feb 2000
    Posts
    81

    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.


  3. #3
    Join Date
    Jun 1999
    Posts
    28

    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.


  4. #4
    Join Date
    Feb 2000
    Posts
    81

    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


  5. #5
    Join Date
    Jun 1999
    Posts
    28

    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?


  6. #6
    Join Date
    Oct 1999
    Location
    Broomfield, CO
    Posts
    3,382

    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.


  7. #7
    Join Date
    Feb 2000
    Posts
    81

    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
  •  





Click Here to Expand Forum to Full Width

Featured