How to solve Error C2039: 'CFileDialog' : is not a member of 'CWnd'

Trips

Well-known member
Joined
Aug 7, 2010
Messages
2,788
i wanted to have an event handler where on button click, i can open an image.
but im having problem about using CFileDialog (Error C2039: CFileDialog : is not a member of CWnd)
here is my code:

<pre>void MyAlbum::OnBnClickedBnbrowse()
{
GetDlgItem( IDC_BnBrowse ) ->
// TODO: Add your control notification handler code here
//Error 2039--------------------------
CFileDialog dlg(TRUE, NULL, NULL, OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY, _T("image files (*.bmp; *.jpg) |*.bmp; *.jpg; *.jpeg | All Files (*.*) |*.*||"), NULL);
dlg.m_ofn.lpstrTitle = _T("Open Image");
if( dlg.DoModal() != IDOK )
return;

CString mPath = dlg.GetPathName();

IplImage* ipl = cvLoadImage( mPath, 1 );
if( !ipl )
return;
if( TheImage )
cvZero( TheImage );

ResizeImage( ipl );
ShowImage( TheImage, IDC_Iquery );
cvReleaseImage( &ipl );
}[/code]
is that because i missing some header file or something?
I tried to search on google and also forum, but i failed to find any solutions.


View the full article
 
Back
Top