I'm developing a C# application with the Kinect, and I'd like to relay back to the user their reflection (with the RGB camera) or the skeletal view while they're using the application. Is that possible? Or is there a better way to show the user what the camera sees while running?
Thanks!
The Kinect for Windows Developer Toolkit has examples that do exactly this. There are multiple examples Demonstrating how to display the depth and color streams, as well as how to show the skeleton by it'll or overlayed on the video stream.
The "Kinect Explorer" example is the more advanced of those examples, showing how to put it all together.
How does VNC send REPAINT messages to windows even when a user is not active?
I would like to implement this in C sharp - I've had a look at the PrintWindow, SendMessage methods and none of them achieve the same thing as VNC (tested by capturing images and its black) but with VNC I get the full picture.
What techniques are they using to do this and can this be implemented in C sharp to get windows to always repaint even when a user is not active (i.e. RDP is closed, minimised or similar).
Thanks all
You could use the technique used by video games, which consists in redrawing permanently a window during CPU idle time.
I found a C# implementation here.
You just have to adapt it to your needs.
VNC does NOT send WM_PAINT messages
Windows does (and it does not care whether a user is active). See also
Is it possible to screenshot a minimized application
How to get the screenshot of a minimized application programmatically?
Capturing screenshots of a minimized remote desktop
I'm creating a optimized web page for mobile devices with C#. Is there a way to offer a page for larger screens and one for smaller screens on android devices? With Apple i can differentiate between iPad and iPhone, but how can I do this with the galaxy tab or a regular android phone?
I don't want to use any javascript in this case.
First of all i would suggest you you JavaScript for that as you could write you own code code to detect the screen width and height and style the page accordingly, but then again it is your choice.
There are however 2 possibilities (if you really don't want JS):
#media queries to where you can state different css styles (media-dependent style sheets) that work for different screen heights, widths, resolution and even more if it is a handheld device, print, etc
read http://www.w3.org/TR/css3-mediaqueries/ for general idea or Bingoogle "media queries and you will find a lot of info"
second solution is http://mdbf.codeplex.com/ which apparently is going to be removed on 29 Oct. you put the downloaded file in the "App_browsers" of your ASP.NET application and you serve back to the client the tailored page to his request. You can intercept the client's browser's feature during "Pade_Load" using "Request.Browser.[feature]" where feature can be ScreenPixelsWidth/height and build your page accordingly. This is really ugly since the document is man-made and man-updated, so if a new browser/screen size shows up, someone has to put it there manually so either you have to do it yourself (or somebody else) or it is not up to date.
I don't think that there is a way to do this without using java script. Think about how you would determine the screen resolution of a normal browser. There is not much difference to that with the android browser. It is a OS that runs on very much different devices that can not possible all be known to your application. To totally optimize your page you have to ask the client for its screen resolution.
i need to get Image of hidden IvideoWindow ("ActiveMovie Window"), which shows webcam preview. As far as i can tell preview isn't overlay, it doesn't have overlay features, i can use printscreen on it, but i need window to stay hidden all the time, so that won't help. Also PrintWindow() api function returns me black screen.
Programming languages: c#, c, c++, java, pascal.
Operating system: Windows XP.
Any ideas?
The trick is to show the window but outside the desktop. Set the left position at the desktop.width+1 (not screen.width, because users may have multiple screens) and then make it visible.
That way normal functions like printscreen work and users still won't see it.
I'd like to make an animated desktop background for Windows 7 using DirectX. I'm using C#, SlimDX and a couple of P/Invoke imports of Windows API functions. I'm not brilliant with native Windows programming, but I've had a poke around online and I believe what I need to do is either:
1) Find the handle of the window containing the dekstop wallpaper, hook it up to a DirectX device and draw into it.
2) Make a new output window, and insert it above the desktop wallpaper but below the desktop icons.
I've tried both these, but neither seems to work. If I navigate the Window heirarchy starting from the handle returned by GetDesktopWindow(), I can go Desktop -> WorkerW -> SHELLDLL_DefView -> SysListView32. If I hook up a DirectX device to this handle, I can draw over the entire desktop, but it also covers the icons. If I create a Windows form, set its parent to SHELLDLL_DefView using SetParent() and then use SetWindowPos to play with its Z-order I can only seem to get it to go either behind the desktop wallpaper or in front of the desktop + icons.
It looks as though the desktop wallpaper is background to the folder view containing the icons, and therefore what I am trying to do cannot work. The only solution then would be to not use the desktop for icons, or to find some alternative, e.g. overwriting the desktop then overlaying a transparent window containing a view of the contents of some folder.
Does anyone have any idea of what I should be doing, or even whether what I want to do is possible? It seems you can draw to the desktop background using the GDI (as I believe the wxSnow program does), and I've seen something similar to what I want done by VLC Media Player under Windows XP with its DirectX wallpaper mode (interestingly, I can't seem to get this option enabled on my system).
Thanks!
Looks like this might not be possible. See this link:
http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/69839cec-3424-4300-9ac3-486b8c2fe492
If you need to draw some controls
between the desktop background and
desktop icons, an alternative step is
below:
Create your user control in a windows control library.
Embed the user control in an ActiveX control.
Embed the ActiveX control in a web page.
Enable active desktop and set the web page to be your desktop
background.
This can only be done in XP since
Vista doesn’t support active desktop.
Another post there suggests that you could possibly do this with the background of an explorer window - if you could get the handle of the window that constitutes it. Of course, if that's possible then it may be possible also to get the handle of the desktop window behind the icons.
Update: Well, so far the only thing I've found that could possibly "work" is just creating Bitmap files and changing the wallpaper over and over again (I suspect this would be slow, as you mentioned).
That full screen image must be resident in memory somewhere, but there may be no way to access it without some serious low-level memory hacking. I'm going to keep looking.
Update 2: This might work, but I'm not sure:
http://social.msdn.microsoft.com/forums/en-US/vcgeneral/thread/4af734fb-d2c1-414b-a9f1-759b76692802
The meat of it is this:
HWND p = FindWindow("ProgMan", NULL);
HWND s = FindWindowEx(p, NULL, "SHELLDLL_DefView", NULL);
HWND dtw = FindWindowEx(s, NULL, "SysListView32", NULL);
HDC hdc = GetDC(dtw);
You're basically starting with the ProgMan window and drilling down from there to the desktop wallpaper ("SysListView32", I guess). I'm going to try this out.
Update 3: No go - the above code does get the desktop's DC, but it's above the icons so BitBlt draws over them. It's not drawing to the Screen, though, because I can draw underneath an open form without covering it, so that's progress at least.
I'm guessing that there's some window available other than "SysListView32" that is the desktop behind the icons, or there's more than one "SysListView32" window.
Update 4: I'm pretty sure something using this would work:
http://msdn.microsoft.com/en-us/library/bb761155(v=VS.85).aspx
http://msdn.microsoft.com/en-us/library/bb774742(v=VS.85).aspx
Basically, it's an API method that you call, passing in a structure which include a bitmap handle. If the call is successful, that bitmap becomes the desktop.
Does DirectX expose frames as bitmap handles (GDI-compatible), or does it only expose the DC? In my case, my animation is already an array of GDI-compatible bitmaps, so I would have no trouble using this approach. If this is the only route, and DirectX doesn't expose the bitmap handles (and I don't think they would), then for each frame you would have to create a new GDI bitmap, which would slow things down quite a bit.
Actually, there might be an easier way, although I'm not sure it would work. Once you get the handle to the actual bitmap of the wallpaper, you can select it into a device context using SelectObject, and then just use that device context as the BitBlt destination. You might have to send a repaint instruction to the desktop, though, which might trigger the icons to be repainted every time.
How about you do some work here? :)
I guess you could get quite a few frames per second by dynamically generating bitmaps and constantly setting these as the desktop background. However, this sounds unnecessarily (almost stupidly) heavy for the CPU. Update: Now that I think about it (it was late when I wrote this), the main problem with such an approach is that you need to write and read bitmaps from the hard drive every time a new frame is to be displayed. This is not feasible.
Are you really using the desktop for icons? In Windows 7 the start menu search function and the new taskbar has made me not use the desktop for icons.
Just an idea
It might be possible to alter the desktop window, by means of SendMessage(GetDesktopWindow, WM_SOME_MESSAGE, wParam, lParam), so that you can achieve what you want. I might investigate this further tomorrow (currently 3 am, local time).
I've done some animation of alpha blended windows that are always on the top of the Z-Order. One idea would be to ignore trying to modify the desktop bitmap and just draw your stuff as a layered window but manage the ZOrder somehow so it is always the bottom-most, non-desktop window (perhaps by strategically calling Form.SendToBack() or something at the right times).
Depending on what you are trying to do this may give you the same effect of animating the desktop.