Click here to Skip to main content
15,899,124 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionCalling The Thread function Pin
VVVimal22-Sep-09 18:50
VVVimal22-Sep-09 18:50 
AnswerRe: Calling The Thread function Pin
Naveen22-Sep-09 19:26
Naveen22-Sep-09 19:26 
AnswerRe: Calling The Thread function Pin
chandu00422-Sep-09 20:44
chandu00422-Sep-09 20:44 
QuestionThread Pin
VVVimal22-Sep-09 18:49
VVVimal22-Sep-09 18:49 
AnswerRe: Thread Pin
CPallini22-Sep-09 20:54
mveCPallini22-Sep-09 20:54 
QuestionQuestion about structure [modified] Pin
liang30622-Sep-09 16:59
liang30622-Sep-09 16:59 
AnswerRe: Question about structure Pin
Naveen22-Sep-09 18:39
Naveen22-Sep-09 18:39 
Question[Solved] What is the 32-bit form of the _InterlockedIncrement intrinsic? Pin
Skippums22-Sep-09 8:15
Skippums22-Sep-09 8:15 
AnswerRe: What is the 32-bit form of the _InterlockedIncrement intrinsic? Pin
cmk22-Sep-09 10:24
cmk22-Sep-09 10:24 
GeneralRe: What is the 32-bit form of the _InterlockedIncrement intrinsic? Pin
Skippums22-Sep-09 10:53
Skippums22-Sep-09 10:53 
GeneralRe: What is the 32-bit form of the _InterlockedIncrement intrinsic? Pin
cmk22-Sep-09 10:59
cmk22-Sep-09 10:59 
GeneralRe: What is the 32-bit form of the _InterlockedIncrement intrinsic? Pin
Skippums22-Sep-09 11:14
Skippums22-Sep-09 11:14 
GeneralRe: What is the 32-bit form of the _InterlockedIncrement intrinsic? Pin
cmk22-Sep-09 11:55
cmk22-Sep-09 11:55 
AnswerRe: [Solved] What is the 32-bit form of the _InterlockedIncrement intrinsic? Pin
Randor 22-Sep-09 12:04
professional Randor 22-Sep-09 12:04 
GeneralRe: [Solved] What is the 32-bit form of the _InterlockedIncrement intrinsic? Pin
Skippums22-Sep-09 12:20
Skippums22-Sep-09 12:20 
GeneralRe: [Solved] What is the 32-bit form of the _InterlockedIncrement intrinsic? Pin
Randor 22-Sep-09 13:33
professional Randor 22-Sep-09 13:33 
GeneralRe: [Solved] What is the 32-bit form of the _InterlockedIncrement intrinsic? Pin
Skippums22-Sep-09 14:00
Skippums22-Sep-09 14:00 
QuestionGreyscale image from raw data Pin
David Ferreira22-Sep-09 4:57
David Ferreira22-Sep-09 4:57 
AnswerRe: Greyscale image from raw data Pin
includeh1022-Sep-09 5:20
includeh1022-Sep-09 5:20 
AnswerRe: Greyscale image from raw data Pin
enhzflep22-Sep-09 20:02
enhzflep22-Sep-09 20:02 
GeneralRe: Greyscale image from raw data Pin
David Ferreira22-Sep-09 21:26
David Ferreira22-Sep-09 21:26 
GeneralRe: Greyscale image from raw data Pin
enhzflep22-Sep-09 23:15
enhzflep22-Sep-09 23:15 
GeneralRe: Greyscale image from raw data Pin
David Ferreira23-Sep-09 0:58
David Ferreira23-Sep-09 0:58 
AnswerRe: Greyscale image from raw data Pin
David Ferreira19-Nov-09 23:30
David Ferreira19-Nov-09 23:30 
This is a really delayed response but a bug caused me to revisit this code and with a little bit more experience in using MFC i approached it with a bit more confidence :P
Solved the problem though, it ended up being a really easy fix and i have "AlexFM" for his post on experts exchange to thank.
I needed to add a palette this solution eluded me because of the need for an array for the bitmap info.
here's my working code i hope it will help someone

CClientDC dc(this); // device context for painting

BITMAPINFO *bmi =  (BITMAPINFO*)new char[sizeof(BITMAPINFO) + sizeof(RGBQUAD)*256];//bitmapinfo struct

bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi->bmiHeader.biWidth  = 176;
bmi->bmiHeader.biHeight = 176;
bmi->bmiHeader.biPlanes = 1;
bmi->bmiHeader.biBitCount = 8;
bmi->bmiHeader.biCompression = BI_RGB;
bmi->bmiHeader.biSizeImage = 0;
bmi->bmiHeader.biXPelsPerMeter = 0;
bmi->bmiHeader.biYPelsPerMeter = 0;
bmi->bmiHeader.biClrUsed = 0;
bmi->bmiHeader.biClrImportant = 0;

//this defines a grey scale image haven't tried it but i assume you can mod this to change colours
//as this is essentially the palette

for (int i = 0; i < 256; i++ )
{
	bmi->bmiColors[i].rgbBlue = i;
	bmi->bmiColors[i].rgbGreen = i;
	bmi->bmiColors[i].rgbRed = i;
	bmi->bmiColors[i].rgbReserved = 0;
}

//create the bitmap itself
CBitmap bitmap;
//size of bitmap
bitmap.CreateCompatibleBitmap(&dc,176,176); //create 208x208 bitmap
//sets the DIBits and appends header
::SetDIBits(dc.m_hDC,bitmap ,0 ,176 ,rawImageData ,bmi/*The magic header*/ , DIB_RGB_COLORS);

CDC dcMemory;
dcMemory.CreateCompatibleDC(&dc);
CBitmap * pOldBitmap = dcMemory.SelectObject(&bitmap);
//this code was written for an active x and this streachs the image to the original size
//m_nW(which is the width) and m_nH( the height ) are the size of the active x from the ondraw
dc.StretchBlt(0,0, m_nW,m_nH, &dcMemory, 0,0,176,176 , SRCCOPY);
dcMemory.SelectObject(pOldBitmap);

QuestionCreation of install shield Pin
shir_k22-Sep-09 3:55
shir_k22-Sep-09 3:55 

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.