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

C / C++ / MFC

 
AnswerRe: thanks Pin
jeron128-Jan-09 11:11
jeron128-Jan-09 11:11 
AnswerRe: thanks Pin
David Crow28-Jan-09 16:46
David Crow28-Jan-09 16:46 
QuestionManaging unused function/method parameters... Pin
Maximilien28-Jan-09 5:57
Maximilien28-Jan-09 5:57 
AnswerRe: Managing unused function/method parameters... Pin
Stuart Dootson28-Jan-09 7:13
professionalStuart Dootson28-Jan-09 7:13 
AnswerRe: Managing unused function/method parameters... Pin
C Change28-Jan-09 9:40
C Change28-Jan-09 9:40 
AnswerRe: Managing unused function/method parameters... Pin
David Crow28-Jan-09 16:47
David Crow28-Jan-09 16:47 
AnswerRe: Managing unused function/method parameters... Pin
SandipG 28-Jan-09 20:02
SandipG 28-Jan-09 20:02 
QuestionHow to view COLORREF Array into Static Box? Pin
Khathar28-Jan-09 2:46
Khathar28-Jan-09 2:46 
dear sir/madam!

i have created dialog based application in MFC. and created COLORREF Array like this..

p_Cam1_Process_View_Array = new COLORREF*[IMAGE_HEIGHT];
for(int j=0; j<IMAGE_HEIGHT; j++)
p_Cam1_Process_View_Array[j] = new COLORREF[IMAGE_WIDTH];

for(int t_Y=0; t_Y < IMAGE_HEIGHT; t_Y++)
{
for(int t_X=0; t_X < IMAGE_WIDTH; t_X++)
{
p_Cam1_Process_View_Array[t_Y][t_X]=RGB(100,0,12);
}
}

how to display this array in to static Box.

i wrote the below coding but its getting off the application

BOOL CDlg_view_arrayDlg::Fn_Show_Processed_Image()
{
int t_Red, t_Green, t_Blue, t_X=0, t_Y=0, t_K=0;
CString ak;
try
{
CClientDC dc(&m_Processed_Image);
RECT t_Rect;

int t_Width=0, t_Height=0, w=0, h=0, k=0;
BITMAP t_bitmap;
HDC t_hmainmemdc=0;
HBITMAP t_hmainbitmap=0;


int t_Padding=((t_Width*3)%4==0)?0:4-((t_Width*3)%4);


BYTE *t_Byte;

w=t_Width*3+t_Padding;
h=t_Width;

BITMAPINFO *bm;

bm = (BITMAPINFO*) new BYTE[sizeof(BITMAPINFO)];

bm->bmiHeader.biBitCount=24;
bm->bmiHeader.biCompression=BI_RGB;
bm->bmiHeader.biHeight=IMAGE_HEIGHT;
bm->bmiHeader.biPlanes=1;
bm->bmiHeader.biSize=sizeof(BITMAPINFOHEADER);
bm->bmiHeader.biWidth=IMAGE_WIDTH;

t_Byte = new BYTE[w*h];

GetDIBits(t_hmainmemdc,t_hmainbitmap,0,h,t_Byte,bm,DIB_RGB_COLORS);

k=0;

for(int i=IMAGE_HEIGHT-1; i>0; i--)
{
for(int j=0; j<IMAGE_WIDTH; j++)
{
t_Blue = GetBValue(p_Cam1_Process_View_Array[i][j]);
*(t_Byte+k) = t_Blue;
k++;

t_Green = GetGValue(p_Cam1_Process_View_Array[i][j]);
*(t_Byte+k) = t_Green;
k++;

t_Red = GetRValue(p_Cam1_Process_View_Array[i][j]);
*(t_Byte+k) = t_Red;
k++;
}
k=k+t_Padding;
}

SetDIBitsToDevice(t_hmainmemdc,0,0,t_Width,t_Height,0,0,0,t_Height,t_Byte,bm,DIB_RGB_COLORS);
delete t_Byte;

//To set the scroll position;
BitBlt(dc.m_hDC , 0,0, t_Width, t_Height, t_hmainmemdc,0,0, SRCCOPY);

GetClientRect(&t_Rect);

if (t_Width>(t_Rect.right-t_Rect.left))
{
SetScrollRange(SB_HORZ,0,t_Width-(t_Rect.right-t_Rect.left),TRUE);
}
else
SetScrollRange(SB_HORZ,0,0,TRUE);

if (t_Height>(t_Rect.bottom-t_Rect.top))
{
SetScrollRange(SB_VERT,0,t_Height-(t_Rect.bottom-t_Rect.top),TRUE);
}
else
SetScrollRange(SB_VERT,0,0,TRUE);

CancelDC(dc.m_hDC);
return 0;
}
catch(...)
{
ak.Format("Red %d, Green %d Blue %d", t_Red, t_Green, t_Blue);
MessageBox(ak);
}
}

please let me know as possible.

thanks in advance.

AKRose | [Rose]
AnswerRe: How to view COLORREF Array into Static Box? Pin
Nishad S28-Jan-09 3:13
Nishad S28-Jan-09 3:13 
QuestionEM_EXSTSEL & EM_SETCHARFORMAT problem ??? Pin
ForNow28-Jan-09 2:40
ForNow28-Jan-09 2:40 
AnswerRe: EM_EXSTSEL & EM_SETCHARFORMAT problem ??? Pin
Code-o-mat28-Jan-09 4:24
Code-o-mat28-Jan-09 4:24 
AnswerRe: EM_EXSTSEL & EM_SETCHARFORMAT problem ??? Pin
Stuart Dootson28-Jan-09 4:30
professionalStuart Dootson28-Jan-09 4:30 
GeneralRe: EM_EXSTSEL & EM_SETCHARFORMAT problem ??? Pin
ForNow28-Jan-09 6:24
ForNow28-Jan-09 6:24 
QuestionTCHAR to const char*? Pin
sam_psycho28-Jan-09 1:47
sam_psycho28-Jan-09 1:47 
QuestionRe: TCHAR to const char*? Pin
«_Superman_»28-Jan-09 2:00
professional«_Superman_»28-Jan-09 2:00 
AnswerRe: TCHAR to const char*? Pin
sam_psycho28-Jan-09 2:08
sam_psycho28-Jan-09 2:08 
GeneralRe: TCHAR to const char*? Pin
Malli_S28-Jan-09 2:21
Malli_S28-Jan-09 2:21 
AnswerRe: TCHAR to const char*? Pin
CPallini28-Jan-09 2:21
mveCPallini28-Jan-09 2:21 
AnswerRe: TCHAR to const char*? Pin
Cedric Moonen28-Jan-09 2:40
Cedric Moonen28-Jan-09 2:40 
QuestionDisplay Format Text into a control Pin
manoharbalu28-Jan-09 0:43
manoharbalu28-Jan-09 0:43 
AnswerRe: Display Format Text into a control Pin
CPallini28-Jan-09 1:00
mveCPallini28-Jan-09 1:00 
GeneralRe: Display Format Text into a control Pin
manoharbalu28-Jan-09 1:24
manoharbalu28-Jan-09 1:24 
GeneralRe: Display Format Text into a control Pin
CPallini28-Jan-09 1:43
mveCPallini28-Jan-09 1:43 
GeneralRe: Display Format Text into a control Pin
manoharbalu28-Jan-09 1:47
manoharbalu28-Jan-09 1:47 
QuestionRe: Display Format Text into a control Pin
David Crow28-Jan-09 16:52
David Crow28-Jan-09 16:52 

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.