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

C / C++ / MFC

 
GeneralRe: creating a new doc, the sequel Pin
Christian Graus20-Nov-01 13:07
protectorChristian Graus20-Nov-01 13:07 
GeneralRe: creating a new doc, the sequel Pin
robbied20-Nov-01 15:15
robbied20-Nov-01 15:15 
GeneralRe: creating a new doc, the sequel Pin
Christian Graus20-Nov-01 15:24
protectorChristian Graus20-Nov-01 15:24 
GeneralRe: creating a new doc, the sequel Pin
robbied20-Nov-01 16:03
robbied20-Nov-01 16:03 
GeneralRe: creating a new doc, the sequel Pin
Christian Graus20-Nov-01 16:11
protectorChristian Graus20-Nov-01 16:11 
General::SetDIBitsToDevice problem Pin
Joel Holdsworth20-Nov-01 10:59
Joel Holdsworth20-Nov-01 10:59 
GeneralRe: ::SetDIBitsToDevice problem Pin
Chris Hafey20-Nov-01 15:41
Chris Hafey20-Nov-01 15:41 
GeneralRe: ::SetDIBitsToDevice problem Pin
Chris Hafey20-Nov-01 16:15
Chris Hafey20-Nov-01 16:15 
I just did a test and it doesn't need to be so restrictive (just change BPP from 1 to 4):

typedef unsigned char uchar;


void MyWnd::OnPaint()
{
CPaintDC dc(this); // device context for painting

// TODO: Add your message handler code here
const int Rows = 100;
const int Cols = 80;
const int BPP = 1;
static uchar* pData = 0;
static BITMAPINFOHEADER *lpbmiHeader = 0;
if(pData == 0)
{
pData = new uchar [Rows * Cols * BPP];
uchar* pOut = pData;
for(int i=0; i < Rows; i++)
{
for(int j=0; j < Cols; j++)
{
for(int z=0;z < BPP; z++)
{
*pOut++ = uchar(j) * 2;
}
}
}

short nInfoHeaderSize = sizeof(BITMAPINFOHEADER);
short nRGBQUADSize = 256*sizeof(RGBQUAD);

char* m_pBMI = new char [nInfoHeaderSize+nRGBQUADSize];

lpbmiHeader = (BITMAPINFOHEADER *) m_pBMI;
if(lpbmiHeader)
{
lpbmiHeader->biSize = sizeof(BITMAPINFOHEADER);
lpbmiHeader->biWidth = Cols;
lpbmiHeader->biHeight = Rows;
lpbmiHeader->biPlanes = 1;
lpbmiHeader->biBitCount = BPP * 8;
lpbmiHeader->biCompression = BI_RGB;
lpbmiHeader->biSizeImage = 0;
lpbmiHeader->biXPelsPerMeter = 0;
lpbmiHeader->biYPelsPerMeter = 0;
lpbmiHeader->biClrUsed =0;
lpbmiHeader->biClrImportant = 0;
}
RGBQUAD *ColorTable;
{
for(UINT i=0; i<256; i++)
{
ColorTable = (RGBQUAD*) (m_pBMI + sizeof(BITMAPINFOHEADER) + i*sizeof(RGBQUAD));
ColorTable->rgbBlue=i;
ColorTable->rgbGreen=i;
ColorTable->rgbRed=i;
}
}
}
::SetDIBitsToDevice(dc, 0, 0, Cols, Rows, 0, 0, 0, Rows, pData, (BITMAPINFO*) lpbmiHeader,DIB_RGB_COLORS);
// Do not call CWnd::OnPaint() for painting messages
}
QuestionSimple menu??? Pin
habebe20-Nov-01 10:36
habebe20-Nov-01 10:36 
AnswerRe: Simple menu??? Pin
John Clump22-Nov-01 21:11
John Clump22-Nov-01 21:11 
GeneralTime Display Pin
Peter Liddle20-Nov-01 10:19
Peter Liddle20-Nov-01 10:19 
GeneralRe: Time Display Pin
chris196220-Nov-01 10:59
chris196220-Nov-01 10:59 
GeneralRe: Time Display Pin
Alvaro Mendez20-Nov-01 11:48
Alvaro Mendez20-Nov-01 11:48 
GeneralRe: Time Display Pin
Michael Dunn20-Nov-01 16:30
sitebuilderMichael Dunn20-Nov-01 16:30 
GeneralA real challenge . . . customizing programs without the source code Pin
chris196220-Nov-01 10:14
chris196220-Nov-01 10:14 
GeneralRe: A real challenge . . . customizing programs without the source code Pin
Alvaro Mendez20-Nov-01 11:41
Alvaro Mendez20-Nov-01 11:41 
GeneralRe: A real challenge . . . customizing programs without the source code Pin
chris196220-Nov-01 17:38
chris196220-Nov-01 17:38 
GeneralRe: Load the resource by the different DLL! Pin
Masaaki Onishi20-Nov-01 16:52
Masaaki Onishi20-Nov-01 16:52 
GeneralRe: A real challenge . . . customizing programs without the source code Pin
Rassman20-Nov-01 22:26
Rassman20-Nov-01 22:26 
GeneralOT : integrating a TCL command line into an MFC Application Pin
Stephane Routelous20-Nov-01 9:40
Stephane Routelous20-Nov-01 9:40 
Generalcompacting a database on-the-fly Pin
Sean McKinnon20-Nov-01 8:58
Sean McKinnon20-Nov-01 8:58 
GeneralRe: compacting a database on-the-fly Pin
Carlos Antollini20-Nov-01 9:52
Carlos Antollini20-Nov-01 9:52 
GeneralRe: compacting a database on-the-fly Pin
Sean McKinnon20-Nov-01 9:58
Sean McKinnon20-Nov-01 9:58 
GeneralRe: compacting a database on-the-fly Pin
Carlos Antollini20-Nov-01 10:06
Carlos Antollini20-Nov-01 10:06 
GeneralList columns question ! Pin
Hadi Rezaee20-Nov-01 8:28
Hadi Rezaee20-Nov-01 8:28 

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.