Some drivers use parameters written in the registry to configure themselves when they get loaded at boot time.
I can modify those values and then reboot, but I would like to know if it is possible to force the driver reload, making the changes effective without rebooting.
Specifically, I am talking about the video driver (nvidia).
I read somewhere, that calling through pINvoke() [User32.ll]::ChangeDisplaySettings() with a 640x480x8bits resolution,(which is so low that it should not be supported by a modern driver) will force windows to load the "Standard VGA driver", and making another call with the current resolution will load the nvidia driver again.
This does not work though. At least in Windows 7, even if the low res is not displayed as "supported" the system reduces the screen to a little square in the center of the screen, showing the low res wihtout unloading the nvidia driver.
So, is there any .NET/Win32 API, service to restart, or any way at all to force a video driver reload?
Perhaps programatically disabling the device (as you could do from the Device Manager) and reenabling it again?
Any idea?
Thanks a lot.
I finally did it. Following the idea of disabling/reenabling the device actually worked.
Of course the problem is that disabling your video card device from the Device Manager could not be a great idea, as maybe you are not able to reenable it again.
Doing it programatically, does not appear so unsafe though. In theory, asuming that the app has successfully disabled the device, reenabling it should not pose a problem.
I found here, in stackoverflow a fantastic class to accomplish this, thanks to Justin Grant.
The video driver reloads itself as the video device is reenabled.
Hope it helps someone.
It depends on the driver. If it was written to support stopping and restarting then it is possible; otherwise, you're out of luck. If you find the name of the service you can do "sc stop [name]" followed by "sc start [name]". Win32 equivalent is OpenService/ControlService.
Related
I'm developing a Bluetooth app using UWP framework under Visual Studio 2017. Everything is going well thanks to Microsoft Example (C# SDK Example BluetoothLE well written).
During my fourth day of development, the API BluetoothLEDevice.FromIdAsync in the line:
bluetoothLeDevice = await
BluetoothLEDevice.FromIdAsync(bleDeviceToConnect.Id);
Is no longer working, neither in my app, neither in the original sample from Microsoft I'm using as example (I don't touch anything on it).
I don't understand as I changed nothing (in my project properties, neither any Windows update on my computer). When I call the function, it just never return.
I tried my Bluetooth object used with some smartphone app, and my hardware is working well.
The call is made in a try but no exception is catch, the function just never return (and I wait some time, I don't even have a timeout).
Have you seen this? Any input on how to solve it?
I'm totaly stuck and can't go ahead as I can't connect at all any object now...
If your code and the example code are having the same problem, the only reasons can be that your device is not available.
It is out of reach or even switched off or already connected.
It can also be that if you are using the deviceManager or deviceWatcher, your OS is providing stale information.
For BluetoothLE the windows deviceManager and watcher are nothing but trouble.
Windows sometimes keeps the pairing information and connection status, even if the device is out of reach or switched off.
Many times you have to remove and and re-add your device in settings to make it available again or a restart is needed.
To save you from all these troubles, I advise you to use the advertisementWatcher.
If your device is found by the advertisementWatcher you know it is in reach and connectable, and there is no need to add your BLE-device in settings.
If needed I can provide a simple example.
This may happen because of COM security (as you may know UWPAPI based on WinRTYY which works above COM). This should help.
Hello All and thank you for your help on this.
I got a shot on an other computer and it works just fine.
I double check this morning and found out that even Widnows can't connect to anything over Bluetooth (I tried with the Bluetooth Speaker I'm usually using).
It was a Driver issue, I don't know how it happens, but my computer Driver just stop working, and I add to reinstall it.
I compiled fine the Samples in Lime Video SDK. On a Windows 7 system works very well but I got error message in a Windows 10 system.
"You are not properly configured for either: A) GPU/IGP Quick Sync B) Software fallback
You may not continue until you fix one option for Quick Sync coding
Press a key to exit"
I don't know what is the problem. I dug the source but not found a solution.
This message simply means that you have not installed the correct Intel HD graphics driver for your OS/CPU combination, or libmfxsw64.dll/so cannot be found in the DLL path, which is the software emulation fallback.
Without the correct device driver or the software fallback DLL/so being loadable, the samples will not be able to run.
What’s the best way to be sure you have drivers setup correctly?
Use either or both of: “MediaSDK System Analyzer“ or ffmpeg with the “-vcodec h264_qsv” option. Sorry for slow response, just noticed this.
Researched a lot for Solution for recording voice in Background (When another app is running/ when phone is locked, etc).
Searched whole MSDN, stackoverflow for any solution regarding this, Still didn't find it.
Also checked the Api references, they say MediaCapture wont work in background.
But I found two apps, which can record in background. As reverse engineering is not possible with encrypted app, I can't check how did they achieve it.
http://www.windowsphone.com/en-us/store/app/pocket-recorder/eda4e045-733f-e011-854c-00237de2db9e
http://www.windowsphone.com/en-in/store/app/voice-recorder-8-1/511c6375-8bf3-4d19-8248-1650a60ea1ae
I checked whether they use Voip Capabilities, but it is not listed. So there is some other work around, But don't know how!. These apps are paid, so I wish to help community with free solution.
I don't believe you can do this with background tasks. This is because if your app has a lock on the microphone, you won't be able to perform certain functions with your phone (i.e. phone calls)
Yes, Voice Recorder can record voice at the background by stopping every audio files and listening from the phone mic. Even if you switch the screen off, or the screen shut off, the under dog software will still be very active and recording the least sounds it hears and very powerfully clear. Now, I am very surprised to find a software that broke the feats of windows phone, although the software can not allow you to copy the recorded file to sd card or to the phone memory unless a paid version. This is good all the same.
Up until now I thought that changing the system volume from your app is impossible, until recently a new app called Quite Hours (http://www.windowsphone.com/en-us/store/app/quiet-hours/f347a36b-80c0-430f-8631-e55046ee5a2a) actually did just that in a very neat way.
Does anyone please know how to do that programmatically? I tried using the MediaElement or the xna MediaPlayer and the backgroundAudioPlayer and nothing worked. Any help would be appreciated!
Thank you!
The developers of the apps mentioned in the OP were able to change system volume under WP8.0. Apparently whatever method they used has now been disabled under WP8.1. The following apps now display disclaimers that they no longer work on Windows Phone 8.1: Quiet Hours and Volume Manager
They direct to the following page to vote to allow this functionality: Windows Phone Dev User Voice
Additionally please read the following thread on the MSDN forum: MSDN change system volume Windows Phone 8. This functionality was likely achieved using WASAPI (which I have personally tried, and failed, it does not work, comment if you want my code to try it.), or the developers of the volume apps might have had access to AudioClientRestricted.h. If one had that h file, one would have access to system volume under WP8.1, so I somehow doubt the developers used the h file designated for OEMs because it would work un 8.1.
Talking with James Dailey (who works # MSFT) indicates it is technically possible using WASAPI ISimpleAudioVolume If you read # the bottom of that page there is a comment indicating you must use IAudioEndpointVolume
Added note from James Dailey # MSFT:
AFAIK there is no good way to manipulate the global audio level on
Windows Phone 8.1 (WP8.1). Theoretically you can change the audio
volume of any app that uses the default audio session “zero”. However,
if the app chooses to initialize it’s audio session with a custom
GUID you will not have access to the session volume for its custom
audio session. Again this is theoretical based on my knowledge of the
inner workings of WASAPI. I’ve never actually tried it on the phone.
To manipulate the audio volume of apps using audio session “zero” you
simply initialize your IAudioClient with an AudioSessionGuid parameter
of “{00000000-0000-0000-0000-000000000000}”. You can then use
ISimpleAudioVolume::SetMasterVolume to set the volume for this audio
session. You will need to use C++ / Cx since we do not support
calling WASAPI from managed code.
There currently is no API available for controlling the system volume. You can however control the volume in the elements of your application (via the classes MediaElement, BackgroundAudioAgent).
You can also control the volume on sound effects of your application using XNA API.
See http://msdn.microsoft.com/en-us/library/bb195052%28v=xnagamestudio.30%29.aspx
My webcam has a button, with which you take a photo of current frame
when using it's original software what came with it when I bought it.
Is there any way to use that button to take photos in my program.
I would be using C#.
I was thinking of using Windows Image Acquisition (WIA) or avicap32
for using webcam in my software.
Any help would be appreciated. Where do I start?
EDIT:
I see that you didn't understand me. I need to know if my phisycal camera button is pressed.
I am using DigiMicro 1.3 camera (Manufacturer is DNT), which isn't really a webcam but a USB microscope, but
it behaves like a webcam.
Does the camera actually require that the software be running when you press the button? I know some webcams implement this feature at the driver level. If that's the case, I don't think there's much you can do without interacting directly with the USB port, which would be incredibly difficult and likely not worth the trouble. I can't find any technical documentation on the vendor's website with that kind of information.
The "MicroCapture" software doesn't come with any DLLs that have exported functions, so P/Invoking doesn't appear to be an option. Unfortunately, I can't get the driver installed, so I can't check if it comes with any P/Invoke-able DLLs.
Sorry, but since there's no standard interface for that kind of functionality and the vendor doesn't provide any specific information on it, I don't think this is possible. I would suggest contacting DNT directly about it. They may have some component that will do what you need.
This Coding4Fun post guides you through pretty much everything you need to do to get started using WIA, including adding the reference to a project, displaying the select a device dialog, and of course actually taking the picture :P.
Coding4Fun - Look at me! Windows Image Acquisition
I suggest that you take a look at the DirectShow.NET library. It has great functionality for capturing images/videos off connected devices. It also comes with several samples to get you started quickly.