I had created a dll with the MFC Wizard (Project of the type Win32 Dynamic-Link Library). This dll had just one function call in it as shown below.
__declspec (dllexport) __int32 pipt_teste( __int32 *pt )
*pt = 50;
And then I tried to use it in my delphi program.
In the mainframe I created a menu option called 'Test', and then when this option was called it create a form dynamically with a button in it. When the button was activated, it call the pipt_teste. The code is shown below:
function pipt_teste( pTeste : Pointer ) : Integer; stdcall; external 'prjDLL.dll'
procedure TFrm.BtOkClick(Sender: TObject);
teste : Integer;
if pipt_teste( @teste ) then
modalResult := mrOk
modalResult := mrAbort;
What happening was, after calling the pipt_teste function, something was lost, the modalResult was not available more, the same happened to all attributes within the class.
What is wrong with my code?
Thanks for the help.