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

C / C++ / MFC

 
AnswerRe: What is FIRST message !!! Pin
Phil J Pearson4-Sep-02 2:41
Phil J Pearson4-Sep-02 2:41 
GeneralAmIAdmin Pin
orcun colak3-Sep-02 10:33
orcun colak3-Sep-02 10:33 
GeneralRe: AmIAdmin Pin
Tomasz Sowinski3-Sep-02 10:41
Tomasz Sowinski3-Sep-02 10:41 
GeneralRe: AmIAdmin Pin
Michael Dunn3-Sep-02 10:49
sitebuilderMichael Dunn3-Sep-02 10:49 
GeneralRe: AmIAdmin Pin
Tomasz Sowinski3-Sep-02 10:55
Tomasz Sowinski3-Sep-02 10:55 
GeneralRe: AmIAdmin Pin
Joaquín M López Muñoz3-Sep-02 22:33
Joaquín M López Muñoz3-Sep-02 22:33 
GeneralRe: AmIAdmin Pin
Mike Nordell3-Sep-02 23:53
Mike Nordell3-Sep-02 23:53 
GeneralDC, bitmaps, and view questions Pin
JohnnyG3-Sep-02 10:21
JohnnyG3-Sep-02 10:21 
I've tried using a CStatic control in my CView derived class to animate a bitmap. I use 4 separate bitmaps but after a couple of minutes (variable) it fails and I get an error related to CBitmap. This also messes up all of Windows graphically. So, after playing around with it, I decided to give up on CBitmap and CStatic. FYI, here is what I had:
MyViewClass::OnTimer(UINT nIDEvent)
{
	if(nIDEvent == m_AnimTimerId)		
	{
		if(BmpId == IDB_ASTLEFT + 4)
			BmpId = IDB_ASTLEFT;

		CStatic *pTargetCtrl = (CStatic *) GetDlgItem(IDC_ERR_STATIC);
		ASSERT(pTargetCtrl != NULL);

		m_CurrentBmp.Detach();
		m_CurrentBmp.LoadBitmap(BmpId);
		pTargetCtrl->SetBitmap(m_CurrentBmp);

                BmpId++;
        }
}

So, I decided to use memory DCs and blt it onto the screen. However, I am not sure I am obtaining the DC correctly since I get an error in the bitblt routine now used in the timer routine.
void CStatsView::InitialDraw()
{
	pTheDC = GetDC();

	// create memory DCs and select animation bitmaps into them for blitting in the timer event
	// for updating the animation. This is done here so that bitmaps are loaded once and only once
	// and they are selected into the memory DCs once also.
	CBitmap			bmp1, bmp2, bmp3, bmp4;		// first, create 4 bitmap objects

	bmp1.LoadBitmap(IDB_ASTLEFT);
	bmp2.LoadBitmap(IDB_ASTLEFT+1);
	bmp3.LoadBitmap(IDB_ASTLEFT+2);
	bmp4.LoadBitmap(IDB_ASTLEFT+4);

	// create compatible memory dcs - compatible with the display
	dcMem1.CreateCompatibleDC(pTheDC);
	dcMem2.CreateCompatibleDC(pTheDC);
	dcMem3.CreateCompatibleDC(pTheDC);
	dcMem4.CreateCompatibleDC(pTheDC);

	// select bitmaps into their respective memory dc
	dcMem1.SelectObject(&bmp1);
	dcMem2.SelectObject(&bmp2);
	dcMem3.SelectObject(&bmp3);
	dcMem4.SelectObject(&bmp4);

}


The OnTimer code now looks like this:
if(BmpId == IDB_ASTLEFT + 4)
    BmpId = IDB_ASTLEFT;
switch(BmpId)
{
    case IDB_ASTLEFT :
        pTheDC->BitBlt(0, 0, 7, 7, &dcMem1, 0, 0, SRCCOPY);
    break;
    case IDB_ASTLEFT + 1 :
            pTheDC->BitBlt(0, 0, 7, 7, &dcMem2, 0, 0, SRCCOPY);
    break;
    case IDB_ASTLEFT + 2 :
        pTheDC->BitBlt(0, 0, 7, 7, &dcMem3, 0, 0, SRCCOPY);
    break;
    case IDB_ASTLEFT + 3 :
        pTheDC->BitBlt(0, 0, 7, 7, &dcMem4, 0, 0, SRCCOPY);
    break;
}

BmpId++;


If that is the case, where in my view should I obtain a pointer to the DC?
GeneralRe: DC, bitmaps, and view questions Pin
Tomasz Sowinski3-Sep-02 10:23
Tomasz Sowinski3-Sep-02 10:23 
GeneralRe: DC, bitmaps, and view questions Pin
JohnnyG4-Sep-02 17:30
JohnnyG4-Sep-02 17:30 
Generalprogress bar never shows on status bar Pin
RalfPeter3-Sep-02 9:26
RalfPeter3-Sep-02 9:26 
GeneralRe: progress bar never shows on status bar Pin
Tomasz Sowinski3-Sep-02 9:34
Tomasz Sowinski3-Sep-02 9:34 
GeneralRe: progress bar never shows on status bar Pin
RalfPeter3-Sep-02 11:21
RalfPeter3-Sep-02 11:21 
GeneralRe: progress bar never shows on status bar Pin
Tomasz Sowinski3-Sep-02 23:36
Tomasz Sowinski3-Sep-02 23:36 
GeneralRe: progress bar never shows on status bar Pin
Pavel Klocek3-Sep-02 10:04
Pavel Klocek3-Sep-02 10:04 
GeneralChanging Windows background !!! Pin
Hadi Rezaee3-Sep-02 8:14
Hadi Rezaee3-Sep-02 8:14 
GeneralRe: Changing Windows background !!! Pin
lucy3-Sep-02 9:00
lucy3-Sep-02 9:00 
GeneralRe: Changing Windows background !!! Pin
Hadi Rezaee3-Sep-02 9:07
Hadi Rezaee3-Sep-02 9:07 
GeneralRe: Changing Windows background !!! Pin
User 66583-Sep-02 9:14
User 66583-Sep-02 9:14 
GeneralRe: Changing Windows background !!! Pin
Jason Henderson3-Sep-02 9:42
Jason Henderson3-Sep-02 9:42 
GeneralRe: Changing Windows background !!! Pin
Hadi Rezaee3-Sep-02 10:12
Hadi Rezaee3-Sep-02 10:12 
GeneralInserting a Child dialog to Parent dialog !!! Pin
Hadi Rezaee3-Sep-02 8:10
Hadi Rezaee3-Sep-02 8:10 
GeneralRe: Inserting a Child dialog to Parent dialog !!! Pin
Chris Losinger3-Sep-02 10:44
professionalChris Losinger3-Sep-02 10:44 
GeneralRe: Inserting a Child dialog to Parent dialog !!! Pin
Hadi Rezaee3-Sep-02 10:56
Hadi Rezaee3-Sep-02 10:56 
GeneralDAO: linking dbf table with different extension Pin
AndyR3-Sep-02 6:16
AndyR3-Sep-02 6:16 

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.