videoinput with C# - c#

I have a video capture (usb-webcam) application that currently uses very old VFW with p-Invoke hookup to C#. I'm trying to replace it and I stumbled on the VideoInput library, and later found VideoInputSharp. I managed to get VideoInputSharp into my application and it gives me the frame rate and camera control I need. The problem is that on some PCs the call to VideoInput.IsFrameNew() never returns true even though the device is set up (VideoInput.IsDeviceSetup() does return true).
I've successfully run this on a W7x64 system and a XPx32 system, but does not work on W7x32. Any thoughts on why this is happening?
UPDATE1:
Since originally posting this question, I've found that on the systems that don't work, I am still able to call VI.ShowSettingsWindow() to generate a dialog box; however, it is a different dialog box than I see on the systems that work (even though it is the same camera/driver). Is this a clue? Also note that I'm running the same version of DirectX on the machine it works with and the machine it doesn't work with.
UPDATE2:
The systems that this is failing on are W7x32 and W7x64 both using a Microsoft LifeCam. I found yesterday that if I remove the Microsoft LifeCam software from the machine it then works! I sure could use an explanation for that.

Related

HoloLens Networking Issues on Windows Holographic Version(21H1)?

Since a while I am working with HoloLens2. My last OS-Versions were 10.0.18362.1005 and 10.0.19041.1109. I am developing with Unity 2019.4.7. My whole code was and still is running great on those old OS-Versions. Now I updated to OS-Version 21H1 and I have huge problems with everything including networking.
For example, my Mixed-Reality-WebRTC Pluging (from Microsoft), which only supports ARM-Architecture, does not work anymore on my new Device. The app crashes after it was successfully starting.
Another thing is, that the DevicePortal does not transmit virtual inputs. Again, on my older HoloLens2´s Virtual Input works great.
Also, even if I disable WebRTC parts of my Project, I still get an Exceptions in my Networking-System which I can´t assign to any cause. In term it is useful for you, I work with windows.Networking Library and in special with DatagramSocket.
I would be really glad if anybody could help me with this. Is OS-Version 21H1 restricted to any specific Unity- or VisualStudio Version (here currently I use 16.4.5)? Or is it Restricted to specific Networking Libraries? Thanks in advance!
Now I was able to fix the Networking Exception. The reason for that is located within my UDP-Communicator which uses DatagramSocket. Since earlier .Net.Sockets was not available at HoloLens2, now it is and I coincidentally came across this information. So I switched my implementation to .Net.Sockets which already exists in my project for editor-usage and now basic networking works fine.
Also, I was able to make WebRTC work again. With one of my Provisioning-Packages I disabled the usage of microphone for mixedReality and it seems like access to those audio-informations is mandatory for MR-WebRTC.
Unfortunately, I still have the same issues with Device Portal.This really looks like a bug.

D3DImage loses device on WPF application

I am developing a WPF application that displays a directX scene.
The code that generates the directX scene is not mine and I have no access to it. (Its not a public code I can references you guys to)
Everything was working fine until I had to format my PC and installed Windows 10. (Before that I had Windows 7)
Now I can't see the DirectX scene and the RenderCapability.Tier on WPF returns 0.
The code works on other computers (Windows 7 and Windows 10) so I'm guessing its something to do with my computer but nothing changed hardware-wise..
I tried reinstalling DirectX and I tried reinstalling the display driver (tried several different drivers) but nothing works I still get RenderCapability.Tier = 0.
The code that displays the DirectX scene is mostly taken from this link:
https://www.codeproject.com/Articles/28526/Introduction-to-D3DImage
I couldn't find any help around the internet that actually solved my problem.
Any help would be appreciated.
Thanks!
Run dxdiag.exe, Display tab, ensure it prints "D3D acceleration: enabled" and "No problems found".
Also the linked sample has a bug, on some systems you must use a query to wait for completion of rendering before passing the texture to WPF. Otherwise WPF may show incomplete renderings, or none at all. If you render with DX9, see this, you need D3DQUERYTYPE_EVENT query, issue D3DISSUE_END after you've done rendering, then sleep until GetData returns S_OK.

"Google Maps API does not support this browser" in WinForms WebBrowser control

