Good Easter to you all!!

I have a question about how to "EXPORT" a variable simbol from an assembly written DLL to a VB6 EXE.

I can obviously export functions and also receive a string from VB and manipulate it into my DLL but I cannot pass it back!

I could store the results of my elaborations into a series of variables in the DLL Data segment and then write a function that I call from VB with the index of the corresponding variable...but it is not pratical. If I have 200 variables I must call the function 200 times to read all them!

I am sure it is possible to access directly this memory area, perhaps by a structure, because VB uses its own implementation of arrays and string...

That's all because I want to do the hard work in assembly, quickly, and then use the advantages of VB in transferring those data to an Excel sheet...

Thank you a lot!
Posted on 2003-04-20 02:56:17 by fooCoder

I don't think you can directly handle addresses in VB unless it has changed a lot recently. Is there a way you can directly write to the Excel spreadsheet without needing to go through VB ?

If you can you will avoid the problem.

Posted on 2003-04-20 03:28:10 by hutch--
you have two options if you want to be able to read changed data back in VB:

- pass your string in ByRef. This will pass the pointer to a BSTR to your asm function (VB uses BSTR's internally)

- pass a byte array ByRef, this will pass the pointer to an array of bytes. You can then manipulate this at will, and if necessary reassemble it into a string back in VB.
Posted on 2003-04-20 06:21:25 by sluggy
Thank you guys.

sluggy, you give me the idea of experimenting with arrays and string....I' ve done it and posted in another thread my results.

hutch, you are right, visual basic has its own limitations...I would like to do the hard work in assembly but, because the lack of official documentation and time, it is often difficult to accomplish the same task...

For example, if I could translate this piece of code (by COM) in asm I would be the happiest man over this earth!:) :) :)

Dim FileExcel As Workbook
Dim foglioExcel As Worksheet

' Open the file
Set FileExcel = Excel.Workbooks.Open(App.Path & "\Stats36Tris.xls")
' Select the sheet
Set foglioExcel = FileExcel.Worksheets("North")

' Write value to cell
foglioExcel.Cells(6, 14) = 100

' Close all
Set FileExcel = Nothing
Set foglioExcel = Nothing
' It prompts asking to confirm changes


Posted on 2003-04-22 03:57:52 by fooCoder