🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.pascal.delphi.misc
Article #592

Re: DLL question

#592
From: The African Chief
Date: Fri, 05 Mar 1999 00:00
56 lines
2929 bytes
In article <4IBD2.1303$_n2.27872@carnaval.risq.qc.ca>
"Le Doute" <ledoute@sceptiques.qc.ca> wrote:

> And yet another question:
> 
> If the procedure inside the DLL takes some time to execute, how can I
> "refresh" the main app interface from time to time?
> 
> I used to write Application.ProcessMessages; or Component.Refresh; but for
> obvious reason, it doesn't work from inside the DLL...

You can use a PeekMessage loop to do the same thing - e.g.;

Procedure LetUsBreathe;
Var
  M: TMsg;
Begin
  While PeekMessage(M, 0, 0, 0, pm_Remove) do
  Begin
    If M.Message = wm_Quit Then Halt(0);
    TranslateMessage(M);
    DispatchMessage(M);
  End;
End;

> And is there a way to modify, by means of a pointer, a ProgressBar.Position
> value and to refresh it?
> 
> Usually, I would modify the progress bar value, and then refresh it or
> refresh a parent component (like the ultimate
> Application.ProcessMessages)...
> 
> If my DLL takes 2 minutes to return, I want to give some user feedback about
> what is happening...
> 
> Is there a way to achieve this without going through threads manipulation?

Pass the window handle of the progress bar (or its parent form)
to the DLL, and then post a unqiue message (e.g., Wm_MyUpdate)
containing the percentage counter, etc., from the DLL to that handle. 
In your application, you will need to subclass the form/control to
process the Wm_MyUpdate message (refer to the "Declaring message 
handlers" section of the ObjectPascal language reference).

> And would my DLL remain compatible with any calling app? written in other
> language than O. Pascal with a different IDE than Delphi?

Yes.

Best regards, The Chief
--------
Dr. Abimbola A. Olowofoyeku (The African Chief) 
Email: laa12@keele.ac.uk
Homepage: http://ourworld.compuserve.com/homepages/African_Chief/
Author of: Chief's Installer Pro v5.00 for Win32
     ftp://ftp.simtel.net/pub/simtelnet/win95/install/chief500.zip
Technical Details
Message-ID: <7bo8ag$t0i$1@cfs2.kis.keele.ac.uk>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <4IBD2.1303$_n2.27872@carnaval.risq.qc.ca>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10baee,b9a834471be510c7
X-Google-Attributes: gid10baee,public
X-Google-Thread: fd817,b9a834471be510c7
X-Google-Attributes: gidfd817,public
X-Google-Thread: f973d,b9a834471be510c7
X-Google-Attributes: gidf973d,public
X-Google-Thread: 108b0b,b9a834471be510c7
X-Google-Attributes: gid108b0b,public
X-Google-Thread: 105ac8,b9a834471be510c7
X-Google-Attributes: gid105ac8,public
X-Google-Thread: 1043cf,b9a834471be510c7
X-Google-Attributes: gid1043cf,public
From: Dr.A.Olowofoyeku@dont.spam.ac.uk (The African Chief)
Subject: Re: DLL question
Date: 1999/03/05
Message-ID: <7bo8ag$t0i$1@cfs2.kis.keele.ac.uk>
X-Deja-AN: 451498328
Distribution: world
References: <4IBD2.1303$_n2.27872@carnaval.risq.qc.ca>
Newsgroups: comp.lang.pascal.delphi.misc,alt.comp.borland-delphi,alt.comp.lang.borland-delphi,alt.lang.delphi,borland.public.delphi.objectpascal,cern.delphi.general