Hi list,
I'm having a slight problem understanding the scope of variables when passed
to Delphi DLL procedures which then activate forms.
Essentially what I'm doing is this (simplified version):
--------------------------------------------------------
I have a MB procedure called MyProc_MB which calls a Delphi4 DLL procedure
MyProc_D(hWnd, MyVarible). I'm passing both parameters by reference.
MyProc_D then activates a form with a text box, and shows the contents of
MyVariable in that text box. At this point MyProc_D dies and MyVaraible
along with it - control is now passed to the form.
The user now makes text changes to the text box.
My problem is this:
-------------------
When the user presses the close button on the form I want those text changes
to register back in MyVaraible. But I can't do this because the scope of
MyVariable was confined to MyProc_D which is already dead.
I tried solving the scope problem with pointers but only got myself into
more trouble.
Any suggestions would be greatly appreciated.
Thanks,
Peter Zyczynski
Analyst Programmer
Landfile Consultancy
Australia
Ph: (03) 6244-7344
email: [EMAIL PROTECTED]
In MapBasic:
------------
MyProc_MB
Call MyProc_D(hWnd, MyVariable)
In Delphi DLL:
--------------
MyProc_D(hWnd:longint, var MyVariable:Pchar);
begin
Application.Handle := hWnd;
MyForm := TMyForm.Create(Application);
MyForm.TextBox1.Text := MyVariable;
End;
TMyForm.btnCloseClick(Sender: TObject);
Begin;
MyVariable := StrPCopy(MyVaraible, MyForm.TextBox1.Text);
//Obviously I can't do this because MyVaraible is already dead.
End;
_______________________________________________________________________
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, send e-mail to [EMAIL PROTECTED] and
put "unsubscribe MapInfo-L" in the message body.