Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Newbie: Volume Control
#1
Hi, I am new to macros. I wanted to use the scroll wheel on a second mouse to control the master volume of windows xp. I got 'keyboard detector' to work properly and filter for the second mouse. I am just not sure how to write the code for the volume. I found VK_VOLUME_UP and VK_VOLUME_DOWN, but how do I use them? Any help is appreciated, thank you.
-Adam
#2
Ok, so I got the volume control to basically work. (Shows what a little sleep will do). I still have some questions though.
1. What is the difference between a macro and a function.
2. How to i get the volume popup window to show up? Do I need to use msctls_trackbar32?
3. Can I change the steps the volume will change each time?
#3
1. The main difference is for what purposes they are used. Macros are used to automate something. Usually they interact with other applications. Usually you launch them manually (hotkey, mouse, etc). You can press Pause key to end macro. You will use macros in most cases. Functions is more advanced thing. They are mostly used for: a) Like functions in other programming or scripting languages. That is, to use the same code in multiple places just by calling the function; b) Unlike macros, multiple functions can run simultaneously, which is better in some cases. For example, use functions to execute background tasks and other tasks that run long time, often unattended, can run simultaneously, do not interfere with each other, like separate applications or services. Read more in Help, "QM items" topic.

2. Do you want to create a dialog to control volume? Why?

3. Maybe repeat key command. Like this:

Code:
Copy      Help
int steps=5
spe
rep steps
,key (VK_VOLUME_DOWN)

1

rep steps
,key (VK_VOLUME_UP)
#4
Thank you for the reply Gintaras.
I just wanted the volume slider to show up while I was turning the scrolling wheel so that I could see the current master volume level.
#5
I don't know a better way than clicking the Volume icon in the system notification area (tray). This function does that.

Function ShowVolumeControl
Code:
Copy      Help
function [nSeconds]

;EXAMPLES
;ShowVolumeControl 5 ;;sync
;mac "ShowVolumeControl" "" 5 ;;async



if(!nSeconds) nSeconds=5
Acc a=acc("Volume" "PUSHBUTTON" "+Shell_TrayWnd" "ToolbarWindow32" "" 0x1001)
POINT p; xm p
a.Mouse(1)
int h=wait(10 WV win("Volume Control" "Tray Volume"))
mou p.x p.y 0
wait nSeconds
clo h
#6
setting a hook to Wheel Scroll
pi


Forum Jump:


Users browsing this thread: 1 Guest(s)