As of last week, users have started getting a script error saying "The Google Maps API does not support this browser" when trying to map directions using the Google Maps API from within an embedded WebBrowser control in our application. I have run into issues like this before, but was able to work around them using IE browser emulation. However, it is now erroring no matter which version of IE I have installed, which version I emulate (including IE11), or whether emulation is turned off completely. Prior to last week, this was working correctly, so I'm assuming Google changed something on their side.
Here is an example URL that gets this error: https://www.google.com/maps/dir/?api=1&origin=123+Main+Street,+Dobbs+Ferry,+NY&destination=123+Main+St,+White+Plains,+NY&travelmode=driving
Does anyone know of any fixes or workarounds other than replacing the terrible WinForms WebBrowser control entirely?
I figured out what was wrong after reading this article. When turning on browser emulation, I was enabling it in ...SOFTWARE\WOW6432Node\Microsoft\Internet Explorer... in the registry instead of ...SOFTWARE\Microsoft\Internet Explorer... because I was running on a 64 bit OS. However, you are only supposed to use the WOW6432Node path if you are running a 32 bit application on a 64 bit OS. I changed it to use the other path for a 64 bit application on a 64 bit OS and it now works. Thanks for the help!

Debugging by attaching a process for windows phone apps

I'm currently running VS2013 Update 3, I'm building an app and i;m trying to mimic the Rate My App that shows up rate message dialog in b/w specified intervals.
My problem is that i've made a setting using ApplicationData.current.loclasettings and it is an integer.
and i want to see the settings number being updated every time i close and run the app to ensure the logic is perfect.
but i'm unable to do it. Every time i deploy the app from vs it replace the original app and thus erasing all the settings that have been previously saved.
I've tried to use attach a process but it doesnt work on windowsphones.
Well after a bit of research and going through the documentation it is clear that there is no way you can attach a process to the app that is already running on the phone.
At least for me there was no other way because Microsoft kept the USB debugging thing a little bit undocumented or not documented at all.
So, who ever are looking forward to first launch the app on a connected windows phone and then start the the connect to a process and select the appropriate device for communication , story it is not possible, at least the build that i;m using doesn't support. may there might be a better solution in the future.

How can I programmatically manipulate Windows desktop icon locations?

Several years back, I innocently tried to write a little app to save my tactically placed desktop icons because I was sick of dragging them back to their locations when some event reset them. I gave up after buring WAY too much time having failed to find a way to query, much less save and reset, my icons' desktop position.
Anyone know where Windows persists this info and if there's an API to set them?
Thanks,
Richard
If I'm not mistaken the desktop is just a ListView, and you'll have to send the LVM_SETITEMPOSITION message to the handle of the desktop.
I googled a bit for some c# code and couldn't find a example, but I did found the following article. Torry: ...get/set the positions of desktop icons?. It's delphi code, but I find it very readable and with some P/Invokes you'll be able to translate it to c#.
The desktop is just a ListView control and you can get its handle and send messages to it to move icons around using LVM_SETITEMPOSITION.
Getting icon positions using LVMGETITEMPOS is a bit more complicated, though. You have to pass a pointer to a POINT structure as your LPARAM. If you try to do that, you will likely crash Explorer. The problem is you passed it a pointer in your address space, which the control interpreted as a pointer in Explorer's address space. Ouch!
The solution I've used is to inject a DLL into the Explorer process and send the message from there. Then you just have to have a way to get the position info back to your process.
I am still looking into this and will post the result once I finally get something working. I'm posting this because, thanks indirectly to Davy's post, I also found a classic VB implementation:
Shuffle Desktop Icons Using Interprocess Memory Communication
and that will probably be the basis for my code.
I have no idea about the API, but I know Ultramon (http://www.realtimesoft.com/ultramon/) has a feature included for preserving icon placement (although I've never used it for preserving icon location, it is indispensable for multiple monitor usage). The latest beta release works flawlessly with Vista (except for sometimes having a minor glitch or two when initially logging into my machine via RDP), and of course, haven't had any issues with XP. I've used it for over four years now.
And did I mention that it's the best utility for multiple monitor usage?
may be you want this one?I find it in 《WindowsCoreProgramming 5th》 https://github.com/wang1902568721/WindowsCoreProgramming

Categories

Resources