ولی اگه بازم نتونسی اونو اجرا کنی با 2010 من کدشو برات میزارم که بتونی از کدش استفاده کنی
اینم کدش
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
string s1 = "";
int mute = 0;
private const int APPCOMMAND_VOLUME_MUTE = 0x80000;
private const int WM_APPCOMMAND = 0x319;
[System.Runtime.InteropServices.DllImport("user32.d ll")]
public static extern IntPtr SendMessageW(IntPtr hWnd, int Msg, IntPtr wParam, IntPtr lParam);
private void button1_Click(object sender, EventArgs e)
{
{
timer1.Enabled = false;
timer1.Enabled = true;
MessageBox.Show("در زمان تعیین شده عملیات قطع/وصل صدا انجام میشود");
}
}
private void timer1_Tick(object sender, EventArgs e)
{
s1 = DateTime.Now.ToString();
if (DateTime.Now.Hour.ToString("00") == s_shuru.Value.ToString("00") && DateTime.Now.Minute.ToString("00") == d_shuru.Value.ToString("00"))
{
mute++;
if (mute == 1)
SendMessageW(this.Handle, WM_APPCOMMAND, this.Handle, (IntPtr)APPCOMMAND_VOLUME_MUTE);
}
if (DateTime.Now.Hour.ToString("00") == s_payan.Value.ToString("00") && DateTime.Now.Minute.ToString("00") == d_payan.Value.ToString("00"))
{
SendMessageW(this.Handle, WM_APPCOMMAND, this.Handle, (IntPtr)APPCOMMAND_VOLUME_MUTE);
timer1.Enabled = false;
}
}
}
}
موفق باشی