Forum Replies Created
-
AuthorPosts
-
vitalybMember
Thanks for the answer, Leif!
To help out others here is the code C# and for AutoHotKey (ahk):
C#
code :using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;namespace BreakawayChangeVolume
{
class Program
{
[DllImport("user32.dll", SetLastError = true)]
static extern IntPtr FindWindow(string lpClassName, string lpWindowName);[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
static extern uint RegisterWindowMessage(string lpString);[DllImport("user32.dll", CharSet = CharSet.Auto)]
static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam);static void Main(string[] args)
{
var hWndBa = FindWindow(null, "BreakawayUtilityWindow_0xBA31337");
uint msgGetVolume = RegisterWindowMessage("BaGetVolume");
uint msgSetVolume = RegisterWindowMessage("BaSetVolume");
var volume = SendMessage(hWndBa, msgGetVolume, (IntPtr) 0, (IntPtr) 0);
SendMessage(hWndBa, msgSetVolume, (IntPtr)0, (IntPtr)50);
}
}
}AutoHotKey
code :; HWND hWndBa=FindWindow(NULL,"BreakawayUtilityWindow_0xBA31337");
hWnd := DllCall("FindWindow", int, 0, str, "BreakawayUtilityWindow_0xBA31337")
msgGetVolume := DllCall("RegisterWindowMessage", str, "BaGetVolume")
msgSetVolume := DllCall("RegisterWindowMessage", str, "BaSetVolume")#=::
VolumeUp()
return
#-::
VolumeDown()
return
VolumeUp()
{
Global
volume := DllCall("SendMessage", int, hWnd, int, msgGetVolume, int, 0, int, 0)
volume := volume + vol_Step
DllCall("SendMessage", int, hWnd, int, msgSetVolume, int, 0, int, volume)
}VolumeDown()
{
Global
volume := DllCall("SendMessage", int, hWnd, int, msgGetVolume, int, 0, int, 0)
volume := volume - vol_Step
DllCall("SendMessage", int, hWnd, int, msgSetVolume, int, 0, int, volume)
}Enjoy
-
AuthorPosts