Click here to Skip to main content
15,923,006 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to access port80 Pin
Luc Pattyn15-Feb-11 2:21
sitebuilderLuc Pattyn15-Feb-11 2:21 
GeneralRe: How to access port80 Pin
Bernhard Hiller16-Feb-11 21:42
Bernhard Hiller16-Feb-11 21:42 
QuestionGmail Port 465 Send Mail Error Pin
Anubhava Dimri14-Feb-11 19:49
Anubhava Dimri14-Feb-11 19:49 
AnswerRe: Gmail Port 465 Send Mail Error Pin
Dave Kreskowiak15-Feb-11 1:56
mveDave Kreskowiak15-Feb-11 1:56 
GeneralRe: Gmail Port 465 Send Mail Error Pin
Anubhava Dimri16-Feb-11 1:09
Anubhava Dimri16-Feb-11 1:09 
GeneralRe: Gmail Port 465 Send Mail Error Pin
Dave Kreskowiak16-Feb-11 1:12
mveDave Kreskowiak16-Feb-11 1:12 
GeneralRe: Gmail Port 465 Send Mail Error Pin
Anubhava Dimri16-Feb-11 1:17
Anubhava Dimri16-Feb-11 1:17 
GeneralRe: Gmail Port 465 Send Mail Error Pin
Dave Kreskowiak16-Feb-11 2:26
mveDave Kreskowiak16-Feb-11 2:26 
QuestionDataGridViewTextBoxEditingControl autocomplete conflict with wrapmode [modified] Pin
reza assar14-Feb-11 19:37
reza assar14-Feb-11 19:37 
Questionqueries with coding Pin
Rei ho14-Feb-11 18:43
Rei ho14-Feb-11 18:43 
QuestionRedirect after xsl file is downloaded Pin
S.Aijaz14-Feb-11 18:12
S.Aijaz14-Feb-11 18:12 
QuestionWhat is the better approach between IQueryable and IEnumerable ? Pin
Nadia Monalisa14-Feb-11 15:13
Nadia Monalisa14-Feb-11 15:13 
AnswerRe: What is the better approach between IQueryable and IEnumerable ? Pin
PIEBALDconsult14-Feb-11 17:16
mvePIEBALDconsult14-Feb-11 17:16 
GeneralRe: What is the better approach between IQueryable and IEnumerable ? Pin
Nadia Monalisa14-Feb-11 17:59
Nadia Monalisa14-Feb-11 17:59 
GeneralRe: What is the better approach between IQueryable and IEnumerable ? Pin
PIEBALDconsult15-Feb-11 1:53
mvePIEBALDconsult15-Feb-11 1:53 
AnswerRe: What is the better approach between IQueryable and IEnumerable ? Pin
dasblinkenlight14-Feb-11 21:25
dasblinkenlight14-Feb-11 21:25 
GeneralRe: What is the better approach between IQueryable and IEnumerable ? Pin
PIEBALDconsult15-Feb-11 2:02
mvePIEBALDconsult15-Feb-11 2:02 
GeneralRe: What is the better approach between IQueryable and IEnumerable ? Pin
dasblinkenlight15-Feb-11 2:31
dasblinkenlight15-Feb-11 2:31 
GeneralRe: What is the better approach between IQueryable and IEnumerable ? Pin
PIEBALDconsult15-Feb-11 4:19
mvePIEBALDconsult15-Feb-11 4:19 
GeneralRe: What is the better approach between IQueryable and IEnumerable ? Pin
dasblinkenlight15-Feb-11 5:15
dasblinkenlight15-Feb-11 5:15 
GeneralRe: What is the better approach between IQueryable and IEnumerable ? Pin
PIEBALDconsult15-Feb-11 8:32
mvePIEBALDconsult15-Feb-11 8:32 
GeneralRe: What is the better approach between IQueryable and IEnumerable ? Pin
dasblinkenlight15-Feb-11 9:40
dasblinkenlight15-Feb-11 9:40 
GeneralRe: What is the better approach between IQueryable and IEnumerable ? Pin
PIEBALDconsult15-Feb-11 10:03
mvePIEBALDconsult15-Feb-11 10:03 
GeneralRe: What is the better approach between IQueryable and IEnumerable ? Pin
PIEBALDconsult15-Feb-11 10:09
mvePIEBALDconsult15-Feb-11 10:09 
QuestionControl Speaker Volume Pin
Kevin Marois14-Feb-11 8:21
professionalKevin Marois14-Feb-11 8:21 
I'm using VS 2010 on Windows 7. I found this code in a Google search, and it compiles and runs, but when I pass in values to SetVolume, there is no change in the sound volume:

public static class Volume
{
    [DllImport("winmm.dll")]
    private static extern int waveOutGetVolume(IntPtr hwo, out uint dwVolume);

    [DllImport("winmm.dll")]
    private static extern int waveOutSetVolume(IntPtr hwo, uint dwVolume);

    public static int GetVolume()
    {
        // By the default set the volume to 0
        uint CurrVol = 0;

        // At this point, CurrVol gets assigned the volume
        waveOutGetVolume(IntPtr.Zero, out CurrVol);
                
        // Calculate the volume
        ushort CalcVol = (ushort)(CurrVol & 0x0000ffff);
                
        // Get the volume on a scale of 1 to 10 (to fit the trackbar)
        int volume = CalcVol / (ushort.MaxValue / 10);

        return volume;
    }

    public static void SetVolume(int Volume)
    {
        // Calculate the volume that's being set
        int NewVolume = ((ushort.MaxValue / 10) * Volume);

        // Set the same volume for both the left and the right channels
        uint NewVolumeAllChannels = (((uint)NewVolume & 0x0000ffff) | ((uint)NewVolume << 16));
                
        // Set the volume
        waveOutSetVolume(IntPtr.Zero, NewVolumeAllChannels);
    }
}


I found a couple of Mixer type projects here on CP, but they're over the top as far as wat I'm looking for. I simply want to change the volume level of the speakers.

Anyone know how to do this?
>
Everything makes sense in someone's mind

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.