Konu: uygulamayı kapatmak
belli bir süre klavye ve mouse kullanılmadığını nasıl anlarım?
kullanılmadığında programı otomotik sonlandırmak istiyorum. kullanıcının nekadar süreyle klavye yi kullanmadığını nasıl tesbit ederim?
Giriş yapmadınız. Lütfen giriş yapın yada kayıt olun.
belli bir süre klavye ve mouse kullanılmadığını nasıl anlarım?
kullanılmadığında programı otomotik sonlandırmak istiyorum. kullanıcının nekadar süreyle klavye yi kullanmadığını nasıl tesbit ederim?
CHRSAW([nSeconds])
Parameters
nSeconds
Specifies the time in seconds that CHRSAW( ) waits before checking the keyboard buffer. The keyboard buffer is checked immediately if you omit nSeconds. Including nSeconds lets you use CHRSAW( ) for a variety of timed activities. For example, your program can close an application if a key hasn't been pressed for a specific number of seconds.
Return Value
Logical
Remarks
CHRSAW( ) returns True (.T.) if a character is present in the keyboard buffer, and False (.F.) if not. CHRSAW( ) doesn't affect the keyboard buffer contents.
Example
In the following example, the system displays a window containing input fields created with @ ... GET commands, and waits 5 seconds for keyboard input. If a key isn't pressed in this time period, CHRSAW( ) returns False (.F.) and the program terminates.
Copy Code
SET TALK OFF
DEFINE WINDOW wEnter FROM 7,10 to 13,70 PANEL
ACTIVATE WINDOW wEnter
@ 1,3 SAY 'Customer: ' GET gcCustomer DEFAULT SPACE(40)
@ 3,3 SAY 'Address: ' GET gcAddress DEFAULT SPACE(40)
WAIT WINDOW 'Waiting for input' NOWAIT
IF NOT CHRSAW(5)
DEACTIVATE WINDOW wEnter
CLEAR GETS
ELSE
READ
DEACTIVATE WINDOW wEnter
ENDIF
RELEASE WINDOW wEnter
WAIT
CLEAR
***
bu olabilirmi acaba
Uygulamayı otomatik kapatmak için aşağıdaki kodu yazdım, çok uzun uzadıya test etmedim ama iş görebilir. Klavye veya mouse, verilen interval süresi içinde kullanılmazsa programdan otomatik çıkarıyor. Programı açık bırakıp giden kullanıcılar için kullanılabilir.
Dikkat : Uzun sürecek rapor veya data process işlemleri için peşpeşe çalışacak komut satırları varsa timer ın satır aralarında devreye girip programı kesmemesi için _Screen.o_screen_timer1.Enabled = .F. yapılmalı.
_Screen.o_screen_timer1.Enabled = .F.
Çalışacak Komut Satırları.
_Screen.o_screen_timer1.Enabled = .T.
1 | _screen.AddObject("o_screen_timer1","_screen_timer1") |
Son düzenleyen, foxman (15.01.2009 12:09:45)
Buda dakika ile çalışanı.
Bilgisayarı fazla meşgul etmesini istemiyorsanız interval değerini yükseltebilirsiniz.
1 | _Screen.AddObject("o_screen_timer1","_screen_timer1") |
Son düzenleyen, foxman (15.01.2009 13:21:29)