Nova Posted December 29, 2004 Share Posted December 29, 2004 (edited) Im trying to set the volume level on my pcI took all infomation from these 2 sites Reference 1 and Reference 2Ive tryed many varations of the following but nothing seems to change the volume level.Ive manually set the volume to 0 in Volume Control, and then called the dll like soDllCall ( "Winmm.dll", "int", "auxSetVolume", "int", 0 , "int", 0x80008000)Then I closed and reopened volume control but the volume is still at zero.What am I doing wrong ?Edit: Id like to point out that neither reference says which dll to use.So how do I figure it out ?The second reference MSDN however says Library = Use Winmm.lib correct me if im wrong, I just assumed the dll to use is Winmm.dll ? Edited December 29, 2004 by Nova Link to comment Share on other sites More sharing options...
this-is-me Posted December 29, 2004 Share Posted December 29, 2004 (edited) http://www.mentalis.org/apilist/auxSetVolume.shtmlYou are correct on the winmm part, but the call is generating a return value of 2, which means the device number is out of range.$x = DllCall ( "Winmm.dll", "int", "auxSetVolume", "int", 0 , "int", 0x80008000) msgbox(0,"",$x[0])EDIT: this returns 0 on my pc, even though I have an aux in the volume properties:$y = DllCall ( "Winmm.dll", "int", "auxGetNumDevs") msgbox(0,"",$y[0])MSDN Docs (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/_win32_auxgetnumdevs.asp):A return value of zero means that no devices are present or that an error occurred. Edited December 29, 2004 by this-is-me Who else would I be? Link to comment Share on other sites More sharing options...
Nova Posted December 29, 2004 Author Share Posted December 29, 2004 (edited) Thanks this-is-me, So I actually got the dllcall right ,well thats a start anyway. I also get a return value of 0 from auxGetNumDevs on my computer ! Damit dose that mean I cant change the volume on my computer using dllcall ? I dont understand why it cant find my audio device, it is obviously present (Ive been listening to Green Day all morning ) Edited December 29, 2004 by Nova Link to comment Share on other sites More sharing options...
Nova Posted December 29, 2004 Author Share Posted December 29, 2004 Anyone know of a way I can make this work ? Ive been searching for a few hours now and I cant find anything Link to comment Share on other sites More sharing options...
Administrators Jon Posted December 29, 2004 Administrators Share Posted December 29, 2004 Anyone know of a way I can make this work ?Ive been searching for a few hours now and I cant find anythingDon't think you'll have any joy with that, just did a google and you need to do lots of other things as well - some of which needs structures and other things that you won't be able to do.Whenever I have trouble with programming/API I go to groups.google.com (not the web, groups) and search for "apiname win32 programmer". Usually you'll find an answer there (I did for this problem in about 2 seconds ) Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
MHz Posted December 29, 2004 Share Posted December 29, 2004 Full VolumeDllCall ( "Winmm.dll", "int", "waveOutSetVolume", "int", 0 , "int", 0xFFFF) No VolumeDllCall ( "Winmm.dll", "int", "waveOutSetVolume", "int", 0 , "int", 0x0000) Link to comment Share on other sites More sharing options...
Administrators Jon Posted December 29, 2004 Administrators Share Posted December 29, 2004 The actuall auxSetVolume should work as long as you know which device id is correct - but I think it changes from machine to machine and that's when you have to start enumerating all the devices on a system to work out which is which... Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
MHz Posted December 29, 2004 Share Posted December 29, 2004 Check my last post Link to comment Share on other sites More sharing options...
Nova Posted December 29, 2004 Author Share Posted December 29, 2004 (edited) @Jon thats for the good info,im sure that will come in very useful in the future. @MHz that works perfectly, how did u know 0xFFFF was 100% and that 0x0000 was 0% ? How do I figure out all the precentages inbetween ? Edited December 29, 2004 by Nova Link to comment Share on other sites More sharing options...
SumTingWong Posted December 29, 2004 Share Posted December 29, 2004 Check my last post <{POST_SNAPBACK}>The waveOutSetVolume only sets the Wave playback volume and not the master volume. Link to comment Share on other sites More sharing options...
Nova Posted December 29, 2004 Author Share Posted December 29, 2004 (edited) The waveOutSetVolume only sets the Wave playback volume and not the master volume.That would probly suit my needs better anyway.Edit:One other thing, how come I dont have to place winmm.dll in the script directory like I would have to with Larrys dll ? Edited December 29, 2004 by Nova Link to comment Share on other sites More sharing options...
MHz Posted December 29, 2004 Share Posted December 29, 2004 (edited) wave is better than aux though. MSDN Ofcouse. The info is there.Edit: Because it is in your system directory. Which is a global evvironmental path. Edited December 29, 2004 by MHz Link to comment Share on other sites More sharing options...
Administrators Jon Posted December 29, 2004 Administrators Share Posted December 29, 2004 Check my last post There is nothing in the docs to suggest that a value of 0 for the device ID is correct in all cases. I imagine that if you have 2 soundcards (common, one on the motherboard and then a "proper" one in a pci slot) then 0 won't be correct. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
this-is-me Posted December 29, 2004 Share Posted December 29, 2004 (edited) @MHz, SoundSetWaveVolume Edited December 29, 2004 by this-is-me Who else would I be? Link to comment Share on other sites More sharing options...
MHz Posted December 29, 2004 Share Posted December 29, 2004 @Jon, I guess you are right there. Maybe script to find the correct device if unknown?How do I figure out all the precentages inbetween ?<{POST_SNAPBACK}>Some approx percentages for the volume.0x0000 = 5%0x1111 = 15%0x2222 = 20%0x3333 = 25%0x4444 = 35%0x5555 = 40%0x6666 = 50%0x7777 = 55%0x8888 = 60%0xaaaa = 70%0xbbbb = 75%0xcccc = 85%0xdddd = 90%0xeeee = 95%0xffff = 100% Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now