Autor Beitrag
xi23
Hält's aus hier
Beiträge: 13



BeitragVerfasst: Sa 17.08.02 16:07 
hi,
Ich habe ein Delphi Projekt ohne vordefiniertes Delphi TApplication Model und ohne ein Formular erstellt. Ich erstelle ein Formular selbst mit CreateWindowEx und verarbeite die Nachrichten mit MainWndProc und Get,Translate und Dispatch Message.
Ich will nun ein Sleep schreiben welches die Programmverarbeitung nicht unterbricht, diesen effekt konnte man mit Application.Processmessage erreichen.
GPF
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 85



BeitragVerfasst: So 18.08.02 02:24 
Folgender Codeschnipsel stammt aus den Delphi 5 Sources. Ich hoffe ich verstoße damit nicht gegen irgendwelche Copyrightrechte:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
function TApplication.ProcessMessage(var Msg: TMsg): Boolean;
var
  Handled: Boolean;
begin
  Result := False;
  if PeekMessage(Msg, 0, 0, 0, PM_REMOVE) then
  begin
    Result := True;
    if Msg.Message <> WM_QUIT then
    begin
      Handled := False;
      if Assigned(FOnMessage) then FOnMessage(Msg, Handled);
      if not IsHintMsg(Msg) and not Handled and not IsMDIMsg(Msg) and
        not IsKeyMsg(Msg) and not IsDlgMsg(Msg) then
      begin
        TranslateMessage(Msg);
        DispatchMessage(Msg);
      end;
    end
    else
      FTerminate := True;
  end;
end;

procedure TApplication.ProcessMessages;
var
  Msg: TMsg;
begin
  while ProcessMessage(Msg) do {loop};
end;

_________________
"Wenn Debugging ein Vorgang ist, Fehler aus einem Programm auszubauen, dann ist Programmieren der Vorgang, Fehler einzubauen."
toms
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1099
Erhaltene Danke: 2



BeitragVerfasst: So 18.08.02 07:42 
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
function ProcessMessages: Boolean; 
var 
  Msg: TMsg; 
begin 
  Result := False; 
  while PeekMessage(Msg, 0, 0, 0, PM_REMOVE) do  
  begin 
    if Msg.Message = WM_QUIT then  
    begin 
      Result := True; 
      PostQuitMessage(Msg.wParam); 
      Exit; 
    end {If} 
    else 
      if not IsDialogMessage(GetActiveWindow, Msg) then 
    begin 
      TranslateMessage(Msg); 
      DispatchMessage(Msg); 
    end; {Else} 
  end; {While} 
end;