Binary Fortress
Binary Fortress Software
CheckCentral
ClipboardFusion
CloudShow
CloudShow Manager
DisplayFusion
FileSeek
HashTools
LogFusion
Notepad Replacer
Online Base64 Decoder
Online Base64 Encoder
Online JSON Formatter
ShellSend
TrayStatus
VoiceBot
WallpaperFusion
Window Inspector
More Apps...
DisplayFusion
CheckCentral
CloudShow
ClipboardFusion
FileSeek
TrayStatus
VoiceBot
WallpaperFusion
Display
Fusion
by Binary Fortress Software
Download
Download
Change Log
Download Beta
Beta Change Log
License (EULA)
Features
Free vs Pro
More
Screenshots
Scripted Functions (Macros)
Languages
Help
Help Guide
FAQ
Discussions
Contact Us
Find My License
Mailing Address
Advanced Settings
Purchase
Login / Register
WARNING: You currently have Javascript disabled!
This website will not function correctly without Javascript enabled.
Title
Message
OK
Confirm
Yes
No
Show error message if audio device is missing
Return to DisplayFusion Scripted Functions (Macros)
Description
Checks for the audio device you set on line 11 and shows a dialog box if it's missing.
Language
C#.net
Minimum Version
9.9+
Created By
Keith Lammers (BFS)
Contributors
-
Date Created
Apr 21, 2022
Date Last Modified
Apr 28, 2022
Scripted Function (Macro) Code
Copy
Select All
using System; using System.Drawing; public static class DisplayFusionFunction { public static void Run(IntPtr windowHandle) { while (true) { // Set the full audio device name here string audioDeviceToCheck = "ASUS VG289 (NVIDIA High Definition Audio)"; // Get the audio device // There's a bug where it sometimes returns nothing, so this will loop a few times until it gets an answer string[] audioDevices = BFS.Audio.GetPlaybackDevices(); for (int i = 0; i < 3; i++) { if (audioDevices.Length == 0) { BFS.General.ThreadWait(500); audioDevices = BFS.Audio.GetPlaybackDevices(); } else { break; } } // Loop through them to check for the specified device bool audioDeviceFound = false; foreach (string device in audioDevices) { // If the specified device matches to one in the array, mark it as found and break out of this loop if (device.ToLower() == audioDeviceToCheck.ToLower()) { audioDeviceFound = true; break; } } // Show an error dialog if the device wasn't found if (!audioDeviceFound) { BFS.Dialog.ShowMessageError("Audio device missing: " + audioDeviceToCheck); } // Wait 60 seconds BFS.General.ThreadWait(60000); } } }