Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re: Programmatically enable/disable a playback device in Windows 7

by thmsdrew (Scribe)
on Nov 09, 2012 at 02:27 UTC ( #1003046=note: print w/replies, xml ) Need Help??

in reply to Programmatically enable/disable a playback device in Windows 7

What I am thinking of doing is the following:

#!/usr/bin/perl use strict; use warnings; use Win32::GuiTest qw(:ALL); system "control mmsys.cpl"; sleep 1; my @sound = FindWindowLike(undef, "Sound"); # Get the list that contains the playback devices my @list = FindWindowLike($sound[0], "", "SysListView32"); my ($left, $top, $right, $bottom) = GetWindowRect($list[0]); # Move the mouse within the bounds of that list, clicking # on stuff. You can type "E" to enable the device once you # right-click, or "D" to disable it. MouseMoveAbsPix($right - 10, $top + 5); SendMouse("{RightClick}"); SendKeys("{E}");

It's limited in that I have to trial-and-error to find the right pixels to click. As far as I'm concerned, there's no way to find the coordinates of the individual list items, so I think something like this will have to do. Any thoughts?

  • Comment on Re: Programmatically enable/disable a playback device in Windows 7
  • Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1003046]
[stevieb]: All of the early members are coming out of the woodwork today :) Hey, planetscape
[Corion]: This cover version had so much promise but the singing is underwhelming :-/
[stevieb]: erix Thanks! I dislike remakes of songs usually, but my favourite remix of guitar/weeps is Jeff Healey. I'll take a listen to yours
[planetscape]: hi stevieb!
[stonecolddevin]: also hi Corion
[Corion]: stevieb: Yeah, but I don't follow guitar players enough... I never got Prince and I don't think I could recognize his play style. I can recognize Santana and Nile Rodgers, but that's about it, and not really deep knowledge I think ;)
[stevieb]: Jeff Healey cut of My guitar gently weeps
[stonecolddevin]: you don't recognize Prince. Prince tells you it's him.
[erix]: Alvin Lee (Ten Years After) played a jazzguitar ("Big Red"), a good warm sound
[stonecolddevin]: I think Stevie Ray is one of maybe 2 or 3 people that could take a Hendrix song and make you go "...huh. this is close." https://open. 0UVM9trirBK5s1xBwL oVhZ

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2017-06-22 21:33 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (531 votes). Check out past polls.