c# beep through system speaker - direct access to sys. speaker - c#

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

Related

Internal Speaker Beep in Windows 8 Embedded Standard

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.

Beacons in Windows Phone 8.1 - there are no possibilities?

First of all, yes, i have read all other similar questions.
Secondly, i am developing app (WP 8.1 WinRT), which must use Beacons. I read a lot about it, and i know, that generally connection with BLE device is not possible without pairing it first. But hope dies last, so i want to ask about any possibilities I have. It is possible to pair devices in code (according to articles I have read - its not, but maybe someone know the way)? Or just obtain nearby Beacons Id or Name, or ANY information about them? All posts i have found are outdated (from last year, maybe MS or somebody released some update/api?) I search for any kind of solution, api or just idea how to avoid pairing problem. Pairing it manually won't work - 1. not sure if it is possible to pair beacons, 2. its too many of them (beacons I need)
I look for anyway to communicate or even obtain beacons.
I would be grateful for any option or idea
While I have not tried it yet, there a developer has built an HCI layer to talk directly to bluetooth dongles on pre-Windows 10 machines. It is available here: WinBeacon
This will only work on desktop machines, and not with mobile phones. If you are interested in mobile phones with Windows 8.x, I do not believe there is any solution. I have spoken with Microsoft engineers who have confirmed this to me.
The fundamental problem with Windows 8.x on mobile devices is that any Bluetooth LE scan operation (which is what must be done to search for beacons) must be initiated by the operating system. There is no public API and no known private API that can be used to initiate a Bluetooth LE scan. Pairing with the device will not help -- it is the scan that is important and iBeacon and similar BLE beacon types do not use pairing at all for their primary proximity detection purpose.
Microsoft engineers have told me there are no plans to add this feature to 8.x, as they want to push folks to Windows 10.
While I know this does not help for Windows 8.x, I will note for the record that for the upcoming Windows 10 release, we are working on a port of the Android Beacon Library to Windows here.

Detecting if device is used as laptop or tablet

With many new devices such as the Vaio Duo, Vaio Flip, XPS 12, Lenovo Yoga, etc., which are all ultrabook/tablet convertibles, how can I detect which form factor its currently operating in? I know that the Vaio Duo switches performance modes depending on whether its being used as a laptop or as a tablet, so there should be some way, whether it be through pinvoke or something else.
In Windows, to directly check if your system is in tablet (or "slate") mode or not, you can call GetSystemMetrics(SM_CONVERTIBLESLATEMODE). For a discussion of a sample app that does this, check out https://software.intel.com/en-us/articles/how-to-write-a-2-in-1aware-application.
As well as checking on startup, you should be able to get a WM_SETTINGCHANGE message if the mode changes, which will have "ConvertibleSlateMode" as its LPARAM. In some cases, though, we've seen this message lost. So, it's a good idea to have a manual way to force a mode change in your app anyway.
Shouldnt your program work the same for all form factors, so there for it wouldnt matter which form factor there in.
Also have a look at this if you do need to access that sensor then this may help you.
http://archive.msdn.microsoft.com/WindowsAPICodePack/Release/ProjectReleases.aspx?ReleaseId=4906
This will get you all of your sensors.
Microsoft.WindowsAPICodePack.Sensors.SensorManager.GetAllSensors();
I've been working on this today. So I decided create a wrapper cause I haven't found one. I focused on universal portable class library (because of dispatcher used in monitor) but I can port to...
Here is:
https://github.com/daemun/DeviceExtCapabilitiesUniversal
Found a lot of information on this here: http://software.intel.com/en-us/articles/ultrabook-and-tablet-windows-8-sensors-development-guide

Can I programmatically determine the make and model of a handheld device and belt printer?

Working on some legacy code with Windows CE using Visual Studio 2003 running in an XP Mode Virtual Machine on Windows 7.
I am writing some code that runs on handheld devices, and need to know which make and model they are. Is there a built-in call I can make to query the handheld device as to its identity?
Similarly, I will programmatically deduce the make and model of the belt printer that the handheld device is attached to, so that code can branch based on these details.
You might try getting the Device Name and ID with calls to KernelIoControl calls passing in IOCTL_HAL_GET_DEVICEID. There's an example on MSDN. That might be able to determine the handheld model.
As for the printers, it's unlikely you can tell the difference - though it depends on how exactly they're connected. If it's serial there's no way. If it's USB, it's unlikely unless they use different drivers. If it's networked, then it's not going to happen. If it's Bluetooth, maybe the device name has a pattern based on model you can use.

Accessing WiFi information from Windows Phone 7

I am currently trying to extract WiFi information such as signal strength and MAC address from my windows phone 7.5 for an accurate location app I am working on. The OpenNETCF.Net framework has all the functionality I require (and is even described my MSDN: http://msdn.microsoft.com/en-us/library/aa446491.aspx) however I cannot seem to be able to import the namespace into my project using visual studio. It complains that the framework was not designed for windows phone projects. Is there any way around this? Or does there exist and equivalent framework which would work on WP7?
Thank you
Windows Phone 7 is only distantly related to Windows Mobile & Windows CE (for which that library is for).
There are a few how-tos for dealing with network information on MSDN, although I don't believe that WiFi signal strength is made available to apps at this point in time.
It is worth noting that there is a specific how-to for accessing location information, where the operating system can use Wi-Fi signal information to help triangulate location, where GPS is not working.
I'm afraid that it is impossible on Windows Phone current version

Categories

Resources