Click here to Skip to main content
15,908,112 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Sorting Ctime items in a list ctrl??? Pin
Cedric Moonen15-Apr-08 0:48
Cedric Moonen15-Apr-08 0:48 
GeneralRe: Sorting Ctime items in a list ctrl??? Pin
Priya_Sundar15-Apr-08 1:15
Priya_Sundar15-Apr-08 1:15 
GeneralRe: Sorting Ctime items in a list ctrl??? Pin
Cedric Moonen15-Apr-08 1:25
Cedric Moonen15-Apr-08 1:25 
GeneralRe: Sorting Ctime items in a list ctrl??? Pin
Priya_Sundar16-Apr-08 2:39
Priya_Sundar16-Apr-08 2:39 
GeneralRe: Sorting Ctime items in a list ctrl??? Pin
Cedric Moonen16-Apr-08 2:50
Cedric Moonen16-Apr-08 2:50 
GeneralThankyou. Pin
Priya_Sundar16-Apr-08 23:56
Priya_Sundar16-Apr-08 23:56 
GeneralAnd one more thing... Pin
Cedric Moonen15-Apr-08 1:36
Cedric Moonen15-Apr-08 1:36 
GeneralInserting a BMP image in the Picture control on the dialog window. Pin
Pruthvi.gm15-Apr-08 0:15
Pruthvi.gm15-Apr-08 0:15 
Hello All,

I am trying to insert a BMP image in to picture control.

I have added Microsoft common dialog control Ver6 ActiveX control.

IDC_COMMONDIALOG1 Type :- CcommonDialog1 Member:- m_com

Picture Control:-
IDC_STATIC1 Type :- CStatic Member:- m_st1

I have show button in the dialog, when the we click on that we can select a BMP file and show the same file in the Picture control in the dialog.for that i have used the below code.

void CImageAppDlg::OnShow() <br />
{<br />
	// TODO: Add your control notification handler code here<br />
<br />
<br />
<br />
	CString	file;<br />
	file.Empty();<br />
	m_com.ShowOpen();<br />
	file=m_com.GetFileName();<br />
	file.TrimRight();<br />
<br />
<br />
	if(m_hBmpNew != NULL )<br />
		DeleteObject(m_hBmpNew);<br />
	sourcex=sourcey=0;//<br />
	if(file.IsEmpty())<br />
AfxMessageBox("Please Select a picture file");<br />
		else{<br />
			if(file.Right(3)!="bmp")<br />
			AfxMessageBox("Please Select a .bmp file");<br />
			else<br />
			{<br />
	m_hBmpNew =	 (HBITMAP) LoadImage(<br />
	AfxGetInstanceHandle(),  <br />
	file,  <br />
	IMAGE_BITMAP,    <br />
	0,     <br />
	0,    <br />
	LR_LOADFROMFILE); <br />
	if( m_hBmpNew == NULL ){<br />
	AfxMessageBox("Load Image Failed");}<br />
	<br />
   else{<br />
	m_st1.GetClientRect( &rectStaticClient );<br />
	rectStaticClient.NormalizeRect();<br />
	m_size.cx=rectStaticClient.Size().cx;<br />
	m_size.cy=rectStaticClient.Size().cy;<br />
    m_size.cx = rectStaticClient.Width();    // zero based<br />
    m_size.cy = rectStaticClient.Height();    // zero based<br />
<br />
    <br />
  m_st1.ClientToScreen( &rectStaticClient );<br />
  ScreenToClient( &rectStaticClient);<br />
        <br />
    m_pt.x = rectStaticClient.left;<br />
    m_pt.y = rectStaticClient.top;<br />
  GetObject( m_hBmpNew , sizeof(BITMAP), &m_bmInfo );<br />
 VERIFY(m_hBmpOld = (HBITMAP)SelectObject(m_dcMem, m_hBmpNew )  );<br />
<br />
  offsetx= m_pt.x;<br />
  offsety=m_pt.y;<br />
if(m_bmInfo.bmWidth<=m_size.cx)<br />
{<br />
	if((m_size.cx-m_bmInfo.bmWidth)==0)<br />
		offsetx= m_pt.x;<br />
	else<br />
		offsetx= m_pt.x+((m_size.cx-m_bmInfo.bmWidth)/2);<br />
<br />
}<br />
else<br />
if(m_bmInfo.bmHeight<=m_size.cy)<br />
{<br />
	if((m_size.cy-m_bmInfo.bmHeight)==0)<br />
		offsety= m_pt.y;<br />
	else<br />
		offsety= m_pt.y+((m_size.cy-m_bmInfo.bmHeight)/2);<br />
}<br />
else<br />
<br />
  InvalidateRect(&rectStaticClient);<br />
		}<br />
			}<br />
		}<br />
<br />
}<br />


