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

C / C++ / MFC

 
GeneralRe: Problem with DLL running in parallel Pin
Llasus8-Mar-10 1:50
Llasus8-Mar-10 1:50 
QuestionHow could I monitor the network adapter status ? Pin
EverettJF7-Mar-10 22:10
EverettJF7-Mar-10 22:10 
QuestionRe: How could I monitor the network adapter status ? Pin
Adam Roderick J7-Mar-10 22:39
Adam Roderick J7-Mar-10 22:39 
AnswerRe: How could I monitor the network adapter status ? Pin
EverettJF8-Mar-10 14:12
EverettJF8-Mar-10 14:12 
AnswerRe: How could I monitor the network adapter status ? Pin
Cool_Dev7-Mar-10 22:45
Cool_Dev7-Mar-10 22:45 
QuestionRe: How could I monitor the network adapter status ? Pin
David Crow8-Mar-10 5:52
David Crow8-Mar-10 5:52 
AnswerRe: How could I monitor the network adapter status ? Pin
EverettJF8-Mar-10 19:34
EverettJF8-Mar-10 19:34 
QuestionA problem of using CScrollView [modified] Pin
whiteclouds7-Mar-10 21:57
whiteclouds7-Mar-10 21:57 
Hi, All!
I am developing an application to show the Text file. Now I derive a class from CScrollView. But I find that the view will flicker at the time I scroll the window when the text is too long to show in one page. So I declare a variable of CBitmap as a member of ScrollView class. Then in the member function of OnUpdate(), I declare a variable of CDC to create a compatibleDC and select the CBitmap into it. After that, I try to draw the view, save the view into CBitmap and Bitblt it into the Device Context of the window in the member funcation OnPaint().
Code:
class CEditorView : public CScrollView
{
......
private:
	CBitmap m_bmpMem;//cache
......
}
void CEditorView::OnUpdate(CView* /*pSender*/, LPARAM /*lHint*/, CObject* /*pHint*/)
{
	CSize sizeTotal;
	//Calculate the size of View
	GetViewSize(sizeTotal);
	SetScrollSizes(MM_TEXT, sizeTotal);

	CDC *pDC,memDC;
	CBitmap *pOldBmp;

	pDC = GetDC();
	ASSERT(pDC != NULL);

	memDC.CreateCompatibleDC(pDC);
	memDC.SetMapMode(m_nMapMode);

	m_bmpMem.CreateCompatibleBitmap(pDC,sizeTotal.cx,sizeTotal.cy);
	pOldBmp = memDC.SelectObject(&m_bmpMem);
	OnDraw(&memDC);
	memDC.SelectObject(pOldBmp);

	ReleaseDC(pDC);
	InvalidateRect(NULL);
	UpdateWindow();

}
void CEditorView::OnDraw(CDC* pDC)
{
	CEditorDoc* pDoc = GetDocument();
	ASSERT(pDoc != NULL);
/*
Draw the content in View through pDC.
*/
}
void CEditorView::OnPaint()
{
	CPaintDC dc(this); // device context for painting
	CDC     MemDC;
	CBitmap *pOldBitmap;
	CSize size;

	OnPrepareDC(&dc);

	size = GetTotalSize(); 

	// Need a memory DC
	MemDC.CreateCompatibleDC(&dc);

	//Set MapMode
	MemDC.SetMapMode(m_nMapMode);

	// Select in the bitmap
	pOldBitmap =  MemDC.SelectObject(&m_bmpMem);

	// Blt it
	dc.BitBlt( 0, -size.cy, size.cx, size.cy, &MemDC, 0, -size.cy, SRCCOPY );

	// Clean up
	MemDC.SelectObject(pOldBitmap);

	CScrollView::OnPaint();
}

Question:
1. After I do as above, no text can be shown. I find that it will be shown only when I make the Message Declaration of OnPaint as comment. I don't know how to resolve it. I hope some one could be kind to tell me how to do. Thks!
2. What on earth the relation between OnPaint() and OnDraw()? Why the content can't be seen when I add the function OnPaint()?

Pls help me! Thks a lot!!

whiteclouds
There is some white cloud floating on the blue sky. That's the landscape I like.
modified on Monday, March 8, 2010 4:45 AM

GeneralRe: A problem of using CScrollView Pin
Rage8-Mar-10 4:19
professionalRage8-Mar-10 4:19 
GeneralRe: A problem of using CScrollView Pin
whiteclouds8-Mar-10 14:13
whiteclouds8-Mar-10 14:13 
GeneralRe: A problem of using CScrollView Pin
Rage8-Mar-10 4:24
professionalRage8-Mar-10 4:24 
QuestionLinker error - MFC DLL - missing constructor??? Pin
Vaclav_7-Mar-10 19:52
Vaclav_7-Mar-10 19:52 
AnswerRe: Linker error - MFC DLL - missing constructor??? Pin
Eugen Podsypalnikov7-Mar-10 20:29
Eugen Podsypalnikov7-Mar-10 20:29 
GeneralRe: Linker error - MFC DLL - missing constructor??? Pin
Vaclav_8-Mar-10 5:31
Vaclav_8-Mar-10 5:31 
GeneralRe: Linker error - MFC DLL - missing constructor??? Pin
Eugen Podsypalnikov8-Mar-10 19:47
Eugen Podsypalnikov8-Mar-10 19:47 
AnswerRe: Linker error - MFC DLL - missing constructor??? [modified] Pin
Stephen Hewitt7-Mar-10 20:32
Stephen Hewitt7-Mar-10 20:32 
AnswerRe: Linker error - MFC DLL - missing constructor??? Pin
KarstenK8-Mar-10 0:04
mveKarstenK8-Mar-10 0:04 
AnswerRe: Linker error - MFC DLL - missing constructor??? - Update Pin
Vaclav_8-Mar-10 4:59
Vaclav_8-Mar-10 4:59 
AnswerRe: Linker error - MFC DLL - missing constructor??? SOLVED with AFX_EXT_CLASS Pin
Vaclav_8-Mar-10 6:12
Vaclav_8-Mar-10 6:12 
QuestionCDAtataBase Example Pin
jannathali7-Mar-10 19:42
jannathali7-Mar-10 19:42 
AnswerRe: CDAtataBase Example Pin
KingsGambit7-Mar-10 19:53
KingsGambit7-Mar-10 19:53 
AnswerRe: CDAtataBase Example Pin
BIJU Manjeri7-Mar-10 21:18
BIJU Manjeri7-Mar-10 21:18 
QuestionHow to use Timer in win32 dll? Pin
Rahul Vaishnav7-Mar-10 19:35
Rahul Vaishnav7-Mar-10 19:35 
AnswerRe: How to use Timer in win32 dll? [modified] Pin
KingsGambit7-Mar-10 19:51
KingsGambit7-Mar-10 19:51 
AnswerRe: How to use Timer in win32 dll? Pin
Alain Rist7-Mar-10 22:00
Alain Rist7-Mar-10 22:00 

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.