• DİKKAT

    DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
    Altın Üyelik Hakkında Bilgi

Bilgisayarda açık kalma süresi

Katılım
14 Ağustos 2011
Mesajlar
212
Excel Vers. ve Dili
2019 TR
Bilgisayar ne kadar açık kaldıgı ve internetde ne kadar zaman geçirdiğim süreyi tutmak istiyorum bu mümkünmüdür.
 
Bilgisayar ne kadar açık kaldıgı ve internetde ne kadar zaman geçirdiğim süreyi tutmak istiyorum bu mümkünmüdür.

İnternet için birşey diyemiyeceğim ama bilgisayarın açık kaldığı süre ile ilgili kod.

Kod:
Private Declare Function GetTickCount Lib "kernel32" () As Long
Sub aciksure()
Dim h As Single, M As Single, S As Single, MS As Single
Dim strH$, strM$, strS$, strMS$
MS = GetTickCount()
MS = MS / 1000
h = Int(MS / 3600)
MS = MS - h * 3600
M = Int(MS / 60)
MS = MS - M * 60
S = Int(MS)
MS = Int((MS - S) * 10)
strH = CStr(h)
strM = Format(CStr(M), "##00")
strS = Format(CStr(S), "##00")
strMS = Format(CStr(MS), "##00")
MsgBox "Bilgisayarın açık kaldığı süre  " & Chr(10) & Chr(10) & _
strH & ":" & strM & ":" & strS & ":" & strMS, vbInformation, "uyarı"
End Sub
 
Teşekkürler hocam bu kodu userfrom userinde label veya textbox nasıl gösterebiliriz.
 
Teşekkürler hocam bu kodu userfrom userinde label veya textbox nasıl gösterebiliriz.

Label1 nesnesi için

Kod:
Private Declare Function GetTickCount Lib "kernel32" () As Long
Private Sub UserForm_Activate()
Dim h As Single, M As Single, S As Single, MS As Single
Dim strH$, strM$, strS$, strMS$
MS = GetTickCount()
MS = MS / 1000
h = Int(MS / 3600)
MS = MS - h * 3600
M = Int(MS / 60)
MS = MS - M * 60
S = Int(MS)
MS = Int((MS - S) * 10)
strH = CStr(h)
strM = Format(CStr(M), "##00")
strS = Format(CStr(S), "##00")
strMS = Format(CStr(MS), "##00")
Label1 = strH & ":" & strM & ":" & strS & ":" & strMS
End Sub
 
Hocam sanaiyesi ilerliye bilirmi rica etsem.

Bunun için en güzel çözüm userformun üzerine 1 adet Timer nesnesi eklemek eğer bu nesne sizde yoksa aşağıdaki linki inceleyin.

http://www.excel.web.tr/f167/timer-nesnesinin-kurulumu-t78713.html

Buda kod

Kod:
Private Declare Function GetTickCount Lib "kernel32" () As Long
 
 
Private Sub Timer1_Timer()
Dim h As Single, M As Single, S As Single, MS As Single
Dim strH$, strM$, strS$, strMS$
MS = GetTickCount()
MS = MS / 1000
h = Int(MS / 3600)
MS = MS - h * 3600
M = Int(MS / 60)
MS = MS - M * 60
S = Int(MS)
MS = Int((MS - S) * 10)
strH = Format(CStr(h), "##00")
strM = Format(CStr(M), "##00")
strS = Format(CStr(S), "##00")
strMS = Format(CStr(MS), "##00")
Label1 = strH & ":" & strM & ":" & strS
End Sub
 
 
Private Sub UserForm_Activate()
Timer1.Enabled = True
Timer1.Interval = 1000
End Sub
 
Dediğiniz gibi yaptım fakat Timer1 de 'varible not defined' hatası verdi
 
Tamam çok ama çok teşekkür ederim.Allah razı olsun Halit abicim.
 
Geri
Üst