Jump to content











Photo
- - - - -

Painting Issue when CFileDialog run WinPE

mfc vc++ win32 c++ winpe

  • Please log in to reply
No replies to this topic

#1 Arunkumar Uthandan

Arunkumar Uthandan
  • Members
  • 1 posts
  •  
    India

Posted 27 October 2016 - 09:56 AM

I am facing an issue using CFileDialog in my code.

When I call the CFileDialog from ModalDialog, to select a file. My whole ModalDialog background gets erased once the current view is exited and reopened.

Procedure followed:

  1. Main Dialog

  2. Opened ModalDialog

  3. Opened CFileDialog for selecting file

  4. Exit ModalDialog

  5. Reopen ModalDialog [Background gets erased]

Note : This issue happens only WINPE environment and  if I select a file using CFlieDialog. If I click on Cancel in the CFileDialog. There is no issue. 

 

PFB, the code snippet of my CFileDialog use:

//This is the code to Open the DoModal dialog from MainWindow 
//
void CCommonDlg::OnBnClickedButton1()
{

COSDADlg dlg;
//m_pMainWnd = &dlg;
INT_PTR nResponse = dlg.DoModal();
if (nResponse == IDOK)
{

}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
}

}

// This is the code for open CFileDialog from ModalDialog to save file
//
void COSDADlg::OnBnClickedButton1()
{

CFileDialog dlgFile(FALSE);

CString fileName;
dlgFile.GetOFN().lpstrFile = fileName.GetBuffer(FILE_LIST_BUFFER_SIZE);
dlgFile.GetOFN().nMaxFile = FILE_LIST_BUFFER_SIZE;


INT_PTR nResult = dlgFile.DoModal();
fileName.ReleaseBuffer(); 

}

//This is the code to paint the background image for ModalDialog
//
void COSDADlg::OnPaint()
{
CPaintDC dc(this); // device context for painting

Graphics graph(dc.m_hDC);
CRect rt;
GetWindowRect(&rt);
graph.DrawImage(m_pImage, (INT)0, (INT)0, (INT)rt.Width() , (INT)rt.Height() );
DefWindowProc(WM_PAINT, (WPARAM)dc.m_hDC, (LPARAM)0);

}

It is not seems to be painting issue and it is related to winPE CFileDialog. It is working as expected When I run this code on my Windows 8.1 


Edited by Arunkumar Uthandan, 27 October 2016 - 09:58 AM.






Also tagged with one or more of these keywords: mfc, vc++, win32, c++, winpe

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users