473,399 Members | 4,177 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

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
http://www.flipcode.com/articles/article_vbdlls.shtml

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(dllexport) CALLBACK StructExample(testStruct *data)
{
data->shortVar = 1;
data->ucharVar = 'b';
data->floatVar = (float)3.4;

data->stringVar = ChartoBSTR("Overwrite");
}

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

MultiByteToWideChar(CP_ACP,
0,
String,
Len,
FinalStr,
Len);

return(FinalStr);
}

Jul 19 '05 #1
1 3250
"Yelve Yakut" <ye***@gmx.de> wrote in message
news:9l********************************@4ax.com...
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
Please see:
http://www.slack.net/~shiva/welcome.txt
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.


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
Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.