⏩ OldSchoolKO ✅ | " VALHALLA " 2.000.000 TL ÖDÜL ⭐ 3 YIL ARADAN SONRA ✅ v.1098 MYKO EFSANESİ ⚔ OFFICIAL 17.05.2024 - 21:00 ⏪
Cuceko

CD Rom Aç-Kapa Programı

  •         

            

            

            

            

  • HyperFilter | DoS Protection | DDoS Protection | DoS Mitigation | DDoS Mitigation | AntiDoS | AntiDDoS | Proxy Shielding
E Çevrimdışı
11 Ocak 2012
12,856
108
63
Program Kodları !

Kod:
using System;

using System.Drawing;

using System.Text;

using System.Windows.Forms;

using System.Runtime.InteropServices;

 

namespace WindowsApplication1

{

    public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();

         

        }

 

        private void button1_Click(object sender, EventArgs e)

        {

            int ret = mciSendString("CD Sürücüsünü Aç", null, 0, IntPtr.Zero);

 

        }

 

        private void button2_Click(object sender, EventArgs e)

        {

            int ret = mciSendString("CD Sürücüsünü Kapat", null, 0, IntPtr.Zero);

        }

 

        [DllImport("winmm.dll", EntryPoint = "mciSendStringA", CharSet = CharSet.Ansi)]

        protected static extern int mciSendString(string lpstrCommand,

                                                   StringBuilder lpstrReturnString,

                                                   int uReturnLength,

                                                   IntPtr hwndCallback);

 

}

 

}



Bilgilendirmeler !



Api uygulamalarıdır yani Systemde bulunan dll leri kullanır.



Systemde bulunan dll ler yani .net ten önce yazılanlar için bir method kullanırız bu extern ile yazılır.



[DllImport("winmm.dll")]

public static extern int mciSendString(string lpstrCommand,string lpstrReturnString,int uReturnLength,int hwndCallback);



bu methodumuzdu butonumuzun altınada



mciSendString("set CDAudio door open",null,127,0);



yazarsanız cd drom açılır open yazısını closed yazıncada kapanır.



Bunun için System.Runtime.InteropServices

namespace ini eklemeyi unutmayın..