Dialog box error
-
Hi all, I am trying to instantiate a dialog box and keep getting the error message 'too few parameters, expected 2' the offending piece of code is: void CFisheriesView::OnAlmforeignkeys() { COpenDB open; //ok open.ALM(); //ok CALMFKeyDlg dlg; //bombs out here dlg.DoModal(); } Anyone can give me some pointers? Thx, Ralf. ralf.riedel@usm.edu
-
Hi all, I am trying to instantiate a dialog box and keep getting the error message 'too few parameters, expected 2' the offending piece of code is: void CFisheriesView::OnAlmforeignkeys() { COpenDB open; //ok open.ALM(); //ok CALMFKeyDlg dlg; //bombs out here dlg.DoModal(); } Anyone can give me some pointers? Thx, Ralf. ralf.riedel@usm.edu
Hi RalfPeter, I guess your dialog class is derived from CDialog. Is that right? If you create a mfc dialog application, use default settings and just go 'finish' to create the code, you may find the following piece of codes in your ...Dlg.cpp file:
CtestmfcDlg::CtestmfcDlg(CWnd* pParent /*=NULL*/) : CDialog(CtestmfcDlg::IDD, pParent) { m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); }
Here you can see that the CDialog class actually need two or one parameter to initialize. You need to do this in your code as well. The IDD is a id to a dialog resource. you can create a new dialog resource by using 'add' option in the drop down menu of the resource explorer window. Regards, Chris -
Hi all, I am trying to instantiate a dialog box and keep getting the error message 'too few parameters, expected 2' the offending piece of code is: void CFisheriesView::OnAlmforeignkeys() { COpenDB open; //ok open.ALM(); //ok CALMFKeyDlg dlg; //bombs out here dlg.DoModal(); } Anyone can give me some pointers? Thx, Ralf. ralf.riedel@usm.edu
It looks like the constructor expects arguments. ie.
CALMFKeyDlg dlg(something_here, and_something_here);
You'll have to look at the definition of
CALMFKeyDlg::CALMFKeyDlg
to see what it expects. Steve