Windows(Cpp>>DLL<<VB6)

Y

Yelve Yakut

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);
}
 
M

Mike Wahler

Yelve Yakut said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,787
Messages
2,569,629
Members
45,330
Latest member
AlvaStingl

Latest Threads

Top