Windows(Cpp>>DLL<<VB6)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Yelve Yakut

    Windows(Cpp>>DLL<<VB6)

    Hello,

    I am currently messing around with some sample code I found
    It is about linking VB and CPP through DLL's


    There is a string embaded in a strunct.
    There is a function in a DLL that takes this struct.
    This struct comes from a Visual Basic application.
    My code changes this string.
    But when I output the string in VB i can only see its first character.

    I'm trying it for two hours now, any suggestions on this would help.

    Thanks for the help in advance


    void __declspec(dlle xport) CALLBACK StructExample(t estStruct *data)
    {
    data->shortVar = 1;
    data->ucharVar = 'b';
    data->floatVar = (float)3.4;

    data->stringVar = ChartoBSTR("Ove rwrite");
    }

    ////////// Convert a Character Array to a BSTR String //////////
    BSTR ChartoBSTR(char * String)
    {
    int Len = strlen(String);
    unsigned short FinalStr = new unsigned short[Len];

    MultiByteToWide Char(CP_ACP,
    0,
    String,
    Len,
    FinalStr,
    Len);

    return(FinalStr );
    }

  • Mike Wahler

    #2
    Re: [OT, welcome msg, links] Windows(Cpp&gt; &gt;DLL&lt;&lt; VB6)

    "Yelve Yakut" <yelve@gmx.de > wrote in message
    news:9lm6ov8shu eo3vujeccv21q43 5h7bkke33@4ax.c om...[color=blue]
    > Hello,
    >
    > I am currently messing around with some sample code I found
    > It is about linking VB and CPP through DLL's
    > http://www.flipcode.com/articles/article_vbdlls.shtml[/color]

    Please see:

    [color=blue]
    > There is a string embaded in a strunct.
    > There is a function in a DLL that takes this struct.
    > This struct comes from a Visual Basic application.
    > My code changes this string.
    > But when I output the string in VB i can only see its first character.
    >
    > I'm trying it for two hours now, any suggestions on this would help.[/color]

    Try asking in newsgroups which discuss any or all of
    Microsoft Windows, Visual Basic, and "DLL"s.

    Only ISO standard C++ is topical here.
    You can use e.g. www.groups.google.com and/or www.usenet.org
    to locate newsgroups about these topics.

    Also, www.msdn.microsoft.com has links to groups about
    Microsoft products and technologies. That site also
    has literally thousands of technical articles about
    Windows programming.

    -Mike


    Comment

    Working...