Click here to Skip to main content
15,913,941 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: WS_EX_LEFTSCROLLBAR with combo boxes not working? Pin
2-May-01 4:18
suss2-May-01 4:18 
GeneralDraw image at another Application's HWND Pin
Yong Haur TAY1-May-01 21:48
Yong Haur TAY1-May-01 21:48 
GeneralRe: Draw image at another Application's HWND Pin
2-May-01 6:20
suss2-May-01 6:20 
GeneralRe: Draw image at another Application's HWND Pin
Christian Graus2-May-01 12:10
protectorChristian Graus2-May-01 12:10 
GeneralHiding a process in Task Manager ! Pin
yamini1-May-01 19:51
yamini1-May-01 19:51 
GeneralRe: Hiding a process in Task Manager ! Pin
AlexEg2-May-01 21:44
AlexEg2-May-01 21:44 
Question? Pin
yamini1-May-01 19:50
yamini1-May-01 19:50 
GeneralBitBlt on Win98 / WinNT Pin
Liam O'Hagan1-May-01 14:22
Liam O'Hagan1-May-01 14:22 
Hi there, can someone give me an idea as to why this code:

/*****************************************************/
/* draw some text */
/*****************************************************/

CRect rect;
CFont TextFont, *oldFont;

CWnd *wnd = GetDlgItem(IDC_PLACEHOLDER); // find where to put the text (a static control)
ASSERT(wnd != NULL);
ASSERT(IsWindow(wnd->m_hWnd) != FALSE);
wnd->GetWindowRect(&rect);
ScreenToClient(&rect);

CPaintDC dc(this) ; // device context for painting

if (m_dc.GetSafeHdc() == NULL)
{
m_dc.CreateCompatibleDC(&dc) ;
m_bitmapTitle.CreateCompatibleBitmap(&dc, rect.Width(), rect.Height()) ;
m_pbitmapOldTitle = m_dc.SelectObject(&m_bitmapTitle) ;
}

TextFont.CreateFont (40, 0, 0, 0, 300, // Create the font
TRUE, FALSE, 0, ANSI_CHARSET,
OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,
PROOF_QUALITY,
DEFAULT_PITCH|FF_SWISS, "Arial") ;

oldFont = m_dc.SelectObject(&TextFont); // select the font

m_dc.SetTextColor (RGB(128, 0, 0)) ; // set a bunch of attributes of the dc
m_dc.SetBkMode(OPAQUE);
m_dc.SetBkColor(::GetSysColor(COLOR_3DFACE));
m_dc.SetTextAlign (TA_LEFT);

CString Title = "Test ";

m_dc.TextOut(0, 0, Title);

m_dc.SelectObject(oldFont) ;

CDC memDC ;
CBitmap memBitmap ;
CBitmap* oldBitmap ; // bitmap originally found in CMemDC

// create a memory dc
memDC.CreateCompatibleDC(&m_dc) ;
memBitmap.CreateCompatibleBitmap(&m_dc, rect.Width(), rect.Height()) ;
oldBitmap = (CBitmap *)memDC.SelectObject(&memBitmap) ;

if (memDC.GetSafeHdc() != NULL)
{

// draw the text on the memory dc
memDC.BitBlt(0, 0, rect.Width(), rect.Height(),
&m_dc, 0, 0, SRCPAINT) ;

// bitblt the result to the display DC
dc.BitBlt(rect.left, rect.top, rect.Width(), rect.Height(),
&memDC, 0, 0, SRCCOPY) ;
}

memDC.SelectObject(oldBitmap) ;


/*****************************************************/
/* done... */
/*****************************************************/

produces perfectly fine output on Win NT but garbage on win 95/98/Me?? I'm stuck!! Cry | :((
to understand what I mean about garbage, please see Win NT and Win98

Thanks in advance for any help!

Liam O'Hagan

Thanks Big Grin | :-D

Senior Test Engineer
GLI Australia
www.gli.com.au
GeneralRe: BitBlt on Win98 / WinNT Pin
2-May-01 6:29
suss2-May-01 6:29 
GeneralRe: BitBlt on Win98 / WinNT Pin
Liam O'Hagan2-May-01 13:15
Liam O'Hagan2-May-01 13:15 
GeneralRe: BitBlt on Win98 / WinNT Pin
Christian Graus2-May-01 12:41
protectorChristian Graus2-May-01 12:41 
GeneralRe: BitBlt on Win98 / WinNT Pin
Liam O'Hagan2-May-01 13:16
Liam O'Hagan2-May-01 13:16 
GeneralDrag and Drop tree view items Pin
wfalby1-May-01 10:35
wfalby1-May-01 10:35 
GeneralRe: Drag and Drop tree view items Pin
Tomasz Sowinski2-May-01 1:17
Tomasz Sowinski2-May-01 1:17 
GeneralActivating window Pin
F.Dost1-May-01 9:08
F.Dost1-May-01 9:08 
GeneralRe: Activating window Pin
1-May-01 9:55
suss1-May-01 9:55 
GeneralRe: Activating window Pin
Felix Cho1-May-01 11:35
Felix Cho1-May-01 11:35 
GeneralRe: Try this. Pin
Masaaki Onishi1-May-01 17:32
Masaaki Onishi1-May-01 17:32 
GeneralQuest on Flags... Pin
CMFC6.0VS.NETUser1-May-01 9:06
CMFC6.0VS.NETUser1-May-01 9:06 
GeneralRe: Quest on Flags... Pin
l a u r e n1-May-01 11:27
l a u r e n1-May-01 11:27 
GeneralRe: Quest on Flags... Pin
Michael Dunn1-May-01 16:29
sitebuilderMichael Dunn1-May-01 16:29 
GeneralRe: Quest on Flags... Pin
CMFC6.0VS.NETUser2-May-01 4:25
CMFC6.0VS.NETUser2-May-01 4:25 
Generalsimilar functions in vc++ for clreol and gotoxy Pin
1-May-01 8:55
suss1-May-01 8:55 
GeneralRe: similar functions in vc++ for clreol and gotoxy Pin
Christian Graus1-May-01 13:06
protectorChristian Graus1-May-01 13:06 
GeneralRe: similar functions in vc++ for clreol and gotoxy Pin
Tomasz Sowinski2-May-01 1:23
Tomasz Sowinski2-May-01 1:23 

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.