AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Realtime Input? Thread?

Ein Thema von sk.Silvia · begonnen am 13. Mai 2006 · letzter Beitrag vom 14. Mai 2006
Antwort Antwort
C.Schoch

Registriert seit: 2. Jan 2006
Ort: Wüstenrot
235 Beiträge
 
Turbo Delphi für Win32
 
#1

Re: Realtime Input? Thread?

  Alt 14. Mai 2006, 13:16
You can do this with WaitForSingleObject and an Event

Your function
Delphi-Quellcode:
procedure Haf;
var i:integer;
begin
i:=0;
repeat
//////Wait///////////////////////////////////
repeat
  WaitResult := DWORD WaitForSingleObject(HANDLE hHandle, { handle of object to wait for} DWORD dwMilliseconds    { time-out interval in milliseconds}); // for Handele use "event" and you must set an timeout that the funktion returns and Messages are viewed and worked on
  if WaitResult <> WAIT_OBJECT_0 then
  begin
    Application.ProcessMessages;
  end;
until WaitResult = WAIT_OBJECT_0;
/////////////////////////////////////////////
// here you can use reset event if you want to wait contiously
  input[i]:=Edit1.text;
  i:=i+1;
until i=3;
end;
Create the event:
Delphi-Quellcode:
procedure TForm1.FormShow(Sender: TObject);
begin
event := HANDLE CreateEvent(

    LPSECURITY_ATTRIBUTES lpEventAttributes,   // pointer to security attributes
    BOOL bManualReset,   // flag for manual-reset event
    BOOL bInitialState,   // flag for initial state
    LPCTSTR lpName    // pointer to event-object name
   );
end;
Set the event:
Delphi-Quellcode:
procedure ButtonClick;
begin
SetEvent(event)
end;
Close the event:
Delphi-Quellcode:
procedure TForm1.FormClose(Sender: TObject);
begin
 CloseHandle(event)
end;
Now a lot of Pseudocode (not tested)
for additional informatin wiew the SDK.
Tschau Christian
Das System hofft auf Besserung
[Siemens]
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 04:44 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz