Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Dialog box error

Dialog box error

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    RalfPeter
    wrote on last edited by
    #1

    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

    C S 2 Replies Last reply
    0
    • R RalfPeter

      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

      C Offline
      C Offline
      Chris Gao
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • R RalfPeter

        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

        S Offline
        S Offline
        Stephen Hewitt
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups