Click here to Skip to main content
16,005,121 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
AnswerRe: need help please Pin
Christian Graus16-Oct-05 9:42
protectorChristian Graus16-Oct-05 9:42 
QuestionProblems when drawing a font with OpenGL Pin
Alex Cutovoi10-Oct-05 6:31
Alex Cutovoi10-Oct-05 6:31 
QuestionScreen capture in C++ Pin
Alex Cutovoi10-Oct-05 6:23
Alex Cutovoi10-Oct-05 6:23 
AnswerRe: Screen capture in C++ Pin
John M. Drescher10-Oct-05 6:55
John M. Drescher10-Oct-05 6:55 
AnswerRe: Screen capture in C++ Pin
John M. Drescher10-Oct-05 7:07
John M. Drescher10-Oct-05 7:07 
GeneralRe: Screen capture in C++ Pin
Alex Cutovoi10-Oct-05 8:14
Alex Cutovoi10-Oct-05 8:14 
GeneralRe: Screen capture in C++ Pin
Christian Graus10-Oct-05 8:43
protectorChristian Graus10-Oct-05 8:43 
GeneralRe: Screen capture in C++ Pin
Alex Cutovoi10-Oct-05 12:07
Alex Cutovoi10-Oct-05 12:07 
Christian and John, my code now is this, it's a little big. Is this correct?
Please, I made this based on the article that you(John) said me, and I don't know if this thing is all correct. It's my first time that I do this.

Thanks for you guys

void CapturaTheScreen()
{
int iWidth = GetSystemMetrics(SM_CXSCREEN);
int iHeight = GetSystemMetrics(SM_CYSCREEN);
HWND screenHwnd;
HDC* screenHdc;
RECT theRect;
HDC copyHdc;
BYTE* desenhobits;
//HBITMAP newBitmap;
theRect.bottom = 0;
theRect.left = 0;
theRect.right = 0;
theRect.top = 0;
screenHwnd = GetDesktopWindow();
screenHdc = GetDC(screenHwnd);
copyHdc = CreateCompatibleDC(screenHdc);
HBITMAP bitmap = CreateCompatibleBitmap(screenHdc, iWidth, iHeight);
SelectObject(copyHdc, bitmap);
BitBlt(copyHdc, 0, 0, iWidth, iHeight, screenHdc, 0, 0, SRCCOPY);
BITMAPINFOHEADER infoHeader;

//Image header info
infoHeader.biSize = sizeof(BITMAPINFOHEADER);
infoHeader.biBitCount = 24;
infoHeader.biPlanes = 1;
infoHeader.biWidth = theRect.right;
infoHeader.biHeight = theRect.bottom;
infoHeader.biCompression = BI_RGB;
infoHeader.biSizeImage = ((((infoHeader.biWidth * infoHeader.biBitCount) + 31) & ~31) >> 3) * infoHeader.biHeight;
theRect = CreateDIBSection(screenHdc, (CONST BITMAPINFO*)&infoHeader, DIB_RGB_COLORS, (void**)&desenhobits, NULL, 0);
ReleaseDC(screenHdc);
//processo de gravação
FILE* fImage = fopen("img1.bmp", "wb");
if(fImage == NULL)
{
//image info
BITMAPFILEHEADER fileHeader;
int iBits= sizeof(BITMAPFILEHEADER) + infoHeader.biSize;
LONG lTamImagem = infoHeader.biSizeImage;
LONG lFileSize = lTamImagem + iBits;
fileHeader.bfOffBits = iBits;
fileHeader.bfType = 'B'+('M'<<8);
fileHeader.bfSize = lFileSize;
fileHeader.bfReserved1 = 0;
fileHeader.bfReserved2 = 0;
unsigned int iTheFileHeader = fwrite(&fileHeader, 1, sizeof(BITMAPFILEHEADER), fImage);
unsigned int iTheInfoHeader = fwrite(&infoHeader, 1, sizeof(BITMAPINFOHEADER), fImage);
unsigned int iTheImage = fwrite(desenhobits, 1, lFileSize, fImage);
}
}

-- modified at 18:10 Monday 10th October, 2005
GeneralRe: Screen capture in C++ Pin
Christian Graus10-Oct-05 12:26
protectorChristian Graus10-Oct-05 12:26 
GeneralRe: Screen capture in C++ Pin
John M. Drescher10-Oct-05 8:44
John M. Drescher10-Oct-05 8:44 
GeneralRe: Screen capture in C++ Pin
Alex Cutovoi11-Oct-05 3:02
Alex Cutovoi11-Oct-05 3:02 
QuestionHow to search for some strings in a string? Pin
Jacky Tsee9-Oct-05 18:41
Jacky Tsee9-Oct-05 18:41 
AnswerRe: How to search for some strings in a string? Pin
Lyd Fab9-Oct-05 23:00
Lyd Fab9-Oct-05 23:00 
GeneralRe: How to search for some strings in a string? Pin
Jacky Tsee10-Oct-05 4:25
Jacky Tsee10-Oct-05 4:25 
GeneralRe: How to search for some strings in a string? Pin
Johann Gerell12-Oct-05 1:02
Johann Gerell12-Oct-05 1:02 
QuestionC++ UDP Tutorial Pin
JBAK_CP9-Oct-05 13:38
JBAK_CP9-Oct-05 13:38 
Questionheeeeelp Pin
linuxadict9-Oct-05 11:49
linuxadict9-Oct-05 11:49 
AnswerRe: heeeeelp Pin
Christian Graus11-Oct-05 11:09
protectorChristian Graus11-Oct-05 11:09 
QuestionUsing GDI+ to apply image effects Pin
ben090908-Oct-05 16:36
ben090908-Oct-05 16:36 
AnswerRe: Using GDI+ to apply image effects Pin
Christian Graus9-Oct-05 2:19
protectorChristian Graus9-Oct-05 2:19 
GeneralRe: Using GDI+ to apply image effects Pin
ben0909010-Oct-05 7:47
ben0909010-Oct-05 7:47 
GeneralRe: Using GDI+ to apply image effects Pin
Christian Graus10-Oct-05 7:56
protectorChristian Graus10-Oct-05 7:56 
GeneralRe: Using GDI+ to apply image effects Pin
ben0909011-Oct-05 11:04
ben0909011-Oct-05 11:04 
GeneralRe: Using GDI+ to apply image effects Pin
Christian Graus11-Oct-05 11:08
protectorChristian Graus11-Oct-05 11:08 
QuestionWhat can I do? Pin
Jacky Tsee8-Oct-05 6:31
Jacky Tsee8-Oct-05 6:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.