Click here to Skip to main content
15,895,667 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralThe message when the dialog is covered Pin
jerome_data27-Jul-05 3:40
jerome_data27-Jul-05 3:40 
GeneralRe: The message when the dialog is covered Pin
David Crow27-Jul-05 4:03
David Crow27-Jul-05 4:03 
GeneralRe: The message when the dialog is covered Pin
jerome_data27-Jul-05 4:47
jerome_data27-Jul-05 4:47 
Questionhow to monitor the printer? Pin
szcococut27-Jul-05 3:11
szcococut27-Jul-05 3:11 
AnswerRe: how to monitor the printer? Pin
David Crow27-Jul-05 3:14
David Crow27-Jul-05 3:14 
GeneralRe: how to monitor the printer? Pin
szcococut27-Jul-05 4:29
szcococut27-Jul-05 4:29 
GeneralRe: how to monitor the printer? Pin
David Crow27-Jul-05 4:50
David Crow27-Jul-05 4:50 
GeneralUsing own controls in CFileDialog Pin
cbusgut27-Jul-05 2:48
cbusgut27-Jul-05 2:48 
Hello All

I want to use my own CButton-derived control in a CFileDialog (well, in fact I want to use a CEdit-derived one, a CComboBox-derived, and so on, but I'm starting with the button to simplify)

At this momment I have a CFileDialog derived class (CMyFileDialog) where I have declared two member variables:

CMyButton m_btnOk;
CMyButton m_btnCancel;

In the OnInitDialog function

BOOL CMyFileDialog::OnInitDialog() 
{
	CFileDialog::OnInitDialog();
		
	m_btnOk.SubclassDlgItem(IDOK,GetParent());
	m_btnCancel.SubclassDlgItem(IDCANCEL,GetParent());
		
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}


The dialog behaviour is as expected, but when Cancel or Ok button are pressed this assert happens:

LRESULT CALLBACK
AfxWndProc(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam)
{
	// special message which identifies the window as using AfxWndProc
	if (nMsg == WM_QUERYAFXWNDPROC)
		return 1;

	// all other messages route through message map
	CWnd* pWnd = CWnd::FromHandlePermanent(hWnd);
	ASSERT(pWnd != NULL);
	ASSERT(pWnd->m_hWnd == hWnd);
	if (pWnd == NULL || pWnd->m_hWnd != hWnd)
		return ::DefWindowProc(hWnd, nMsg, wParam, lParam);
	return AfxCallWndProc(pWnd, hWnd, nMsg, wParam, lParam);
}


If I only subclass the IDOK button this assert does not occurs. Any idea?
GeneralGetting the item from toolbar Pin
Raul Simcic27-Jul-05 2:41
Raul Simcic27-Jul-05 2:41 
Generalpointer of last occurance of word Pin
itkid27-Jul-05 2:36
itkid27-Jul-05 2:36 
GeneralRe: pointer of last occurance of word Pin
David Crow27-Jul-05 2:54
David Crow27-Jul-05 2:54 
GeneralRe: pointer of last occurance of word Pin
Fred96727-Jul-05 3:04
Fred96727-Jul-05 3:04 
GeneralRe: pointer of last occurance of word Pin
David Crow27-Jul-05 3:12
David Crow27-Jul-05 3:12 
GeneralRe: pointer of last occurance of word Pin
itkid18-Nov-05 9:58
itkid18-Nov-05 9:58 
GeneralWindows Server 2003 and ISAPIs Pin
GuimaSun27-Jul-05 2:30
GuimaSun27-Jul-05 2:30 
GeneralBCH Encoder Pin
Abbas_Riazi27-Jul-05 2:00
professionalAbbas_Riazi27-Jul-05 2:00 
GeneralFile Saving Problem, ofstream. Pin
tomek1827-Jul-05 1:22
tomek1827-Jul-05 1:22 
GeneralRe: File Saving Problem, ofstream. Pin
Bob Stanneveld27-Jul-05 1:41
Bob Stanneveld27-Jul-05 1:41 
QuestionDialogBox in a DLL? Pin
Larsson27-Jul-05 1:07
Larsson27-Jul-05 1:07 
AnswerRe: DialogBox in a DLL? Pin
Ray Kinsella27-Jul-05 2:24
Ray Kinsella27-Jul-05 2:24 
GeneralRe: DialogBox in a DLL? Pin
Larsson27-Jul-05 2:48
Larsson27-Jul-05 2:48 
Generalstrangely modeles dialog box working even when i didnt destroy object Pin
sayup27-Jul-05 1:02
sayup27-Jul-05 1:02 
GeneralRe: strangely modeles dialog box working even when i didnt destroy object Pin
Rage27-Jul-05 1:35
professionalRage27-Jul-05 1:35 
GeneralRe: strangely modeles dialog box working even when i didnt destroy object Pin
sayup27-Jul-05 2:27
sayup27-Jul-05 2:27 
GeneralRe: strangely modeles dialog box working even when i didnt destroy object Pin
sayup27-Jul-05 18:56
sayup27-Jul-05 18:56 

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.