Avatar of irenicus
irenicus
 asked on

dll & application handlers

I am new with application handlers and have the following problem:

I am using using a dll for some more often used procedures. These functions include a form. Problem is that the form closes after completing the first procedure executed. Problem is that i dont want that, it has to be closed AFTER completing the procedure and AFTER i click a close button

programma code

[code ]

type
  TLibSIKBprotocolExportPakketten = procedure; stdcall;

..

procedure TForm1.Button1Click(Sender: TObject);
var
  LibHandle:THandle;
  CallExportAanvraagPakketten:TLibSIKBprotocolExportPakketten;
begin
  LibHandle:=LoadLibrary('PDlltest.dll');
  if LibHandle = 0 then
    ShowMessage('Kan PDlltest.dll niet laden');
  try
    CallExportAanvraagPakketten:=GetProcAddress(LibHandle,'ExportAanvraagPakketten');
    CallExportAanvraagPakketten;
  finally
    FreeLibrary(LibHandle);
  end;
end;

[/code]

dll code

[code ]

procedure ExportAanvraagPakketten; stdcall;
begin
  try
    FormAanvraagAnalysePakketten:=TFormAanvraagAnalysePakketten.Create(nil);
    try
      FormAanvraagAnalysePakketten.StartExportAnalysePakketten;
      FormAanvraagAnalysePakketten.close;
    finally
      FormAanvraagAnalysePakketten.Free;
    end;
  except on E: Exception do
    MessageDLg('De volgende fout is opgetreden:'+#10+
               E.Message +#10+
               'Foutcode: '+IntToStr(E.HelpContext),mtWarning,[mbOK],0);
  end;
end;

[/code]

I already heard that is has something to do with sending the application handler, but how to do this? Any help is appreciated.

Delphi

Avatar of undefined
Last Comment
kacor

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
pderuiter

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
CleanupPing

irenicus:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
kacor

No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area for this question:
       to accept pderuiter's answer
Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Some days and here is the Christmas Time. I wish good luck and good health for you all and for your loved ones

kacor
EE Cleanup Volunteer
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck