Bir Adet Checkbox koy ve kanka isminide Başlangıçta otomatik çalıştırır fian yap eğer onu tiklersen başlangıçta otomatik çalıştırır bunu istersen form1e yap checkbox işaretlemedn otomatik filan yapılablilr
BAŞLANIÇTA OTOMATİK ÇALIŞTIRMA
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace FORMAKOYDUĞUNİSİM
{
public partial class Form1 : Form
{
string ProgramAdi = "GÖREVYÖNETİCİSİNDEKİGÖZÜKÜCEKİSİM";
public Form1()
{
InitializeComponent();
try
{
RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true);
if (key.GetValue(ProgramAdi).ToString() == "\"" + Application.ExecutablePath + "\"")
{
chckAcilistaCalistir.Checked = true;
}
}
catch
{
}
}
private void CHECKBOXİSMİ_CheckedChanged(object sender, EventArgs e)
{
if (CHECKBOXİSMİ.Checked)
{
RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true);
key.SetValue(ProgramAdi, "\"" + Application.ExecutablePath + "\"");
}
else
{
RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run",true);
key.DeleteValue(ProgramAdi);
}
}
}
}
SÜRE İÇİN
public string PC_AÇIKKALMASÜRESİ()
{
String cevap = String.Empty;
cevap += Convert.ToString(Environment.TickCount / 86400000) + " gün, ";
cevap += Convert.ToString(Environment.TickCount / 3600000 % 24) + " saat, ";
cevap += Convert.ToString(Environment.TickCount / 120000 % 60) + " dakika, ";
cevap += Convert.ToString(Environment.TickCount / 1000 % 60) + " saniye.";
return cevap;
}
Timer ekle intervalini 1000 olarak ayarla yani 1 saniyeee buton ekle ve butonada timer1 bunuda detaylı olarak anlatıyım o üsteki kodu timera yaz buton ekle butonada bu kodları ekle dostum
private void button1_Click(object sender, EventArgs e)
{
timer1.Interval = 1000;
timer1.Enabled = true;
}