Using Dll created with Delphi in Excel



Hi all,

Delphi's Dll:

library ProjektiList;

type
....
function GetProjectText(Nro:Integer):String;

function GetProjectText(Nro:Integer):String;
begin
...
Showmessage(IntToStr(Nro));
result:='Hello?!'
end;



Excel macro:

Private Declare Function GetProjectText Lib "ProjektiList.dll" _
(ByVal nProNro As Integer) As String
Private Const nProNro = 7223

Public Function GetProjectName() As String

ActiveCell.Value = GetProjectText(nProNro )

End Function


It does not work! Showmessage shows something totally different than 7223.
And after excel crashes...

Program versions; Delphi = 2006, Excel = 2007

Does anyone has simple enough example even for me to understand?

-Hasu


.