im not sure if this is the right place, but i couldent find anywhere else for it to go.

ive been searching this topic for ages and have found a few small helpfull things, but nothing overly usefull.
i can do the send 2 longs and add them to receive a long easily enough, and i can send a vb string to my masm dll and change it, but what i want to do is return a string that is declaired within the dll.
ive been playing with masm for a few years, nothing serious and i want to convert some vb progs accross slowly, the firsts thing i want to do is beable to send a sql query to masm from VB, have masm connect to the database and store an array of strings, ints, or whatever comes out, (probably only strings at this point) and then be able to crawl through them to find what i want or i send an index and it returns a value.

the database stuff through straight masm i have under control, its just the simple thing of getting a string from the dll into VB that seems to be a problem, everything i try seems to kill VB.

so does anyone know how to do this or any tutorials on how to move strings/structures/arrays from a dll into VB without sending them to the dll from VB to begin with?

any help would be appreciated, thanks
Paul
Posted on 2005-03-22 05:36:38 by Street_Rat
Paul,

You are in trouble with the idea of creating a string in a DLL and sending it back. It can be done by creating a string handle with OLE memory and passing back the string handle in EAX but anything created on the stack is lost on proc exit.
Posted on 2005-03-22 20:22:52 by hutch--
VB strings are not the C strings used in typical MASM programming.

VB6 uses BSTRs for strings, and there are restrictions on how they are created, if you want to export these strings to VB.
Posted on 2005-03-22 23:02:11 by tenkey
so the only way to get data out of a dll easily is to send a refrence to an item first and have the dll modify the data sent?

if so is there any way to increase the size of a string sent?
if i send a string like "Hello" from VB to the dll, and use string copy to copy another string defined in the dll over the top, it only uses the number of characters in the origional string.
ie, if i wanted to return "I made this", ill only get, "I mad" back.
does this mean i need to declare the string as a size of 255 before i send it to the dll and just send it empty?

im not too sure about sending structures/types from VB to the dll either and having them modified, but ill have a look around and see what i find on that before i bother too many people here

thanks for the help so far
Paul
Posted on 2005-03-22 23:39:03 by Street_Rat