Ceriwis  

Go Back   Ceriwis > HOBI > Komputer & Teknologi > Programming

Programming Share, tanya jawab, saling bantu antar programmer dengan berbagai macam bahasa pemrograman.

Reply
 
Thread Tools
  #1  
Old 11th November 2011
Braincode's Avatar
Braincode Braincode is offline
Ceriwis Addicted
 
Join Date: Nov 2011
Posts: 4,638
Rep Power: 20
Braincode mempunyai hidup yang Normal
Default HELP: auto log off program dengan Delphi

Agan.. agan sekalian ada yang pernah bikin auto log off software yang dibikin pake delphi? Ceritanya ketika software itu sedang idle selama waktu yang ditentukan ex. 5 menit maka otomatis log off...



THX AGAN-AGAN SEMUA...SAYA DAH NEMU SOLUSINYA

pake TApplication event onmessage dan juga pake TTimer interval 1000 event onTimern


Code:

.....
var
frmMain: TfrmMain;
idletime : integer;
....

procedure TfrmMain.ApplicationEvents1Message(var Msg: tagMSG;
var Handled: Boolean);
begin
Case msg.message of
WM_KEYFIRST..WM_KEYLAST, WM_MOUSEFIRST..WM_MOUSELAST :
idletime:=0
end;
end;

procedure TfrmMain.Timer1Timer(Sender: TObject);
begin
inc(idletime);
Label1.Caption := Format('System IDLE last %d seconds', [idletime]) ;
if idletime=10 then
begin
Timer1.Enabled:= false;
idletime:=0;
//procedure logout
logout;
end;
end;
....









Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


 


All times are GMT +7. The time now is 03:20 AM.


no new posts