Home>
using system;
using system.collections.generic;
using system.componentmodel;
using system.data;
using system.drawing;
using system.text;
using system.windows.forms;
using system.runtime.interopservices;
namespace volumnset
{
  public partial class form1:form
  {
    [dllimport ("user32.dll", charset=charset.auto, setlasterror=true)]
    static extern intptr sendmessage (intptr hwnd, uint msg, uint wparam, uint lparam);
    const uint wm_appcommand=0x319;
    const uint appcommand_volume_up=0x0a;
    const uint appcommand_volume_down=0x09;
    const uint appcommand_volume_mute=0x08;
    public form1 ()
    {
      initializecomponent ();
    }
    private void button1_click (object sender, eventargs e)
    {
      //increase the volume
      sendmessage (this.handle, wm_appcommand, 0x30292, appcommand_volume_up * 0x10000);
    }
    private void button2_click (object sender, eventargs e)
    {
      //Decrease the volume
      sendmessage (this.handle, wm_appcommand, 0x30292, appcommand_volume_down * 0x10000);
    }
    private void checkbox1_checkedchanged (object sender, eventargs e)
    {
      //mute
      sendmessage (this.handle, wm_appcommand, 0x200eb0, appcommand_volume_mute * 0x10000);
    }
  }
}
c
  • Previous Brief introduction to write ajax yourself without library (framework)
  • Next 3 things PHP programmers should not ignore