Hi
LockWindowUpdate is still declared in Delphi 7 in the windows.pas unit

And declared as:
{ LockWindowUpdate API }

{$EXTERNALSYM LockWindowUpdate}
function LockWindowUpdate(hWndLock: HWND): BOOL; stdcall;

Implemented as:
function LockWindowUpdate; external user32 name 'LockWindowUpdate';


The best way to test the LockWindowUpdate is:

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,
Forms,
  Dialogs, StdCtrls;

procedure TForm1.Button1Click(Sender: TObject);
var
  liK : integer;

begin
  LockWindowUpdate(Handle);
  try
    for liK := 0 to 50000 do
    begin
      {Do your stuff here}
      Label1.caption := 'Hallo ' + IntToStr(liK);
      Application.ProcessMessages;
    end;
  finally
    LockWindowUpdate(0);
  end;
end;

This should only update the form once it finished the loop
To test it the other way just comment out the lockwindowupdate method
call, and execute the application.

But the error message defines the error as:
The compiler could not find the given identifier - most likely it has
been misspelled either at the point of declaration or the point of use.
It might be from another unit that has not mentioned a uses clause.

I would use it in the following way, because possibly the Handle
property value is where the problem lies.

uses
  Forms, windows, Unit1, SysUtils;

type
  TOwn = class
  private
    FAForm: TForm;
    procedure SetAForm(const Value: TForm);
  public
    procedure UpdateTest;
  published
    property AForm : TForm read FAForm write SetAForm;
  end;

procedure TOwn.UpdateTest;
var
  liK : integer;

begin
  LockWindowUpdate(AForm.Handle);
  try
    for liK := 0 to 50000 do
    begin
      {Do your stuff here}
      TForm1(AForm).Label1.caption := 'Hallo ' + IntToStr(liK);
      Application.ProcessMessages;
    end;
  finally
    LockWindowUpdate(0);
  end;
end;


Hope it helps?
Which version of Delphi R U using?

Cheers
Johan Fourie



NOTICE: Please note that this eMail, and the contents thereof, is subject to 
the standard arivia.kom email disclaimer which may be found at:  
http://www.arivia.co.za/internet/disclaimer.htm.  If you cannot access the 
disclaimer through the URL attached, and you wish to receive a copy thereof, 
please send an eMail to [EMAIL PROTECTED] or call (011) 233-0800. You will 
receive the disclaimer by return email or fax.




_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

Reply via email to