I've got an industrial panel which running a 32-bit version of Windows Embedded 8 Standard. It is required to use the internal speaker to make beep sounds. Connecting external speakers is not an option.
Previously this was running XP based Windows Embedded Standard and using Console.Beep in C# will use the internal speaker. However in Windows 8 Embedded Standard this seems to use the external speakers instead, despite not being connected up.
The internal speaker is still operational - the touchscreen driver (eGalaxTouch) still uses the internal speaker when tapping the screen, however I cannot replicate this in my own application.
I've tried the following from a C# application with no effect;
Console.Beep()
MessageBeep() (user32.dll)
Beep() (kernel32.dll)
SystemSounds.Beep.Play()
I understand this is not possible from Windows 7 64-bit onwards, but I'm using 32-bit OS here and it still works with the touchscreen?
While a solution in C#/.NET would be ideal, I'd be up for other solutions (C/C++/whatever).
Typically shortly after posting the question, I find an answer...
Basically, using the 'Beep.sys' file from the Windows (XP) Embedded Standard in place of the Windows 8 Embedded version allows Console.Beep to work as expected.
harrymc's answer to a similar question https://superuser.com/a/230167/83606 below. Note that there is no 'Beep' device in the device manager in Windows 8 (Embedded), but the procedure is otherwise similar.
From Default Beep PC Speaker changed in windows 7 – How to get back to old style :
The default beep is controlled by a
driver under,
c:\windows\system32\drivers\beep.sys.
Maybe if you switched it out with a
driver from XP/Vista it would increase
the volume.
To see this driver you have to open
device manager then click on View >
Show hidden devices. Then under
Non-Plug and Play Drivers you’ll see
“Beep.” This is the driver that runs
your beep. Right click on it then
choose properties and go to the driver
tab, then click on Driver Details…
This shows the file version which
looks like it’s been change with
Windows 7. So replace it with an
older version and see what happens.
Procedure to follow :
Boot from an UBCD4WIN disc (or BartPE if you don’t have an SATA hard
drive)
Take ownership of the “C:\Windows\System32\Drivers\Beep.sys”
file and give the local
“Administrators” Group “Full Control”
permissions.
Rename “Beep.sys” to “Beep.old” (just in case)
Copy “Beep.sys” from an XP machine to this location.
Related
I would like to know how to detect if current windows is playing any kind of media (video, music, etc) similar to what energy settings do to decide if the computer can enter sleep/hibernate mode?
I'm trying to detect how long the computer is idle. I'm currently using the GetLastInputInfo from user32.dll but it just take in consideration the user input, but not if there is any media playing which should not consider the computer idle.
I tried to find C# APIs or native invocations but can't find the information. I'm using latest version of .NET Framework.
Generally speaking, programs don't declare that they are playing media - instead they call SetThreadExecutionState to tell Windows that the computer should not sleep.
That said - Windows 10 recently added support for programs to declare to the OS that they are currently playing media so that they're integrated with Windows' media controls (like how on iOS any program playing video or audio can be controlled from the Control Center).
Here's what appears on my screen when I nudge my volume control:
...however Chrome is being buggy here because I'm not actually playing any media in Chrome but it's telling Windows that it is.
I don't know what Windows API is used to set this - or which API is used to check it - but it isn't very widely used - even Windows' built-in Windows Media Player 12 doesn't use it.
I've used the following code and it expects to sound through the system speaker. The code really sounds but through the sound card (desktop speaker/headphone).
I think it will be possible to make some sound directly using system beep speaker since in device manager it displays the driver for that. Is there any work around for this.
** Not through default speaker / headphone. -- os win7 or 8 **
Console.Beep(i, 100);
EDIT
It is confirmed that win7(at least 64bit or both and newer ver.) dose not use system speaker and instead they routes the call to default sound device.
But my concern is,If the system speaker(hardware) is available and connected, isn't there any other way to access the device directly without using built in APIs to windows. I'd like to do some experiments on this(direct hardware access) and if you can at least provide me some starting point for this.
According to article below, it is not supported in Windows 7 x64.
https://blogs.msdn.microsoft.com/larryosterman/2010/01/04/whats-up-with-the-beep-driver-in-windows-7/
Windows 7 hardware requirements for 64 bit machines didn’t include support for an 8254 PIC chip, which is required for the internal PC speaker beep, so Microsoft changed how this functionality works for Windows 7 and the beep instruction is now re-routed to your Windows audio output instead.
So, it can't be done.
Maybe a configuration of your device is needded. You can try to understand from this: https://superuser.com/a/230167
I was wondering how to get device-specific information programmatically using C# in the new Universal Windows app platform. This is to get a simplistic PC Toolbox I have from existing C# code for an old Windows Form project onto the UAP in Windows 10.
I'm looking to get total RAM installed (or available), CPU Architecture and ID/Name (such as 64-bit Intel Core i5-XXXX), Device manufacturer and model number (Dell XPS XXXX), and serial number/service tag.
It's a given that these apps will be using Windows 10 and this app will initially be geared for traditional PCs, but I'd like to expand to Windows Phone/Mobile with limited capabilities (not sure how/if some parts will work on ARM). How would I detect which edition of Windows 10, such as "Home", "Pro", "Enterprise", "Mobile", or "Mobile Enterprise", as well as 32/64 bit, and Language?
I have existing C# code that used a library that doesn't seem to work with Windows Store apps.
I'm pretty rusty with C#, but any help to any classes or references would be greatly appreciated. I realize that getting all the code to store all of these specifications may be a little much (if even possible ATM), but a pointer in the right direction would be very helpful.
You can tap into AnalyticsInfo and AnalyticsVersionInfo to get the information, as noted on the documentation page (https://msdn.microsoft.com/en-us/library/windows/apps/windows.system.profile.analyticsinfo.aspx)
If you want to get the HardwareIdentification information however you will need to look somewhere else as it is not part of the Universal Device Family, it's part of the Desktop and Mobile family (device family specific).
To get this type of device-speficic info available, you have to add the references to the device specific extensions.
Anyways, The APIs that were used to gather these data have changed from 8.x to UWP. I have found one blog post <https://www.suchan.cz/2015/08/uwp-quick-tip-getting-device-os-and-app-info/> for someone who has created a helper class that retrieves the following properties for example from a Windows 10 UWP app
current OS family - phone/desktop/...
current OS build number - 10.0.10240.16413
current OS architecture - x86/x64/ARM
current App Display Name
current App Version - 3.0.2.0
current Device manufacturer - Nokia
current Device model - Lumia 1520
In his post he shows how to get basic data about current device, operating system and application. hope it helps!
Take a look here:
https://msdn.microsoft.com/en-us/library/windows/apps/windows.system.profile.aspx
https://msdn.microsoft.com/en-us/library/windows/apps/windows.system.profile.systemmanufacturers.aspx
These will at least give you the SM Bios Serial Number and possible information about the hardware.
I would like to use a monitor which is actually marked "disconnected" in the windows control panel under "Change display settings". (I do NOT mean a physically disconnected monitor.)
I know how to add a second monitor in Windows and make it part of desktop. I also know how to make my application run on a primary or on secondary monitor when they are part of desktop.
I have a piece of equipment attached to the PC which has a touch screen on it. The touchscreen is connected to the PC over USB looking as an ordinary USB-Monitor and I can make it part of my Windows desktop. But that is not what I want.
What I would like to do is make sure that only one special application can run on this monitor. I also do not want to have a windows desktop on it because than the user could move any window to it which is not what I want. The idea behind all this is to use the touch screen to have an application on it which can control this external piece of equipment. The user would only have to run the PC but not to login. I was thinking about starting the app from a windows service before the windows desktop is loaded. And once the user logs in I do not want him to be able to use the touch screen for anything else except this special application. That is why the touch screen must not be part of the windows desktop but ”deactivated”.
I am using . NET 4.0 and C# for my application, but I will use C++ or whatever comes handy.
Any help or idea is appreciated. Thank you!
It seems WDDM does not support independent displays any more. Here are a few links in case somebody wishes to take a look for himself:
(old MSDN link) = /windows/win32/gdi/multiple-display-monitors
(old MSDN link) = /windows/win32/gdi/using-multiple-monitors-as-independent-displays
The important part is this note from the second link:
ⓘ Note
Using other monitors as independent displays isn't supported on drivers that are implemented to the Windows Display Driver Model (WDDM).
I have a Windows Media Object in a C# WebBrowser control. We've got what are basically .AVI files, and the files have been given a custom header. In order to play these we have a custom DirectShow filter.
The videos can be played back inside Windows Media Player, and inside a Windows Media Player Object in IE9 on Windows 7, and in IE8 on Windows XP.
The video playback also succeeds inside the C# embedded WebBrowser control in XP, but not on Windows 7. When trying to use the Windows Media Player Object in the C# WebBrowser control in Windows 7 we receive a message stating: "Windows Media Player cannot play the file. The player might not support the file type or might not support the codec that was used to compress the file."
It's exactly the same code each time, so does anyone have any idea why the specific combination of Windows 7, the WebBrowser Control, and Custom DirectShow filters fails to playback the video, when everywhere else it functions correctly?
You need to do more debugging to get an idea what is going on. First of all, you need to check out if playback at all picks up your DirectShow filter, what kind of methods are called, are there any errors involved, in what way this is different from other systems where playback takes place successfully.
The problem was that our DirectShow Filter was only built as an x86 DLL. For some reason the WebBrowser control in C# defaults to using a 64 bit IE backend if available, and that version wouldn't work with the x86 DLL we built, because the WMP Object only looked into registry entries for 64-bit versions of Filters.
By setting your build configuration in Visual Studio to target an "x86" CPU rather than "Any CPU" for the application that runs the WebBrowser control, you can ensure that even on a 64-bit version of Windows that the WebBrowser control uses the 32-bit back end.
Seems quite a few people had the same problem with Flash before a 64-bit build was available for it.