Click here to Skip to main content
15,916,432 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: serial port interface in vc++ Pin
CPallini27-Jul-09 20:59
mveCPallini27-Jul-09 20:59 
AnswerRe: serial port interface in vc++ Pin
KarstenK27-Jul-09 21:42
mveKarstenK27-Jul-09 21:42 
JokeRe: serial port interface in vc++ Pin
CPallini27-Jul-09 21:53
mveCPallini27-Jul-09 21:53 
GeneralRe: serial port interface in vc++ Pin
KarstenK27-Jul-09 22:27
mveKarstenK27-Jul-09 22:27 
AnswerRe: serial port interface in vc++ Pin
KarstenK27-Jul-09 22:27
mveKarstenK27-Jul-09 22:27 
QuestionPop up message on Tray icon Help needed Pin
MeghaJoshi27-Jul-09 19:53
MeghaJoshi27-Jul-09 19:53 
AnswerRe: Pop up message on Tray icon Help needed Pin
«_Superman_»27-Jul-09 20:13
professional«_Superman_»27-Jul-09 20:13 
GeneralRe: Pop up message on Tray icon Help needed Pin
MeghaJoshi27-Jul-09 20:52
MeghaJoshi27-Jul-09 20:52 
GeneralRe: Pop up message on Tray icon Help needed Pin
kilt28-Jul-09 14:00
kilt28-Jul-09 14:00 
AnswerRe: Pop up message on Tray icon Help needed Pin
KarstenK27-Jul-09 22:29
mveKarstenK27-Jul-09 22:29 
AnswerRe: Pop up message on Tray icon Help needed Pin
David Crow28-Jul-09 3:08
David Crow28-Jul-09 3:08 
Questionavoiding focus to read only edit control Pin
rp_suman27-Jul-09 18:54
rp_suman27-Jul-09 18:54 
AnswerRe: avoiding focus to read only edit control Pin
Adam Roderick J27-Jul-09 19:28
Adam Roderick J27-Jul-09 19:28 
AnswerRe: avoiding focus to read only edit control Pin
«_Superman_»27-Jul-09 19:50
professional«_Superman_»27-Jul-09 19:50 
GeneralRe: avoiding focus to read only edit control Pin
Adam Roderick J27-Jul-09 20:08
Adam Roderick J27-Jul-09 20:08 
QuestionMailBox Pin
Bram van Kampen27-Jul-09 15:28
Bram van Kampen27-Jul-09 15:28 
Questionabout bitmap process, Pin
xuplus27-Jul-09 15:18
xuplus27-Jul-09 15:18 
here is the source code of create a bitmap from memory dc,


CRect rRect;
GetClientRect(rRect);

CDC *pDC = GetDC();
CDC MemDC;
CBitmap *pOldBMP = NULL;

MemDC.CreateCompatibleDC(pDC);
CFont *pOldFont = MemDC.SelectObject(GetFont());

CRect rCaption(0,0,0,0);

MemDC.DrawText(m_strText, rCaption, DT_CALCRECT);
ASSERT( rCaption.Width() >= 0 );
ASSERT( rCaption.Height() >= 0 );
if (rCaption.Height() < 16)
rCaption.bottom = rCaption.top + 16;

rCaption.right += 25;
if (rRect.Width() >= 16 && rCaption.Width() > rRect.Width() - 16)
rCaption.right = rCaption.left + rRect.Width() - 16;

if (m_MemBMP.m_hObject)
{
m_MemBMP.DeleteObject();
}

m_MemBMP.CreateCompatibleBitmap(pDC, rCaption.Width(), rCaption.Height());
pOldBMP = MemDC.SelectObject(&m_MemBMP);


HINSTANCE hInstResource = NULL;
hInstResource = AfxFindResourceHandle(MAKEINTRESOURCE(nID), RT_GROUP_ICON);

ASSERT(hInstResource);
HICON hicon = (HICON)::LoadImage(hInstResource, MAKEINTRESOURCE(IDI_ICON1), IMAGE_ICON, NULL, NULL, 0);
ASSERT(hicon);

//MemDC.SetBkMode(TRANSPARENT);
MemDC.FillSolidRect(&rCaption, RGB(0, 0, 122));

DrawState( MemDC.m_hDC, NULL, NULL, (LPARAM)hicon, NULL, 1, 0, 16, 16, DST_ICON | DSS_NORMAL);

// clear all alpha channel data
BITMAP bmMem;
if (m_MemBMP.GetObject(sizeof bmMem, &bmMem) >= sizeof bmMem && bmMem.bmBitsPixel == 32)
{
DWORD dwSize = m_MemBMP.GetBitmapBits(0, NULL);
if (dwSize)
{
LPBYTE pPixels = (LPBYTE)malloc(dwSize);
if (pPixels)
{
if (m_MemBMP.GetBitmapBits(dwSize, pPixels) == dwSize)
{
LPBYTE pLine = pPixels;
int iLines = bmMem.bmHeight;
while (iLines-- > 0)
{
LPDWORD pdwPixel = (LPDWORD)pLine;
for (int x = 0; x < bmMem.bmWidth; x++)
{
*pdwPixel++ &= 0x00FFFFFF; //why need this ???
}
pLine += bmMem.bmWidthBytes;
}
m_MemBMP.SetBitmapBits(dwSize, pPixels);
}
free(pPixels);
}
}
}

rCaption.left += 22;

MemDC.SetTextColor(RGB(0, 125, 0));
MemDC.DrawText(m_strText, rCaption, DT_SINGLELINE | DT_LEFT | DT_END_ELLIPSIS);

ReleaseDC(pDC);
=========
can someone explain the functionality of this sentence:
*pdwPixel++ &amp;= 0x00FFFFFF;

why did need this??
thanks in advance... Sniff | :^)
AnswerRe: about bitmap process, Pin
CPallini27-Jul-09 20:58
mveCPallini27-Jul-09 20:58 
QuestionC++ Vector Pin
resolvequestion27-Jul-09 13:47
resolvequestion27-Jul-09 13:47 
AnswerRe: C++ Vector Pin
«_Superman_»27-Jul-09 17:21
professional«_Superman_»27-Jul-09 17:21 
AnswerRe: C++ Vector Pin
Adam Roderick J27-Jul-09 18:02
Adam Roderick J27-Jul-09 18:02 
QuestionConversion to VS2008 Pin
thecodedemon27-Jul-09 13:04
thecodedemon27-Jul-09 13:04 
QuestionRe: Conversion to VS2008 Pin
Adam Maras27-Jul-09 13:43
Adam Maras27-Jul-09 13:43 
AnswerRe: Conversion to VS2008 Pin
Joe Woodbury27-Jul-09 14:56
professionalJoe Woodbury27-Jul-09 14:56 
GeneralRe: Conversion to VS2008 Pin
thecodedemon28-Jul-09 4:04
thecodedemon28-Jul-09 4:04 

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.