Click here to Skip to main content
15,894,646 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Save as Excel file Pin
Davitor23-Sep-09 18:13
Davitor23-Sep-09 18:13 
QuestionODBC error: Expression too complex Expression too complex [modified] Pin
narendra91122-Sep-09 18:53
narendra91122-Sep-09 18:53 
GeneralRe: ODBC error: Expression too complex Expression too complex [modified] Pin
narendra91123-Sep-09 5:44
narendra91123-Sep-09 5:44 
QuestionODBC error: Expression too complex Pin
narendra91122-Sep-09 18:52
narendra91122-Sep-09 18:52 
GeneralRe: ODBC error: Expression too complex [modified] Pin
narendra91123-Sep-09 5:44
narendra91123-Sep-09 5:44 
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 
I'm coding an mfc active x that gets raw data and appends a header so far I've got it displaying the image but there are elements of green in what should be a grey scale image. I'm using a RGB header and assume that the image has shades of grey beyond that allowed in a 256 bit colour image. So how do i get the green to display as shades of grey. I haven't been able to find a method that creates a grey scale image that is y i'm using the RGB. From what i can see there is none and i need to add a palette to the image which i tried to do but can't even get the shades of green to change to a different colour.
Here is my code if anyone can help me out it would be greatly appreciated.
CClientDC dc(this); // device context for painting

BITMAPINFO bmi;//header struc

bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi.bmiHeader.biWidth  = 208;
bmi.bmiHeader.biHeight = 208;
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;



LPPALETTEENTRY pPalEntry = NULL; // pal palette
RGBQUAD *pRGB = NULL;
BOOL ret = TRUE;
CPalette palette;

int npalColors = palette.GetEntryCount();

pPalEntry = new PALETTEENTRY[npalColors];
pRGB = new RGBQUAD[npalColors];

palette.GetPaletteEntries(0, npalColors, pPalEntry);

for (int i = 0; i < npalColors; i++)
{
    pRGB[i].rgbRed   = pPalEntry[i].peRed;
    pRGB[i].rgbGreen = pPalEntry[i].peRed;//.peGreen;
    pRGB[i].rgbBlue  = pPalEntry[i].peRed;//.peBlue;
    pRGB[i].rgbReserved = 2;
}


CBitmap bitmap;
bitmap.CreateCompatibleBitmap(&dc,208, 208);
::SetDIBits(dc.m_hDC,bitmap,0,208,m_byImg2,&bmi,DIB_RGB_COLORS);//m_byImg2 is the raw data its a pointer to a byte array
CDC dcMemory;
dcMemory.CreateCompatibleDC(&dc);
CBitmap * pOldBitmap = dcMemory.SelectObject(&bitmap);
SetDIBColorTable(dcMemory, 0, npalColors, pRGB);

dc.StretchBlt(0,0, m_nW,m_nH, &dcMemory, 0,0,208,208 , SRCCOPY);//m_nW and m_nH is width and height of the active x when embedded

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 

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.