Ho un problema che mi porto avanti da oramai molto tempo e che non
sono riuscito ancora a risolvere.
Per questo motivo non ho ancora passato il programma a 32 bit,
attualmente e' a 16 bit.
SITUAZIONE INIZIALE:
Una funzione in VB che, chiamando una DLL in Delphi, gli passa un
array di stringhe da poter modificare.
A 16 bit funziona tutto correttamente, passando a 32 bit la situazione
si complica NOTEVOLMENTE, per la diversa gestione delle stringhe.
Infatti viene mostrato solo la prima stringa.
Di seguito riporto il codice in Visual Basic 4 e quello in Delphi:
N.B. Ricordo che posso usare solo VB4 a 32 (non VB5 o 6).
CHI RISOLVE QUESTO ENIGMA E' UN GENIO (SECONDO ME,SECONDO ME) !!
VB4:
Type tag_StrutStr
MiaStr As String * 255
End Type
Declare Function FunzDLLStringhe Lib "miadll.dll" Alias "#1" (ByRef
mioarr As tag_StrutStr) As Long
sub MiaFunzVB()
Dim ArrayStringhe(5) as tag_StrutStr
dim Ind%
'Dimensiono le stringhe
For Ind%=0 to 4
ArrayStringhe(Ind%) = space$(255)
Next
'Chiamo la funzione in Delphi
call FunzDLLStringhe(ArrayStringhe(0))
'Visualizzo le Stringhe
msgBox ArrayStringhe(0)
msgBox ArrayStringhe(1)
msgBox ArrayStringhe(2)
....
end sub
DELPHI:
type
Tag_PaoStr = record
MiaStr : string[255];
end;
A_PARAMETRI_STR = array[0..5] of Tag_PaoStr;
PTR_PARAMETRI_STR = ^A_PARAMETRI_STR;
Function FunzDLLStringhe (mioarrStr: PTR_PARAMETRI_STR):longint;
export; stdcall;
implementation
procedure FunzDLLStringhe(mioarrStr:PTR_PARAMETRI_STR);
begin
mioarrStr^[0].MiaStr := 'Prima Stringa';
mioarrStr^[1].MiaStr := 'Seconda Stringa ';
mioarrStr^[2].MiaStr := 'Terza Stringa ';
end;
Vi posso assicurare che ho fatto una MAREA di prove.
Ho persino fatto una funzioncina in assembler per andare amettere
l'indirizzo giusto!!!
Infatti sembra che cosi' viene solo passato la prima stringa!
Sembra facile ma non lo e'.
Confido in voi per una soluzione che mi faccia andare avanti.
Se lo risolvete vi pago da bere, come minimo. :-)))
Grazie mille.
Paolo