code has no errors but in the run time i am getting this error

Microsoft VC++ Debug Library

Debug Assertion Failed Error


Can u please tell me what is cause for the error ??Confused | :confused:

Thanking you ...
Pruthvi R.
GeneralRe: Inserting a BMP image in the Picture control on the dialog window. Pin
Hamid_RT15-Apr-08 0:37
Hamid_RT15-Apr-08 0:37 
GeneralRe: Inserting a BMP image in the Picture control on the dialog window. Pin
Pruthvi.gm15-Apr-08 0:54
Pruthvi.gm15-Apr-08 0:54 
GeneralRe: Inserting a BMP image in the Picture control on the dialog window. Pin
Hamid_RT15-Apr-08 1:32
Hamid_RT15-Apr-08 1:32 
GeneralRe: Inserting a BMP image in the Picture control on the dialog window. Pin
Pruthvi.gm15-Apr-08 1:38
Pruthvi.gm15-Apr-08 1:38 
GeneralRe: Inserting a BMP image in the Picture control on the dialog window. Pin
Hamid_RT15-Apr-08 1:51
Hamid_RT15-Apr-08 1:51 
GeneralRe: Inserting a BMP image in the Picture control on the dialog window. Pin
Hamid_RT16-Apr-08 19:59
Hamid_RT16-Apr-08 19:59 
QuestionProblem using OnKeyDown in CDialog ???? Pin
TooShy2Talk15-Apr-08 0:13
TooShy2Talk15-Apr-08 0:13 
AnswerRe: Problem using OnKeyDown in CDialog ???? Pin
Hamid_RT15-Apr-08 0:40
Hamid_RT15-Apr-08 0:40 
AnswerRe: Problem using OnKeyDown in CDialog ???? Pin
TooShy2Talk15-Apr-08 0:59
TooShy2Talk15-Apr-08 0:59 
GeneralRe: Problem using OnKeyDown in CDialog ???? Pin
Hamid_RT15-Apr-08 1:32
Hamid_RT15-Apr-08 1:32 
GeneralRe: Problem using OnKeyDown in CDialog ???? Pin
TooShy2Talk15-Apr-08 17:09
TooShy2Talk15-Apr-08 17:09 
GeneralRe: Problem using OnKeyDown in CDialog ???? Pin
Hamid_RT15-Apr-08 19:43
Hamid_RT15-Apr-08 19:43 
QuestionHow to modify a class name? Pin
Wormhole523015-Apr-08 0:10
Wormhole523015-Apr-08 0:10 
AnswerRe: How to change a class name? Pin
toxcct15-Apr-08 0:14
toxcct15-Apr-08 0:14 
GeneralRe: How to change a class name? Pin
Wormhole523015-Apr-08 1:44
Wormhole523015-Apr-08 1:44 
GeneralRe: How to change a class name? Pin
jhwurmbach15-Apr-08 6:24
jhwurmbach15-Apr-08 6:24 
AnswerRe: How to modify a class name? Pin
CPallini15-Apr-08 2:45
mveCPallini15-Apr-08 2:45 

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.