Do screenshot in C++/CLI

Write your question here.
0


I use windows 7 and VS2010. I write a piece of C++/CLI code to do measurements, during which I want to make screenshot.

I have tried screenshot method in C++ (using GDI library), but failed to compile the file. So I suppose the GDI library could not be used in C++/CLI. How to do screenshot and paste to a word file in C++/CLI project?

Here is the code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
  #include "stdafx.h"

using namespace System;
using namespace System::IO;

int main(array<System::String ^> ^args)
{

String^ fileName = "AP_result.doc";

StreamWriter^ sw = gcnew StreamWriter(fileName);
 ...
sw->Close();
 return 0;
}
Last edited on
I have tried screenshot method in C++ (using GDI library), but failed to compile the file.
Show the errors and at least the lines where they occur.

How to do screenshot and paste to a word in C++/CLI project?
What does that mean? 'to a word'?
Here's a demo in C#, you can do the same steps in C++ / CLI.
Bitmap and Graphics class are the same, just the syntax is different.

http://www.codingvision.net/miscellaneous/c-get-desktop-screenshot
Topic archived. No new replies allowed.