Get hWnd for XAML control in Windows 8 (Metro) app? - windows

I need to pass a hwnd to a native dll that is going to write raw video to the frame. In WPF this works because you can get a hwnd reference from a control. Is this possible in a Metro app?

It is not possible to get HWND for a control, because Metro doesn't have HWNDs.
If you can get the video stream, try using a video brush and setting the source.
Otherwise, look into SharpDx library, which is a managed port of DirectX. I think you can draw 'stuff' to an element from it.
Hope this helps.

Related

Using winapi and opengl functions(c++) in Qt application (wndproc)

guys! We have working Project win32 with winapi functions which draws cube. We create a WNDCLASS and opengl context there for drawing. Can we use same functions like WinMain and WinProc in Qt for windows message processing?
We tried to do it, using hwnd of the window, without creating WNDCLASS. But after that we have just window without drawing area and rendering.
We should use winapi functions for next unloading theese functions in dll and use them in python and delphi.
Here is cpp-file
http://rgho.st/7KwpPfxZG
QT is a cross platform framework and takes care of hiding away things like WinMain and WindowProcs and instead provides a platform neutral abstraction.
Fortunately OpenGL is directly supported by QT - and they even have a page showing how to integrate OpenGL with QT here:
QT GUI OpenGL Window

Access every window's rendering area

What is the best way to access the rendering area of every single window in Microsoft Windows, so I can render them myself in 3D? I know the Desktop Window Manager (dwm) gives every window a rendertarget and renders them alltogether on the screen.
There are tons of 3D window managers out there, but finding some code or other information is hard for me, so I'm asking you.
I would like to do it in OpenGL, but I can imagine it's just possible in DirectX, but that's fine too.
Thanks in advance!
You have to use the operaring system / graphics system specific API dedicated for that task. OpenGL is operating and graphics system agnostic and has no notion of "windows".
In Windows the API you must use is the DWM API. For Windows versions predating the DWM API (XP and earlier) some "dirty" hacks have to be employed to get the contents of the windows (essentially hooking the WM_PAINT and WM_ERASEBACKGROUND messages, and the BeginPaint and EndPaint functions of the GDI to copy the windows' contents into a DIBSECTION that can be used for updating a texture).
In X11 the API to use is XComposite + the GLX_ARB_texture_from_pixmap extension

Win32 creating windows 7 status flyouts

I am trying to create a Windows 7 status flyout like notification in the bottom right hand corner of my desktop. Any guidelines on how to accomplish this using win32 (and without having to write a ton of code) are much appreciated.
Thanks.
If you can use .Net, this or this shows how to create custom flyouts quite easily (both use P/Invoke so they should be pretty easy to port to anything else), even more simply you can use NotifyIcon.
Doing this from C or C++ you can either use Shell_NotifyIcon for the simple ballons or a custom (borderless) window animated with AnimateWindow or SetWindowPos and a WM_TIMER for the fancier slide-up/fade-in style popups/notifications.

Drawing an IplImage within an MFC Dialog Application

I have an MFC dialog application that I am using as the front end for some image processing with OpenCV 2.1. I would like to move away from using the cvShowImage and place my image directly on the dialog box or a suitable container. I've found examples that with a technique using an MFC SDI application with a View/Doc model, but I can't figure out how to convert that.
I'm curious if anyone has done this and/or knows where an example may live that does this?
Also, this is my first MFC application.
Thanks all.
There is a CvvImage type in highgui with a drawtoHDC(or simialr) function that will draw into a bitmap

How easy is it in DWM to make an 'always on top' thumbnail for an existing window

I really like when you hover over a window in Vista on the taskbar and it gives you a little preview. if it is video it even plays in the thumbnail.
Often I really wish I could 'tear off' this little window and keep it as an 'always on top' thumbnail on my screen. Maybe its a progress bar I'm watching, maybe its a video i want a little tiny preview of.
Isn't this the kind of thing that DWM makes it easy to program. Would this be a simple endeavor to program in nice managed C# - or would i end up getting all bogged down in tricky API stuff?
I am interested in both existing solutions and pointers on how to code something like this.
Sorry for the self-promotion here. :)
Just mentioning there's already an app that allows you to clone every top-level window and keep their preview "always on top": OnTopReplica.
The program is based on the Windows Forms Aero library, a .NET (c#) library that includes some DWM wrappers. No tricky API stuff needed (besides, the API is pretty simple anyway).
A very good preview of how to use this in C#:
http://community.bartdesmet.net/blogs/bart/archive/2006/10/05/4495.aspx
Yes, you can create your own taskbar-like thumbnails. You're going to have to do quite a bit of window handle manipulation though. How it works is basically that you create a child-window in your form that will be the thumbnail. You obtian the window handle of the top-level window you want a thumbnail of using the usual tricks. Then you call a DWM function DWMRegisterThumbnail to associate the two. You don't actually get involved in painting the thumbnail at all - once the windows are associated, the DWM compositing process takes care of painting a thumbnail of the top-level window in your form.
MSDN Documentation

Resources