Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - canawa

Pages: [1]
1
Graphics / Saving the contents of the foreground window to a file
« on: February 03, 2010, 09:11:33 pm »
Oh well, no shortcuts for me.

Thanks for the reply, it's rare to see a library author who answers questions personally. Off to Win32 I go!

2
Graphics / Saving the contents of the foreground window to a file
« on: February 03, 2010, 06:05:41 am »
Hi, I'm just making a little program that needs to do what it says in the topic title for some reason. When I say foreground window, I mean whatever was open before the program was run. Is this possible in SFML?

The code below creates a new window with the dimensions of the foreground window, but doesn't copy its contents (doesn't make the copy window appear, either), so the .png file that is created is full of random garbage instead of a copy of the window contents.

Code: [Select]
{
HWND hWindow = GetForegroundWindow(); //From <windows.h>

if(hWindow == NULL)
throw "Foreground window error";

RenderWindow window(hWindow, WindowSettings(24, 8, 0));
Image image = window.Capture();
image.SaveToFile("test.png");
}


Is there a way to make this work, or do I have to use OpenGL, Win32, or something like that to accomplish this?

Pages: [1]
anything