troubleshooting Question

dll & application handlers

Avatar of irenicus
irenicus asked on
Delphi
3 Comments1 Solution209 ViewsLast Modified:
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.

ASKER CERTIFIED SOLUTION
pderuiter

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros