Hi to all,
I have a DLL that contains a form. I'm trying to pass a single variable to the form of the DLL so it can be displaied in a component on it. Can someone tell how to do this! I'd like to use a procedure instead of a function.
Thanks!
And here is the event handler that calls the create procedure from another program:
procedure TForm1.Button1Click(Sender: TObject);
var num: integer;
begin
try
num:= StrToInt(Edit1.Text);
except
num:= 0;
end;
DllForm1Create;
VarShow(num);
end;
The problem is that the procedure VarShow is been calling after the destroy of the form in the DLL. I' ve tried to pass the variable into the DLLForm1Create procedure but it did not work.
Thanks alot!
There's no reason why you shouldn't be able to pass a parameter into your form creation routine. I just tested the following code and it worked fine, what error were you getting?
As a little aside, rather than putting your StrToInt statement in a try..except block you can use StrToIntDef, in which you provide a default value for use in case of an error. It basically does the same thing but with one line.
Thanks alot for all!
It worked just fine. The error was that I had the Form1.showModal statement first and then I was calling the VarShow procedure.
Maybe you could explain to me why am I getting another form in windows task bar though I use a modal form.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.