Click here to Skip to main content
15,887,434 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: two digits in edit control Pin
Cedric Moonen6-Mar-05 21:30
Cedric Moonen6-Mar-05 21:30 
GeneralRe: two digits in edit control Pin
Steen Krogsgaard6-Mar-05 21:39
Steen Krogsgaard6-Mar-05 21:39 
GeneralAutomatic scrolling in ListBox Pin
Majid Shahabfar6-Mar-05 20:40
Majid Shahabfar6-Mar-05 20:40 
GeneralRe: Automatic scrolling in ListBox Pin
V.6-Mar-05 22:26
professionalV.6-Mar-05 22:26 
GeneralRe: Automatic scrolling in ListBox Pin
Majid Shahabfar7-Mar-05 0:56
Majid Shahabfar7-Mar-05 0:56 
GeneralRe: Automatic scrolling in ListBox Pin
V.7-Mar-05 1:18
professionalV.7-Mar-05 1:18 
GeneralRe: Automatic scrolling in ListBox Pin
Jetli Jerry6-Mar-05 23:45
Jetli Jerry6-Mar-05 23:45 
Generalmemory management utilization probz!!!!! Pin
namaskaaram6-Mar-05 19:13
namaskaaram6-Mar-05 19:13 
i seem to have probz with my dialog based application.....my main dialog callz a modal dialog (which basically loadz some imagez into the screen) and then when i close thiz modal dialog....i see that the memory is not freed!!!!!(i came to view that from taskmanager)....each time i call this modal dialog,it increases by a definitive amount(520kb).....i have freed the dc memery and also even the pointer dynamically created for the modal dialog.....HELP....herez the code.....

THIZ IZ HOW I HAVE CALLED THE MODAL DIALOG FROM MY MAIN DIALOG!!!!!
CMyPresetViewer *PresetViewerDlg = new CMyPresetViewer;//creating a dynamic pointer to the presetdialog

if(PresetViewerDlg->DoModal()==IDOK)
{
//DO SOMETHING.....I HAVE DONE NOTHING THOUGH!!!!!
}

delete PresetViewerDlg;


THIZ IZ THE CODE THAT IZ WRITTEN IN THE MODAL DIALOG
void CMyPresetViewer::OnStatic1() //close button(x)//WHEN THE APPLICATION CLOSES
{

	// TODO: Add your control notification handler code here
	ReleaseDC(m_dcPresetViewerDialog);//m_dcPresetViewerDialog IZ A CDC POINTER DYNAMICALLY CREATED IN THE CONSTRUCTOR
	delete m_dcPresetViewerDialog;
	AfxMessageBox("done");
	CDialog::OnOK();	
}

BOOL CMyPresetViewer::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	m_DragOn=FALSE;

	CClientDC dc(this);
	m_dcPresetViewerDialog->CreateCompatibleDC( &dc );


	m_hBmpNew = (HBITMAP) LoadImage(
    AfxGetInstanceHandle(),   // handle to instance
    MAKEINTRESOURCE(IDB_BITMAP59),  // name or identifier of the image .say"C:\\NewFolder\\1.bmp"
    IMAGE_BITMAP,        // image types
    0,     // desired width
    0,     // desired height
    LR_CREATEDIBSECTION); 

    if( m_hBmpNew == NULL )
    {
        AfxMessageBox("Load Image Failed");
    }
    
    // put the HBITMAP info into the CBitmap (but not the bitmap itself)
    else {
        m_st0.GetClientRect( &rectStaticClient );
        rectStaticClient.NormalizeRect();
        m_size.cx=rectStaticClient.Size().cx;
        m_size.cy=rectStaticClient.Size().cy;
        m_size.cx = rectStaticClient.Width();    // zero based
        m_size.cy = rectStaticClient.Height();    // zero based

        // Convert to screen coordinates using static as base,
        // then to DIALOG (instead of static) client coords 
        // using dialog as base
        m_st0.ClientToScreen( &rectStaticClient );
        ScreenToClient( &rectStaticClient);
        
        GetObject( m_hBmpNew , sizeof(BITMAP), &m_bmInfo );
        VERIFY(m_hBmpOld = (HBITMAP)SelectObject(*m_dcPresetViewerDialog, m_hBmpNew )  );

        offsetx= rectStaticClient.left;
        offsety= rectStaticClient.top;
//		InvalidateRect(&rectStaticClient);
		}	




	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CMyPresetViewer::OnCancel() 
{
	// TODO: Add extra cleanup here
	
	CDialog::OnCancel();
}

void CMyPresetViewer::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	// TODO: Add your message handler code here

	dc.BitBlt(offsetx,offsety,m_size.cx,m_size.cy,m_dcPresetViewerDialog, 0, 0,SRCCOPY);	

	// Do not call CDialog::OnPaint() for painting messages
}

}




CAN ANYONE TELL ME WHERE I HAVE GONE WRONG!!!!!
I SEEM TO HAVE FREED AL THE RESOURCES.....Confused | :confused:

HEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEELP!!!!!


thankz in advance.....


"faith, hope, love remain, these three.....; but the greatest of these is love" -1 Corinthians 13:13
GeneralRe: memory management utilization probz!!!!! Pin
Bob Stanneveld6-Mar-05 20:24
Bob Stanneveld6-Mar-05 20:24 
GeneralRe: memory management utilization probz!!!!! Pin
namaskaaram6-Mar-05 21:45
namaskaaram6-Mar-05 21:45 
GeneralRe: memory management utilization probz!!!!! Pin
Bob Stanneveld7-Mar-05 20:35
Bob Stanneveld7-Mar-05 20:35 
GeneralRe: memory management utilization probz!!!!! Pin
namaskaaram8-Mar-05 16:32
namaskaaram8-Mar-05 16:32 
GeneralRe: memory management utilization probz!!!!! Pin
David Crow7-Mar-05 10:52
David Crow7-Mar-05 10:52 
GeneralMouse Cursor Hot Spot Pin
User 1026746-Mar-05 16:29
User 1026746-Mar-05 16:29 
GeneralRe: Mouse Cursor Hot Spot Pin
PJ Arends6-Mar-05 16:35
professionalPJ Arends6-Mar-05 16:35 
GeneralMessage Closed Pin
6-Mar-05 16:45
User 1026746-Mar-05 16:45 
GeneralRe: Mouse Cursor Hot Spot Pin
PJ Arends6-Mar-05 18:03
professionalPJ Arends6-Mar-05 18:03 
GeneralCompilation from script Pin
Anonymous6-Mar-05 3:31
Anonymous6-Mar-05 3:31 
Generaltray icons disappearing Pin
Kevin Tambascio6-Mar-05 3:09
Kevin Tambascio6-Mar-05 3:09 
GeneralCListCtrl Pin
super_pointer6-Mar-05 2:38
super_pointer6-Mar-05 2:38 
GeneralRe: CListCtrl Pin
PJ Arends6-Mar-05 12:26
professionalPJ Arends6-Mar-05 12:26 
GeneralRe: CListCtrl Pin
super_pointer6-Mar-05 14:58
super_pointer6-Mar-05 14:58 
GeneralRe: CListCtrl Pin
PJ Arends6-Mar-05 16:29
professionalPJ Arends6-Mar-05 16:29 
GeneralRe: CListCtrl Pin
ThatsAlok6-Mar-05 19:55
ThatsAlok6-Mar-05 19:55 
GeneralNon blocking socket problem Pin
eli150219796-Mar-05 0:54
eli150219796-Mar-05 0:54 

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.