Shain_K Posted June 2, 2015 Share Posted June 2, 2015 USB leri 3 dakikada bir kontrol eden ve taşınabilir bir depolama aygıtı takıldığı nalaşıldığında “Depolama aygıtınızı unutmayınız” diye 5 dakikada bir sesli uyarı veren program yapmak istiyorum.şu ana kadar usb algılama olayını hallettim fakat timer kullanımını yapamadım yardımcı olurmusunuz? kodum: [spoiler]public partial class Form1 : Form { bool usbhazir = true; public Form1() { InitializeComponent(); } protected override void WndProc(ref Message m) { if (m.Msg == 0x219) { usbhazir = true; } else { usbhazir = false; } base.WndProc(ref m); } private void button1_Click(object sender, EventArgs e) { if (usbhazir) { MessageBox.Show("Bir Usb Algılandı."); } else { MessageBox.Show("Bir Usb Algılandı."); } } } }[/spoiler] Quote Link to comment Share on other sites More sharing options...
KintaRo Posted June 2, 2015 Share Posted June 2, 2015 kardeş bu örneğini denedim ama bu kodlar herhangi bir usb cihaza tepki veriyor, biraz bakınayım bakalım, sadece usb diskeri denetlemek için neler yapabiliriz. Quote Link to comment Share on other sites More sharing options...
Editor pairs Posted June 2, 2015 Editor Share Posted June 2, 2015 Bu usb tetiklemesi yaptıktan sonra WMI ile sadece usb storage leri getirip algılanabilir tabi bu şuan için basit biz çözüm diyorum. Akşam eve geçtiğimde bi bakarım. Burada güzel bir örnek var. http://stackoverflow.com/questions/6003822/how-to-detect-a-usb-drive-has-been-plugged-in Quote Link to comment Share on other sites More sharing options...
KintaRo Posted June 2, 2015 Share Posted June 2, 2015 burada da çok güzel bir örnek var: http://www.codeproject.com/Articles/63878/Enumerate-and-Auto-Detect-USB-Drives Quote Link to comment Share on other sites More sharing options...
Shain_K Posted June 2, 2015 Author Share Posted June 2, 2015 hocam, abilerim bu uygulama dahi işime yarıyor.timer nesnesi ile ilgili nasıl kullanacağıma dair bilgi verirseniz çok iyi olur.şimdiden ilgilendiğiniz için teşekkür ederim sağolun :) Quote Link to comment Share on other sites More sharing options...
bilgitron Posted June 2, 2015 Share Posted June 2, 2015 timer nesnesi ekle interval degerini 1000 yap(1 sn 1000 milisn) Quote Link to comment Share on other sites More sharing options...
KintaRo Posted June 2, 2015 Share Posted June 2, 2015 timer için bir örnek hazırladım: https://yadi.sk/d/HPNgnnVyh3TZ9 burada önemli olan interval değeri. Interval'i 1000 ms yani 1 saniye de bir çalışacak şekilde ayarladım. 3 dakika istiyorsanız 3 x 60 x 1000 = 180.000 Ms (dakika x saniye x milisaniye) olarak ayarlaman gerekiyor yani intervali 180000 ms olarak ayalarsan 3 dakikada bir eventdaki olayı gerçekleştirecektir. Quote Link to comment Share on other sites More sharing options...
Shain_K Posted June 10, 2015 Author Share Posted June 10, 2015 çok teşekkür ederim elleriniz dert görmesin... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.