Click here to Skip to main content
15,913,836 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Specification of the problem. Pin
11-Dec-01 6:15
suss11-Dec-01 6:15 
GeneralRe: char* byte* DLL-VC++ and Delphi Please help ! Pin
Joaquín M López Muñoz10-Dec-01 9:37
Joaquín M López Muñoz10-Dec-01 9:37 
QuestionUSB support for VC++???? Pin
Johnny_8910-Dec-01 8:23
Johnny_8910-Dec-01 8:23 
QuestionCMenu::CheckMenuItem(...)??? Pin
Rickard Andersson2010-Dec-01 7:38
Rickard Andersson2010-Dec-01 7:38 
AnswerRe: CMenu::CheckMenuItem(...)??? Pin
Christian Graus10-Dec-01 11:12
protectorChristian Graus10-Dec-01 11:12 
AnswerRe: CMenu::CheckMenuItem(...)??? Pin
Ravi Bhavnani11-Dec-01 5:18
professionalRavi Bhavnani11-Dec-01 5:18 
Generalchar* byte* DLL-VC++ and Delphi Please help ! Pin
mimi10-Dec-01 7:36
mimi10-Dec-01 7:36 
GeneralCreate a CBitmap object, draw in it, save in (.bmp file) Pin
Remi Morin10-Dec-01 7:34
Remi Morin10-Dec-01 7:34 
in my Document class the function serialize... I wan,t to save my data as a monochrome bitmap so I do
void CWoopDoc::Serialize(CArchive& ar)
{
	if (ar.IsStoring())
	{
		//I need a bitmap object
      CBitmap BitMapTemp;
      //a device context to draw on it
      CDC CBitmapDC;  
      CBitmap* OldBitMap;
      
      //initialisation of the dc
      CBitmapDC.CreateCompatibleDC(NULL);
      
//here I'm not sure of that... I guess
      
      //I create an array of bytes for the bitmap
      void * bitmapbitstemp = malloc( Size_X*Size_Y / sizeof(BYTE));
      
      //here I create the bitmap
      BitMapTemp.CreateBitmap(Size_X,Size_Y,1,1,bitmapbitstemp);

		//I send my bitmap to the DC and save the old one
      OldBitMap = CBitmapDC.SelectObject(&BitMapTemp);
     
     //(... I draw in it)
     
      //now I wan't to save it
      
      //I need a bitmapInfoHeader and A bitMap File Header
      BITMAPFILEHEADER BmpFileH;
      BITMAPINFOHEADER bmpInfoH;
      BITMAP bm;
      BitMapTemp.GetBitmap(&bm);     //<--here I'm unable the get the bitmap bits, but the creation return true!!!
      BmpFileH.biBitCount = bm.bmBitsPixel;
      BmpFileH.biCompression = BI_RGB;
      BmpFileH.biHeight = bm.bmHeight;
      BmpFileH.biPlanes = bm.bmPlanes;
      BmpFileH.biWidth = bm.bmWidth;
      BmpFileH.biSizeImage = BI_RGB;
      BmpFileH.biClrUsed = 0;
      BmpFileH.biClrImportant = 2;
      BmpFileH.biXPelsPerMeter = 0;
      BmpFileH.biYPelsPerMeter = 0;
      BmpFileH.biSize = sizeof(BmpFileH);

      bmpInfoH.bfOffBits = sizeof(bmpInfoH)+sizeof(BmpFileH);
      bmpInfoH.bfSize = bm.bmWidthBytes;
      bmpInfoH.bfType = ('M' << 8 | 'B');
      bmpInfoH.bfReserved1 = 0;
      bmpInfoH.bfReserved2 = 0;
      
      ar.Write(&BmpFileH,sizeof(BmpFileH));
      ar.Write(&bmpInfoH,sizeof(bmpInfoH));
      //here I need to write the byte them self... but bm.bmBits are always NULL
      ar.Write(bm.bmBits,bm.bmWidthBytes);  
      
      //destroying...
      CBitmapDC.SelectObject(OldBitMap);

      delete bitmapbitstemp;
   }
	else
	{
		// TODO: add loading code here
	}
}


BitMapTemp.Serialize(ar); //do not work...

any help will be fine...



Remi Morin
Rmorin@Operamail.com
Remi.Morin@Lyrtech.com
GeneralRe: Create a CBitmap object, draw in it, save in (.bmp file) Pin
Bill Wilson10-Dec-01 7:42
Bill Wilson10-Dec-01 7:42 
QuestionHow to insert characters in a CRichEditViewed application? Pin
davilism10-Dec-01 7:33
davilism10-Dec-01 7:33 
QuestionHow to move the caret in CRichEditViewed application? Pin
davilism10-Dec-01 7:32
davilism10-Dec-01 7:32 
AnswerRe: How to move the caret in CRichEditViewed application? Pin
squizz10-Dec-01 10:05
squizz10-Dec-01 10:05 
GeneralRe: How to move the caret in CRichEditViewed application? Pin
davilism10-Dec-01 17:19
davilism10-Dec-01 17:19 
GeneralCan't use RTTI Pin
Chen Jiadong10-Dec-01 7:05
Chen Jiadong10-Dec-01 7:05 
GeneralRe: Can't use RTTI Pin
Ernest Laurentin10-Dec-01 8:04
Ernest Laurentin10-Dec-01 8:04 
GeneralRe: Can't use RTTI Pin
Chen Jiadong10-Dec-01 19:10
Chen Jiadong10-Dec-01 19:10 
GeneralRe: Can't use RTTI Pin
Christian Graus10-Dec-01 10:00
protectorChristian Graus10-Dec-01 10:00 
GeneralMySQL help!!! Pin
Bill Gates Antimatter Particle10-Dec-01 6:35
Bill Gates Antimatter Particle10-Dec-01 6:35 
GeneralRe: MySQL help!!! Pin
Jon Hulatt10-Dec-01 6:42
Jon Hulatt10-Dec-01 6:42 
GeneralRe: MySQL help!!! Pin
Bill Gates Antimatter Particle10-Dec-01 6:55
Bill Gates Antimatter Particle10-Dec-01 6:55 
GeneralRe: MySQL help!!! Pin
markkuk10-Dec-01 19:55
markkuk10-Dec-01 19:55 
GeneralRe: MySQL help!!! Pin
Bill Gates Antimatter Particle12-Dec-01 7:25
Bill Gates Antimatter Particle12-Dec-01 7:25 
GeneralRe: MySQL help!!! Pin
Nish Nishant10-Dec-01 20:16
sitebuilderNish Nishant10-Dec-01 20:16 
GeneralXML Schema (xmlspy<=>msxml) Pin
10-Dec-01 4:53
suss10-Dec-01 4:53 
GeneralTab order Pin
andysolman10-Dec-01 4:48
andysolman10-Dec-01 4:48 

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.