Click here to Skip to main content
15,911,890 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: How to use CMonthCalCtrl to get the Selected Date == Urgent need Pin
David Crow26-Aug-05 3:28
David Crow26-Aug-05 3:28 
QuestionHow to Retrieve all user names from Administrators Group??? Pin
Supriya Tonape25-Aug-05 23:11
Supriya Tonape25-Aug-05 23:11 
AnswerRe: How to Retrieve all user names from Administrators Group??? Pin
Steve S25-Aug-05 23:49
Steve S25-Aug-05 23:49 
GeneralRe: How to Retrieve all user names from Administrators Group??? Pin
Supriya Tonape28-Aug-05 23:34
Supriya Tonape28-Aug-05 23:34 
GeneralRe: How to Retrieve all user names from Administrators Group??? Pin
sunit526-Aug-05 0:52
sunit526-Aug-05 0:52 
AnswerRe: How to Retrieve all user names from Administrators Group??? Pin
David Crow26-Aug-05 3:35
David Crow26-Aug-05 3:35 
QuestionCTabCtrl Pin
mails_aphale25-Aug-05 23:02
mails_aphale25-Aug-05 23:02 
QuestionGetDIBits Problem need help!!! Pin
viva_neu25-Aug-05 22:35
viva_neu25-Aug-05 22:35 
I read a raw(without file info head)file from the hard driver. raw file is a 1024x1024 8bit graylevel data. I put the data into a memory and draw it on a memDC and add some text on the memDC,then I want to use GetDlBits to get the raw data from memDC, but the data I get is always wrong with some bytes. So the raw image can not display correctly. But if I use memDC.GetPixel then the result is right.I can not find any problem, who can help me!!!

CBitmap memBitmap
CBitmap* pOldBmp=NULL ;
CDC memDC;
OldPal=NULL;
HDC hDC=pDC->GetSafeHdc();
CDIBDoc* pDoc=GetDocument();
BOOL bSuccess=FALSE;
if(pDoc->hDIB ==NULL)
{
AfxMessageBox("wrong");
return;
}
LPBYTE m_lpImage=(LPBYTE)GlobalLock(pDoc->hDIB);
if(pDoc->hDIB)
{
OldPal=pDC->SelectPalette(&m_Palette,FALSE);
if(OldPal==NULL)
{
AfxMessageBox("palette choose error");
}
if(pDC->RealizePalette()==GDI_ERROR)
{
AfxMessageBox("palette realize error");
}
}
else
{
AfxMessageBox("image datum are empty");
return ;
}
SetStretchBltMode(hDC,COLORONCOLOR);
memDC.CreateCompatibleDC(pDC);
memBitmap.CreateCompatibleBitmap(pDC,1024,1024);
pOldBmp = memDC.SelectObject(&memBitmap);

bSuccess=::StretchDIBits(memDC,0,0,1024,1024,
0, 0,1024, 1024,
m_lpImage,(LPBITMAPINFO)bmhdr,
DIB_RGB_COLORS,
SRCCOPY);

::SetBkMode(memDC,TRANSPARENT);
::SetTextColor(memDC,RGB(220, 220, 220));
CString str="DOG ";
CRect rect(20,20,70,50);
::DrawText(memDC,str,sizeof(str),rect,DT_LEFT|DT_WORDBREAK);

if(bSuccess==GDI_ERROR)
{
AfxMessageBox("error");
}
pDC->BitBlt(0,0,1024,1024,&memDC,0,0,SRCCOPY);
ZeroMemory(pDoc->pTemp, pDoc->dwBitsSize);
/*******************************wrong*************************/
int nCount = GetDIBits(memDC.GetSafeHdc(), (HBITMAP)memBitmap.m_hObject, 0, 1024,
pDoc->pTemp, (BITMAPINFO*)bmhdr, DIB_RGB_COLORS);

/*******************************test*************************/
if don't use GetDIBits but use these then right:
int nCount = memBitmap.GetBitmapBits(1024*1024,(LPVOID)pDoc->pTemp);
int i,j;
for (i=0;i<1024;i++)
{
for (j=0;j<1024;j++)
{
*(pDoc->pTemp+j*1024+i) = (BYTE)memDC.GetPixel(i,j);
}
}
AnswerRe: GetDIBits Problem need help!!! Pin
Anonymous26-Aug-05 2:48
Anonymous26-Aug-05 2:48 
AnswerRe: GetDIBits Problem need help!!! Pin
John R. Shaw27-Aug-05 12:18
John R. Shaw27-Aug-05 12:18 
GeneralRe: GetDIBits Problem need help!!! Pin
viva_neu28-Aug-05 14:46
viva_neu28-Aug-05 14:46 
GeneralRe: GetDIBits Problem need help!!! Pin
John R. Shaw28-Aug-05 22:19
John R. Shaw28-Aug-05 22:19 
GeneralRe: GetDIBits Problem need help!!! Pin
viva_neu28-Aug-05 22:26
viva_neu28-Aug-05 22:26 
GeneralRe: GetDIBits Problem need help!!! Pin
John R. Shaw28-Aug-05 23:04
John R. Shaw28-Aug-05 23:04 
QuestionCSocket Pin
sunit525-Aug-05 22:07
sunit525-Aug-05 22:07 
AnswerRe: CSocket Pin
dharani25-Aug-05 22:22
dharani25-Aug-05 22:22 
GeneralRe: CSocket Pin
sunit525-Aug-05 22:47
sunit525-Aug-05 22:47 
GeneralRe: CSocket Pin
sunit526-Aug-05 0:08
sunit526-Aug-05 0:08 
AnswerRe: CSocket Pin
MailtoGops26-Aug-05 3:05
MailtoGops26-Aug-05 3:05 
GeneralRe: CSocket Pin
sunit526-Aug-05 3:41
sunit526-Aug-05 3:41 
GeneralRe: CSocket Pin
MailtoGops26-Aug-05 3:52
MailtoGops26-Aug-05 3:52 
GeneralRe: CSocket Pin
sunit526-Aug-05 4:17
sunit526-Aug-05 4:17 
AnswerRe: CSocket Pin
Moak (not logged in)27-Aug-05 22:27
sussMoak (not logged in)27-Aug-05 22:27 
QuestionExcel Automation Pin
Identity Undisclosed25-Aug-05 21:52
Identity Undisclosed25-Aug-05 21:52 
AnswerRe: Excel Automation Pin
Steve S25-Aug-05 23:44
Steve S25-Aug-05 23:44 

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.