views:

395

answers:

1

I'm trying to write a simple app that will do a screen capture of an application and then rendering that capture in the 'main' application (ie, the application that took the screen capture).

I've figured out how to get the window handle and get the application's screen capture, but I'm having trouble rendering the captured screen in the 'main' application.

Using GDI, I have the following code to render:

Bitmap bit(hSrcbmp,hpal);
graphics.DrawImage(&bit,Gdiplus::PointF(0,0));

where hSrcbmp is a bitmap of the captured screen and graphics is a GDI+ 'Graphics' object.

I get the following error after the constructor call to Bitmap: Gdiplus::Image = {nativeImage=0x00000000 lastResult=Win32Error loadStatus=-858993460 }

*Using Visual Studio 2005

*Windows XP

*Visual C++ (non-managed)

Any ideas?

Another question: Any better approach? C# or DirectX or openGL? Thanks

A: 

Screen capture is a Win32 FAQ for 18 years.
See on win32 group for standard code (MS and other), C and C++

yes, screen capture, but what about re-rendering that same capture in a different window
cbrulak