Hello Neven,
U gotta be a wee bit careful about sleep, how u use it.
Here is one method that works well for me:
procedure Delay(ms: dword);
var
  TheTime, tenth: dword;
begin
  TheTime := GetTickCount + ms;
  Tenth := 0;
  while GetTickCount < TheTime do
  begin
    sleep(1);
    inc(tenth, 1);
    if tenth > 99 then
    begin
      tenth := 0;
      application.processmessages;
    end;
  end;
end;

or another way:

function YieldProcess: Boolean;
var
  msg: TMsg;
begin
  while PeekMessage(msg, 0, 0, 0, PM_REMOVE) do
    begin
      if msg.message = WM_QUIT then
        begin
          PostQuitMessage(msg.wParam);
          Result:= True;
          EXIT;
        end
      else
        begin
          TranslateMessage(msg);
          DispatchMessage(msg)
        end
    end;
  Result:= False;
end;

_______________________________________________
Delphi mailing list
[EMAIL PROTECTED]
http://ns3.123.co.nz/mailman/listinfo/delphi

Reply via email to