SetApplicationVolume & GetApplicationVolume

  • VB.NET
  • .NET 5–6

Es gibt 14 Antworten in diesem Thema. Der letzte Beitrag () ist von TomTheCoder15.

    SetApplicationVolume & GetApplicationVolume

    Hallo,

    Ich habe ein kleines Programm, welches die Lautstärke von Discord ändert.

    Und zwar so:

    VB.NET-Quellcode

    1. Public VolumeDiscord As Single = 50.0F
    2. SetApplicationSound("discord", VolumeDiscord)


    Das ist die Klasse auf die ich zugreife:

    Spoiler anzeigen

    VB.NET-Quellcode

    1. Imports System.Runtime.InteropServices
    2. Imports System.IO
    3. Public Class VolumeMixer
    4. Public Shared Function GetApplicationVolume(ByVal pid As Integer) As Single?
    5. Dim volume As ISimpleAudioVolume = GetVolumeObject(pid)
    6. If volume Is Nothing Then Return Nothing
    7. Dim level As Single
    8. volume.GetMasterVolume(level)
    9. Marshal.ReleaseComObject(volume)
    10. Return level * 100
    11. End Function
    12. Public Shared Function GetApplicationMute(ByVal pid As Integer) As Boolean?
    13. Dim volume As ISimpleAudioVolume = GetVolumeObject(pid)
    14. If volume Is Nothing Then Return Nothing
    15. Dim mute As Boolean
    16. volume.GetMute(mute)
    17. Marshal.ReleaseComObject(volume)
    18. Return mute
    19. End Function
    20. Public Shared Sub SetApplicationVolume(ByVal pid As Integer, ByVal level As Single)
    21. Dim volume As ISimpleAudioVolume = GetVolumeObject(pid)
    22. If volume Is Nothing Then Return
    23. Dim guid As Guid = Guid.Empty
    24. volume.SetMasterVolume(level / 100, guid)
    25. Marshal.ReleaseComObject(volume)
    26. End Sub
    27. Public Shared Sub SetApplicationMute(ByVal pid As Integer, ByVal mute As Boolean)
    28. Dim volume As ISimpleAudioVolume = GetVolumeObject(pid)
    29. If volume Is Nothing Then Return
    30. Dim guid As Guid = Guid.Empty
    31. volume.SetMute(mute, guid)
    32. Marshal.ReleaseComObject(volume)
    33. End Sub
    34. Private Shared Function GetVolumeObject(ByVal pid As Integer) As ISimpleAudioVolume
    35. Dim deviceEnumerator As IMMDeviceEnumerator = CType((New MMDeviceEnumerator()), IMMDeviceEnumerator)
    36. Dim speakers As IMMDevice
    37. deviceEnumerator.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia, speakers)
    38. Dim IID_IAudioSessionManager2 As Guid = GetType(IAudioSessionManager2).GUID
    39. Dim o As Object
    40. speakers.Activate(IID_IAudioSessionManager2, 0, IntPtr.Zero, o)
    41. Dim mgr As IAudioSessionManager2 = CType(o, IAudioSessionManager2)
    42. Dim sessionEnumerator As IAudioSessionEnumerator
    43. mgr.GetSessionEnumerator(sessionEnumerator)
    44. Dim count As Integer
    45. sessionEnumerator.GetCount(count)
    46. Dim volumeControl As ISimpleAudioVolume = Nothing
    47. For i As Integer = 0 To count - 1
    48. Dim ctl As IAudioSessionControl2
    49. sessionEnumerator.GetSession(i, ctl)
    50. Dim cpid As Integer
    51. ctl.GetProcessId(cpid)
    52. If cpid = pid Then
    53. volumeControl = TryCast(ctl, ISimpleAudioVolume)
    54. Exit For
    55. End If
    56. Marshal.ReleaseComObject(ctl)
    57. Next
    58. Marshal.ReleaseComObject(sessionEnumerator)
    59. Marshal.ReleaseComObject(mgr)
    60. Marshal.ReleaseComObject(speakers)
    61. Marshal.ReleaseComObject(deviceEnumerator)
    62. Return volumeControl
    63. End Function
    64. End Class
    65. <ComImport>
    66. <Guid("BCDE0395-E52F-467C-8E3D-C4579291692E")>
    67. Friend Class MMDeviceEnumerator
    68. End Class
    69. Friend Enum EDataFlow
    70. eRender
    71. eCapture
    72. eAll
    73. EDataFlow_enum_count
    74. End Enum
    75. Friend Enum ERole
    76. eConsole
    77. eMultimedia
    78. eCommunications
    79. ERole_enum_count
    80. End Enum
    81. <Guid("A95664D2-9614-4F35-A746-DE8DB63617E6"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)>
    82. Friend Interface IMMDeviceEnumerator
    83. Function NotImpl1() As Integer
    84. <PreserveSig>
    85. Function GetDefaultAudioEndpoint(ByVal dataFlow As EDataFlow, ByVal role As ERole, <Out> ByRef ppDevice As IMMDevice) As Integer
    86. End Interface
    87. <Guid("D666063F-1587-4E43-81F1-B948E807363F"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)>
    88. Friend Interface IMMDevice
    89. <PreserveSig>
    90. Function Activate(ByRef iid As Guid, ByVal dwClsCtx As Integer, ByVal pActivationParams As IntPtr, <Out>
    91. <MarshalAs(UnmanagedType.IUnknown)> ByRef ppInterface As Object) As Integer
    92. End Interface
    93. <Guid("77AA99A0-1BD6-484F-8BC7-2C654C9A9B6F"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)>
    94. Friend Interface IAudioSessionManager2
    95. Function NotImpl1() As Integer
    96. Function NotImpl2() As Integer
    97. <PreserveSig>
    98. Function GetSessionEnumerator(<Out> ByRef SessionEnum As IAudioSessionEnumerator) As Integer
    99. End Interface
    100. <Guid("E2F5BB11-0570-40CA-ACDD-3AA01277DEE8"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)>
    101. Friend Interface IAudioSessionEnumerator
    102. <PreserveSig>
    103. Function GetCount(<Out> ByRef SessionCount As Integer) As Integer
    104. <PreserveSig>
    105. Function GetSession(ByVal SessionCount As Integer, <Out> ByRef Session As IAudioSessionControl2) As Integer
    106. End Interface
    107. <Guid("87CE5498-68D6-44E5-9215-6DA47EF883D8"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)>
    108. Friend Interface ISimpleAudioVolume
    109. <PreserveSig>
    110. Function SetMasterVolume(ByVal fLevel As Single, ByRef EventContext As Guid) As Integer
    111. <PreserveSig>
    112. Function GetMasterVolume(<Out> ByRef pfLevel As Single) As Integer
    113. <PreserveSig>
    114. Function SetMute(ByVal bMute As Boolean, ByRef EventContext As Guid) As Integer
    115. <PreserveSig>
    116. Function GetMute(<Out> ByRef pbMute As Boolean) As Integer
    117. End Interface
    118. <Guid("bfb7ff88-7239-4fc9-8fa2-07c950be9c6d"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)>
    119. Friend Interface IAudioSessionControl2
    120. <PreserveSig>
    121. Function NotImpl0() As Integer
    122. <PreserveSig>
    123. Function GetDisplayName(<Out>
    124. <MarshalAs(UnmanagedType.LPWStr)> ByRef pRetVal As String) As Integer
    125. <PreserveSig>
    126. Function SetDisplayName(
    127. <MarshalAs(UnmanagedType.LPWStr)> ByVal Value As String,
    128. <MarshalAs(UnmanagedType.LPStruct)> ByVal EventContext As Guid) As Integer
    129. <PreserveSig>
    130. Function GetIconPath(<Out>
    131. <MarshalAs(UnmanagedType.LPWStr)> ByRef pRetVal As String) As Integer
    132. <PreserveSig>
    133. Function SetIconPath(
    134. <MarshalAs(UnmanagedType.LPWStr)> ByVal Value As String,
    135. <MarshalAs(UnmanagedType.LPStruct)> ByVal EventContext As Guid) As Integer
    136. <PreserveSig>
    137. Function GetGroupingParam(<Out> ByRef pRetVal As Guid) As Integer
    138. <PreserveSig>
    139. Function SetGroupingParam(
    140. <MarshalAs(UnmanagedType.LPStruct)> ByVal Override As Guid,
    141. <MarshalAs(UnmanagedType.LPStruct)> ByVal EventContext As Guid) As Integer
    142. <PreserveSig>
    143. Function NotImpl1() As Integer
    144. <PreserveSig>
    145. Function NotImpl2() As Integer
    146. <PreserveSig>
    147. Function GetSessionIdentifier(<Out>
    148. <MarshalAs(UnmanagedType.LPWStr)> ByRef pRetVal As String) As Integer
    149. <PreserveSig>
    150. Function GetSessionInstanceIdentifier(<Out>
    151. <MarshalAs(UnmanagedType.LPWStr)> ByRef pRetVal As String) As Integer
    152. <PreserveSig>
    153. Function GetProcessId(<Out> ByRef pRetVal As Integer) As Integer
    154. <PreserveSig>
    155. Function IsSystemSoundsSession() As Integer
    156. <PreserveSig>
    157. Function SetDuckingPreference(ByVal optOut As Boolean) As Integer
    158. End Interface


    Dort habe ich auch die Funktion "GetApplicationVolume". Nun habe ich schon einiges ausprobiert aber es nicht hinbekommen.
    Hätte gerne, dass beim öffnen der App, herrausgefunden wird, welche Lautstärke Discord hat.

    Vielen Dank im Voraus für jede Hilfe :)

    CodeTags korrigiert ~VaporiZed

    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von „VaporiZed“ ()

    Falls Du diesen Code kopierst, achte auf die C&P-Bremse.
    Jede einzelne Zeile Deines Programms, die Du nicht explizit getestet hast, ist falsch :!:
    Ein guter .NET-Snippetkonverter (der ist verfügbar).
    Programmierfragen über PN / Konversation werden ignoriert!
    Ich habe das Ganze mal angeguckt und

    Quellcode

    1. ​this.tbVolume.Value = (int)AudioManager.GetMasterVolume();

    in einen C# to Vb.net Converter geworden, umgeschrieben und das rausbekommen:

    Quellcode

    1. VolumeProgramm1.Value = CInt(VolumeMixer.GetApplicationVolume()


    Habe ebenfalls

    Quellcode

    1. VolumeProgramm1.Value = CInt(VolumeMixer.GetApplicationVolume("discord")

    Ausprobiert, ist nur leider immer noch nicht funktional.

    TomTheCoder15 schrieb:

    Ich habe das Ganze mal angeguckt und

    Quellcode

    1. ​this.tbVolume.Value = (int)AudioManager.GetMasterVolume();

    in einen C# to Vb.net Converter geworden, umgeschrieben und das rausbekommen:

    Quellcode

    1. VolumeProgramm1.Value = CInt(VolumeMixer.GetApplicationVolume()
    Erstaunlich!
    Aus einem AudioManager wird offsichtlich ein VolumeMixer 8|
    Woher hast Du denn diese Syntax?

    TomTheCoder15 schrieb:

    VB.NET-Quellcode

    1. VolumeMixer.GetApplicationVolume("discord")
    Das kommt bei Dir und bei mir nur mit dem Parameter int pid vor.
    Was genau ist "discord"?
    Falls Du diesen Code kopierst, achte auf die C&P-Bremse.
    Jede einzelne Zeile Deines Programms, die Du nicht explizit getestet hast, ist falsch :!:
    Ein guter .NET-Snippetkonverter (der ist verfügbar).
    Programmierfragen über PN / Konversation werden ignoriert!

    TomTheCoder15 schrieb:

    VB.NET-Quellcode

    1. SetApplicationSound(...)
    Was hat das mit Deiner Klasse oben zu tun?
    Falls Du diesen Code kopierst, achte auf die C&P-Bremse.
    Jede einzelne Zeile Deines Programms, die Du nicht explizit getestet hast, ist falsch :!:
    Ein guter .NET-Snippetkonverter (der ist verfügbar).
    Programmierfragen über PN / Konversation werden ignoriert!

    Quellcode

    1. ​Private Sub SetApplicationSound(processName As String, volume As Single)
    2. Dim p() As Process = Process.GetProcessesByName(processName)
    3. If p.Count > 0 Then
    4. For Each proc In p
    5. Dim pID As Integer = proc.Id
    6. If pID = 0 Then Return
    7. VolumeMixer.SetApplicationVolume(pID, volume)
    8. Next
    9. End If
    10. End Sub
    @TomTheCoder15 Oder so:

    VB.NET-Quellcode

    1. Private Sub SetApplicationSound(processName As String, volume As Single)
    2. Dim p() As Process = Process.GetProcessesByName(processName)
    3. If p.Count > 0 Then
    4. For Each proc In p
    5. Dim pID As Integer = proc.Id
    6. If pID <> 0 Then
    7. VolumeMixer.SetApplicationVolume(pID, volume)
    8. Return
    9. End If
    10. Next
    11. End If
    12. End Sub
    Falls Du diesen Code kopierst, achte auf die C&P-Bremse.
    Jede einzelne Zeile Deines Programms, die Du nicht explizit getestet hast, ist falsch :!:
    Ein guter .NET-Snippetkonverter (der ist verfügbar).
    Programmierfragen über PN / Konversation werden ignoriert!
    @TomTheCoder15 Ich nahm an, Dein Post hat was mit Deinem Problem zu tun, deswegen war ich so frei, ihn zu korrigieren.
    Falls Du diesen Code kopierst, achte auf die C&P-Bremse.
    Jede einzelne Zeile Deines Programms, die Du nicht explizit getestet hast, ist falsch :!:
    Ein guter .NET-Snippetkonverter (der ist verfügbar).
    Programmierfragen über PN / Konversation werden ignoriert!

    TomTheCoder15 schrieb:

    habe jedoch mit dem Code keine Probleme
    Dann hast Du den Unterschied nicht verstanden.
    ====
    Ich gab Dir in Post #2 einen Link zu einem funktionierenden Projekt.
    Was ist damit?
    Falls Du diesen Code kopierst, achte auf die C&P-Bremse.
    Jede einzelne Zeile Deines Programms, die Du nicht explizit getestet hast, ist falsch :!:
    Ein guter .NET-Snippetkonverter (der ist verfügbar).
    Programmierfragen über PN / Konversation werden ignoriert!
    Das Projekt habe ich mir runtergeladen, angeguckt und in einen C# to VB Converter geschmissen.
    Viel anfangen, konnte ich damit jedoch nicht.

    Um es nochmal klar zu machen.
    Ich kann mit dem Programm die Lautstärke ändern mit:

    Quellcode

    1. SetApplicationSound("discord", 50.0F)


    Ich möchte nur jetzt, wenn ich meine Application öffne, dass es von dem Programm die Lautstärke übernimmt.
    Das habe ich gedacht, funktioniert mit

    Quellcode

    1. GetApplicationVolume​
    und habe es so probiert:

    Quellcode

    1. ​VolumeProgramm1.Value = CInt(VolumeMixer.GetApplicationVolume("discord"))


    Hier noch mal die gesamte Klasse auf der zugegriffen wird:
    Spoiler anzeigen

    Quellcode

    1. ​Imports System.Runtime.InteropServices
    2. Imports System.IO
    3. Imports System
    4. Public Class VolumeMixer
    5. Public Shared Function GetApplicationVolume(ByVal pid As Integer) As Single?
    6. Dim volume As ISimpleAudioVolume = GetVolumeObject(pid)
    7. If volume Is Nothing Then Return Nothing
    8. Dim level As Single
    9. volume.GetMasterVolume(level)
    10. Marshal.ReleaseComObject(volume)
    11. Return level * 100
    12. End Function
    13. Public Shared Function GetApplicationMute(ByVal pid As Integer) As Boolean?
    14. Dim volume As ISimpleAudioVolume = GetVolumeObject(pid)
    15. If volume Is Nothing Then Return Nothing
    16. Dim mute As Boolean
    17. volume.GetMute(mute)
    18. Marshal.ReleaseComObject(volume)
    19. Return mute
    20. End Function
    21. Public Shared Sub SetApplicationVolume(ByVal pid As Integer, ByVal level As Single)
    22. Dim volume As ISimpleAudioVolume = GetVolumeObject(pid)
    23. If volume Is Nothing Then Return
    24. Dim guid As Guid = Guid.Empty
    25. volume.SetMasterVolume(level / 100, guid)
    26. Marshal.ReleaseComObject(volume)
    27. End Sub
    28. Public Shared Sub SetApplicationMute(ByVal pid As Integer, ByVal mute As Boolean)
    29. Dim volume As ISimpleAudioVolume = GetVolumeObject(pid)
    30. If volume Is Nothing Then Return
    31. Dim guid As Guid = Guid.Empty
    32. volume.SetMute(mute, guid)
    33. Marshal.ReleaseComObject(volume)
    34. End Sub
    35. Private Shared Function GetVolumeObject(ByVal pid As Integer) As ISimpleAudioVolume
    36. Dim deviceEnumerator As IMMDeviceEnumerator = CType((New MMDeviceEnumerator()), IMMDeviceEnumerator)
    37. Dim speakers As IMMDevice
    38. deviceEnumerator.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia, speakers)
    39. Dim IID_IAudioSessionManager2 As Guid = GetType(IAudioSessionManager2).GUID
    40. Dim o As Object
    41. speakers.Activate(IID_IAudioSessionManager2, 0, IntPtr.Zero, o)
    42. Dim mgr As IAudioSessionManager2 = CType(o, IAudioSessionManager2)
    43. Dim sessionEnumerator As IAudioSessionEnumerator
    44. mgr.GetSessionEnumerator(sessionEnumerator)
    45. Dim count As Integer
    46. sessionEnumerator.GetCount(count)
    47. Dim volumeControl As ISimpleAudioVolume = Nothing
    48. For i As Integer = 0 To count - 1
    49. Dim ctl As IAudioSessionControl2
    50. sessionEnumerator.GetSession(i, ctl)
    51. Dim cpid As Integer
    52. ctl.GetProcessId(cpid)
    53. If cpid = pid Then
    54. volumeControl = TryCast(ctl, ISimpleAudioVolume)
    55. Exit For
    56. End If
    57. Marshal.ReleaseComObject(ctl)
    58. Next
    59. Marshal.ReleaseComObject(sessionEnumerator)
    60. Marshal.ReleaseComObject(mgr)
    61. Marshal.ReleaseComObject(speakers)
    62. Marshal.ReleaseComObject(deviceEnumerator)
    63. Return volumeControl
    64. End Function
    65. End Class
    66. <ComImport>
    67. <Guid("BCDE0395-E52F-467C-8E3D-C4579291692E")>
    68. Friend Class MMDeviceEnumerator
    69. End Class
    70. Friend Enum EDataFlow
    71. eRender
    72. eCapture
    73. eAll
    74. EDataFlow_enum_count
    75. End Enum
    76. Friend Enum ERole
    77. eConsole
    78. eMultimedia
    79. eCommunications
    80. ERole_enum_count
    81. End Enum
    82. <Guid("A95664D2-9614-4F35-A746-DE8DB63617E6"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)>
    83. Friend Interface IMMDeviceEnumerator
    84. Function NotImpl1() As Integer
    85. <PreserveSig>
    86. Function GetDefaultAudioEndpoint(ByVal dataFlow As EDataFlow, ByVal role As ERole, <Out> ByRef ppDevice As IMMDevice) As Integer
    87. End Interface
    88. <Guid("D666063F-1587-4E43-81F1-B948E807363F"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)>
    89. Friend Interface IMMDevice
    90. <PreserveSig>
    91. Function Activate(ByRef iid As Guid, ByVal dwClsCtx As Integer, ByVal pActivationParams As IntPtr, <Out>
    92. <MarshalAs(UnmanagedType.IUnknown)> ByRef ppInterface As Object) As Integer
    93. End Interface
    94. <Guid("77AA99A0-1BD6-484F-8BC7-2C654C9A9B6F"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)>
    95. Friend Interface IAudioSessionManager2
    96. Function NotImpl1() As Integer
    97. Function NotImpl2() As Integer
    98. <PreserveSig>
    99. Function GetSessionEnumerator(<Out> ByRef SessionEnum As IAudioSessionEnumerator) As Integer
    100. End Interface
    101. <Guid("E2F5BB11-0570-40CA-ACDD-3AA01277DEE8"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)>
    102. Friend Interface IAudioSessionEnumerator
    103. <PreserveSig>
    104. Function GetCount(<Out> ByRef SessionCount As Integer) As Integer
    105. <PreserveSig>
    106. Function GetSession(ByVal SessionCount As Integer, <Out> ByRef Session As IAudioSessionControl2) As Integer
    107. End Interface
    108. <Guid("87CE5498-68D6-44E5-9215-6DA47EF883D8"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)>
    109. Friend Interface ISimpleAudioVolume
    110. <PreserveSig>
    111. Function SetMasterVolume(ByVal fLevel As Single, ByRef EventContext As Guid) As Integer
    112. <PreserveSig>
    113. Function GetMasterVolume(<Out> ByRef pfLevel As Single) As Integer
    114. <PreserveSig>
    115. Function SetMute(ByVal bMute As Boolean, ByRef EventContext As Guid) As Integer
    116. <PreserveSig>
    117. Function GetMute(<Out> ByRef pbMute As Boolean) As Integer
    118. End Interface
    119. <Guid("bfb7ff88-7239-4fc9-8fa2-07c950be9c6d"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)>
    120. Friend Interface IAudioSessionControl2
    121. <PreserveSig>
    122. Function NotImpl0() As Integer
    123. <PreserveSig>
    124. Function GetDisplayName(<Out>
    125. <MarshalAs(UnmanagedType.LPWStr)> ByRef pRetVal As String) As Integer
    126. <PreserveSig>
    127. Function SetDisplayName(
    128. <MarshalAs(UnmanagedType.LPWStr)> ByVal Value As String,
    129. <MarshalAs(UnmanagedType.LPStruct)> ByVal EventContext As Guid) As Integer
    130. <PreserveSig>
    131. Function GetIconPath(<Out>
    132. <MarshalAs(UnmanagedType.LPWStr)> ByRef pRetVal As String) As Integer
    133. <PreserveSig>
    134. Function SetIconPath(
    135. <MarshalAs(UnmanagedType.LPWStr)> ByVal Value As String,
    136. <MarshalAs(UnmanagedType.LPStruct)> ByVal EventContext As Guid) As Integer
    137. <PreserveSig>
    138. Function GetGroupingParam(<Out> ByRef pRetVal As Guid) As Integer
    139. <PreserveSig>
    140. Function SetGroupingParam(
    141. <MarshalAs(UnmanagedType.LPStruct)> ByVal Override As Guid,
    142. <MarshalAs(UnmanagedType.LPStruct)> ByVal EventContext As Guid) As Integer
    143. <PreserveSig>
    144. Function NotImpl1() As Integer
    145. <PreserveSig>
    146. Function NotImpl2() As Integer
    147. <PreserveSig>
    148. Function GetSessionIdentifier(<Out>
    149. <MarshalAs(UnmanagedType.LPWStr)> ByRef pRetVal As String) As Integer
    150. <PreserveSig>
    151. Function GetSessionInstanceIdentifier(<Out>
    152. <MarshalAs(UnmanagedType.LPWStr)> ByRef pRetVal As String) As Integer
    153. <PreserveSig>
    154. Function GetProcessId(<Out> ByRef pRetVal As Integer) As Integer
    155. <PreserveSig>
    156. Function IsSystemSoundsSession() As Integer
    157. <PreserveSig>
    158. Function SetDuckingPreference(ByVal optOut As Boolean) As Integer
    159. End Interface


    Da der Wert aber ja ein Single ist (z.B. 50.0F) muss ich es ja als Int rausbekommen, damit ich dies als Value für meine Trackbar benutzten kann. Richtig?

    Um mit der Trackbar die Lautstärke zu ändern, musste ich es ja auch zu einem Single Wert machen. Das ging aber ja einfach so:

    Quellcode

    1. ​Public VolumeDiscord As Single = 50.0F
    2. VolumeDiscord = VolumeProgramm1.Value


    Ich kann mir nicht vorstellen, dass es viel komplizierter ist.