Click here to Skip to main content
15,914,013 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Auto deletion on reboot Pin
David Crow3-Feb-06 3:36
David Crow3-Feb-06 3:36 
AnswerRe: Auto deletion on reboot Pin
Michael Dunn3-Feb-06 12:59
sitebuilderMichael Dunn3-Feb-06 12:59 
GeneralRe: Auto deletion on reboot Pin
Kharfax6-Feb-06 2:39
Kharfax6-Feb-06 2:39 
GeneralRe: Auto deletion on reboot Pin
Michael Dunn7-Feb-06 6:37
sitebuilderMichael Dunn7-Feb-06 6:37 
QuestionHow to Name my threads in the Task Manager? Pin
_B-A-P_3-Feb-06 2:46
_B-A-P_3-Feb-06 2:46 
AnswerRe: How to Name my threads in the Task Manager? Pin
Gary R. Wheeler4-Feb-06 9:14
Gary R. Wheeler4-Feb-06 9:14 
GeneralRe: How to Name my threads in the Task Manager? Pin
_B-A-P_5-Feb-06 20:16
_B-A-P_5-Feb-06 20:16 
QuestionSavin a bitmap, but Pin
Ivan Cachicatari3-Feb-06 2:39
Ivan Cachicatari3-Feb-06 2:39 
Hi,

I want to save a bitmap in a file. My funcion is the following code, but this save the a inverted bitmap.

BOOL CDXCaptureDlg::SaveBMP(BYTE *Buffer, int width, int height, long paddedsize, char *bmpfile)<br />
{<br />
// declare bmp structures<br />
BITMAPFILEHEADER bmfh;<br />
BITMAPINFOHEADER info;<br />
<br />
// andinitialize them to zero<br />
memset ( &bmfh, 0, sizeof (BITMAPFILEHEADER ) );<br />
memset ( &info, 0, sizeof (BITMAPINFOHEADER ) );<br />
<br />
// fill the fileheader with data<br />
bmfh.bfType = 0x4d42; // 0x4d42 = 'BM'<br />
bmfh.bfReserved1 = 0;<br />
bmfh.bfReserved2 = 0;<br />
bmfh.bfSize = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + paddedsize;<br />
bmfh.bfOffBits = 0x36; // number of bytes to start of bitmap bits<br />
<br />
// fill the infoheader<br />
<br />
info.biSize = sizeof(BITMAPINFOHEADER);<br />
info.biWidth = width;<br />
info.biHeight = height;<br />
info.biPlanes = 1; // we only have one bitplane<br />
info.biBitCount = 24; // RGB mode is 24 bits<br />
info.biCompression = BI_RGB;<br />
info.biSizeImage = 0; // can be 0 for 24 bit images<br />
info.biXPelsPerMeter = 0x0ec4; // paint and PSP use this values<br />
info.biYPelsPerMeter = 0x0ec4;<br />
info.biClrUsed = 0; // we are in RGB mode and have no palette<br />
info.biClrImportant = 0; // all colors are important<br />
<br />
<br />
// now we open the file to write to<br />
HANDLE file = CreateFile ( bmpfile , GENERIC_WRITE, FILE_SHARE_READ,<br />
NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL );<br />
<br />
if ( file == NULL )<br />
{<br />
CloseHandle ( file );<br />
return FALSE;<br />
}<br />
<br />
// write file header<br />
unsigned long bwritten;<br />
if ( WriteFile ( file, &bmfh, sizeof ( BITMAPFILEHEADER ), &bwritten, NULL ) == FALSE )<br />
{<br />
CloseHandle ( file );<br />
return FALSE;<br />
}<br />
<br />
// write infoheader<br />
if ( WriteFile ( file, &info, sizeof ( BITMAPINFOHEADER ), &bwritten, NULL ) == FALSE )<br />
{<br />
CloseHandle ( file );<br />
return FALSE;<br />
}<br />
<br />
// write image data<br />
if ( WriteFile ( file, Buffer, paddedsize, &bwritten, NULL ) == FALSE )<br />
{<br />
CloseHandle ( file );<br />
return FALSE;<br />
}<br />
<br />
// and close file<br />
CloseHandle ( file );<br />
<br />
return TRUE;<br />
}<br />


Ivan Cachicatari Blog[^]
www.latindevelopers.com
AnswerRe: Savin a bitmap, but Pin
Russell'3-Feb-06 2:43
Russell'3-Feb-06 2:43 
AnswerRe: Savin a bitmap, but Pin
benjymous3-Feb-06 4:30
benjymous3-Feb-06 4:30 
AnswerRe: Savin a bitmap, but Pin
normanS5-Feb-06 19:41
normanS5-Feb-06 19:41 
QuestionDLL with shared memory Pin
Shivaji Patil3-Feb-06 2:18
professionalShivaji Patil3-Feb-06 2:18 
AnswerRe: DLL with shared memory Pin
Kharfax3-Feb-06 3:15
Kharfax3-Feb-06 3:15 
GeneralRe: DLL with shared memory Pin
Shivaji Patil3-Feb-06 20:24
professionalShivaji Patil3-Feb-06 20:24 
GeneralRe: DLL with shared memory Pin
Kharfax6-Feb-06 2:38
Kharfax6-Feb-06 2:38 
GeneralRe: DLL with shared memory Pin
Shivaji Patil7-Feb-06 1:56
professionalShivaji Patil7-Feb-06 1:56 
GeneralRe: DLL with shared memory Pin
Shivaji Patil15-Feb-06 18:50
professionalShivaji Patil15-Feb-06 18:50 
QuestionSet Folder Attributes Pin
P Gibson3-Feb-06 1:43
P Gibson3-Feb-06 1:43 
AnswerRe: Set Folder Attributes Pin
bolivar1233-Feb-06 2:39
bolivar1233-Feb-06 2:39 
GeneralRe: Set Folder Attributes Pin
P Gibson3-Feb-06 4:13
P Gibson3-Feb-06 4:13 
GeneralRe: Set Folder Attributes Pin
Michael Dunn3-Feb-06 13:01
sitebuilderMichael Dunn3-Feb-06 13:01 
Questionhelp needed Pin
V.G3-Feb-06 1:06
V.G3-Feb-06 1:06 
AnswerRe: help needed Pin
Prakash Nadar3-Feb-06 2:47
Prakash Nadar3-Feb-06 2:47 
QuestionF1 should launch the help of my dialog app Pin
rampaul3-Feb-06 1:02
rampaul3-Feb-06 1:02 
AnswerRe: F1 should launch the help of my dialog app Pin
Aryan S3-Feb-06 1:20
Aryan S3-Feb-06 1:20 

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.