Click here to Skip to main content
11,573,618 members (62,336 online)

C / C++ / MFC

 
QuestionStuck in WaveInProc Pin
AmbiguousName2-Feb-13 7:21
memberAmbiguousName2-Feb-13 7:21 
AnswerRe: Stuck in WaveInProc Pin
CPallini2-Feb-13 10:38
mvpCPallini2-Feb-13 10:38 
AnswerRe: Stuck in WaveInProc Pin
Richard MacCutchan2-Feb-13 21:26
mvpRichard MacCutchan2-Feb-13 21:26 
QuestionBitmap creation from a buffer recived Pin
toms from newdelhi1-Feb-13 0:03
membertoms from newdelhi1-Feb-13 0:03 
Hello all!
I'm working on a program in which, I'm receiving the bytes of an image and after storing this creating a bitmap to display.
This is my Main code Please see this..

static char buff[MAX_SIZE];
	int num;
			
//receiving the bytes from a client		 
          num=recv(Socket, buff, sizeof(buff), 0);
 
		 
    // progress the buffer
  
				//ifstream creation	
				std::ifstream is;
 
					is.open(buff, std::ios::binary);
					is.seekg(0, std::ios::end);
					num = is.tellg();
					is.seekg(0, std::ios::beg);
					 
 
					//reading buffer
					is.read(buff, num);
 
					tagBITMAPFILEHEADER bfh = *(tagBITMAPFILEHEADER*)buff;
					tagBITMAPINFOHEADER bih = *(tagBITMAPINFOHEADER*)(buff+sizeof(tagBITMAPFILEHEADER));
 
					RGBQUAD             rgb = *(RGBQUAD*)(buff+sizeof(tagBITMAPFILEHEADER)+sizeof(tagBITMAPINFOHEADER));
 
 
					BITMAPINFO bi;
bi.bmiColors[0] = rgb;
bi.bmiHeader = bih;
char* pPixels = (buff+bfh.bfOffBits);
 
char* ppvBits;
 
 
hbitmap = CreateDIBSection(NULL, &bi, DIB_RGB_COLORS, (void**) &ppvBits, NULL, 0);
SetDIBits(NULL, hbitmap, 0, bih.biHeight, pPixels, &bi, DIB_RGB_COLORS);
 
GetObject(hbitmap, sizeof(BITMAP), &cBitmap);
	
 
On checking the bytes received,,its ok to be there from both client and server side, But my code is unable to read these bytes to create a bitmap.

Thanks in advance for your help!
AnswerRe: Bitmap creation from a buffer recived Pin
Richard MacCutchan1-Feb-13 0:40
mvpRichard MacCutchan1-Feb-13 0:40 
GeneralRe: Bitmap creation from a buffer recived Pin
toms from newdelhi1-Feb-13 0:56
membertoms from newdelhi1-Feb-13 0:56 
GeneralRe: Bitmap creation from a buffer recived Pin
Richard MacCutchan1-Feb-13 1:01
mvpRichard MacCutchan1-Feb-13 1:01 
GeneralRe: Bitmap creation from a buffer recived Pin
toms from newdelhi1-Feb-13 1:18
membertoms from newdelhi1-Feb-13 1:18 
GeneralRe: Bitmap creation from a buffer recived Pin
Richard MacCutchan1-Feb-13 1:35
mvpRichard MacCutchan1-Feb-13 1:35 
GeneralRe: Bitmap creation from a buffer recived Pin
toms from newdelhi1-Feb-13 1:46
membertoms from newdelhi1-Feb-13 1:46 

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

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


Advertise | Privacy | Mobile
Web03 | 2.8.150624.2 | Last Updated 2 Jul 2015
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid