AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Multimedia Delphi flood text Protection
Thema durchsuchen
Ansicht
Themen-Optionen

Delphi flood text Protection

Ein Thema von drama22 · begonnen am 4. Nov 2014 · letzter Beitrag vom 5. Nov 2014
Antwort Antwort
drama22

Registriert seit: 12. Jan 2013
88 Beiträge
 
#1

Delphi flood text Protection

  Alt 4. Nov 2014, 21:22
hi i decided to add some flood protection to my chat application so i do something like this
Delphi-Quellcode:
begin
if IsFlood then
  begin
  ShowInfo('Anti-Flood', 20);
  Exit;
end;
end;
Delphi-Quellcode:
procedure TMAIN.ShowInfo(Text: string; Waiting: Integer);
var
  Rect: TRect;
begin
  GetWindowRect(self.Smilebtn.Handle, Rect);
  with pnlFlood do
    begin
      Caption := ' ' + Text + ' ';
      Width := self.Canvas.TextWidth(Text) + 40;
      Left := weblog.Left + 1;
      Top := weblog.Height - Height;
      if TB1.Visible then Top := Top-TB1.Height else Top := Top+TB1.Height;
      Visible := True;
      FloodpSay := 0;
      msgTmr.Enabled := True;
    end;
  FloodClose := Waiting;
end;
basically i have created a unit function called IsFlood and i adjust some visual alert to it here is my is flood unit

Delphi-Quellcode:
unit checkFlood;

  interface
  uses Windows;

  function IsFlood:Boolean;


  var
  LastFloodTime : Integer;
  floods:integer;

  implementation

 function IsFlood:Boolean;
  var
  i, x : integer;
  begin
    Result := False;
    i := trunc(GetTickCount/2);
    x := trunc((i - LastFloodTime)/4);
    Result := False;
if x < //detect flood// then Result := True;
    LastFloodTime := i;
  end;

end.
but i cant detect the fast typing ,, what iam doing wrong any help ?

Geändert von drama22 ( 5. Nov 2014 um 12:55 Uhr)
  Mit Zitat antworten Zitat
Benutzerbild von Sir Rufo
Sir Rufo

Registriert seit: 5. Jan 2005
Ort: Stadthagen
9.454 Beiträge
 
Delphi 10 Seattle Enterprise
 
#2

AW: Delphi flood text Protection

  Alt 4. Nov 2014, 22:17
What result do you expect from IsFlood and please show the line in code where you set this expected result.
Kaum macht man's richtig - schon funktioniert's
Zertifikat: Sir Rufo (Fingerprint: ‎ea 0a 4c 14 0d b6 3a a4 c1 c5 b9 dc 90 9d f0 e9 de 13 da 60)
  Mit Zitat antworten Zitat
drama22

Registriert seit: 12. Jan 2013
88 Beiträge
 
#3

AW: Delphi flood text Protection

  Alt 4. Nov 2014, 22:33
What result do you expect from IsFlood and please show the line in code where you set this expected result.
i didnt figure the result part i need help with it i was thinking to do somthing like that with is flood

Delphi-Quellcode:
  function IsFlood:Boolean;
  var
  i, x : integer;
  begin
    Result := False;
    i := trunc(GetTickCount/2);
    x := trunc((i - LastFloodTime)/4);
    Result := False;
if x < //detect flood// then Result := True;
    LastFloodTime := i;
but dont know how to detect the flood i use also in main form private declarations

Delphi-Quellcode:
    FloodpSay : integer;
    FloodClose : Integer;
but i cant figure what to do to detect the fast typing and thats what iam doing with the timer

Delphi-Quellcode:
procedure Tmain.msgTmrTimer(Sender: TObject);
begin
  msgTmr.Enabled := False;
  FloodpSay := FloodpSay + 1;
  if FloodpSay > FloodClose then
    begin
      pnlFlood.Visible := False;
      FloodpSay := 0;
    end;
  if FloodpSay <> 0 then
    msgTmr.Enabled := True;
end;
  Mit Zitat antworten Zitat
Benutzerbild von Sir Rufo
Sir Rufo

Registriert seit: 5. Jan 2005
Ort: Stadthagen
9.454 Beiträge
 
Delphi 10 Seattle Enterprise
 
#4

AW: Delphi flood text Protection

  Alt 4. Nov 2014, 23:21
What result do you expect from IsFlood and please show the line in code where you set this expected result.
i didnt figure the result part i need help with it
You should have added this important information just the first post. We are not able to look into your brain and working crystal balls are very rare

Also you did not describe what you are really want. Yes, detect flooding ... nice

Describe your definition of flooding and under what circumstances should the function IsFlood return true .
Describe it as precise as possible otherwise we are not able to help.

BTW Did you got a solution for http://www.delphipraxis.net/182563-d...ml#post1278303
Kaum macht man's richtig - schon funktioniert's
Zertifikat: Sir Rufo (Fingerprint: ‎ea 0a 4c 14 0d b6 3a a4 c1 c5 b9 dc 90 9d f0 e9 de 13 da 60)
  Mit Zitat antworten Zitat
drama22

Registriert seit: 12. Jan 2013
88 Beiträge
 
#5

AW: Delphi flood text Protection

  Alt 5. Nov 2014, 00:01
ok , now i have chat application and possibly the client are sending messages to each others , so he type his message and press on send button to send his message if he press the send button repeatedly his message will flood The text box so i think about it and i thought that i have to adjust when he click on send button and pause send operation if his click on send button Too fast , maybe my implementation was very wrong for this purpose

Geändert von drama22 ( 5. Nov 2014 um 15:11 Uhr)
  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 19:48 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz