line 26

Microsoft Developer Network > Forums Home > Visual C++ Forums > Visual C++ Language > "Parameter is incorrect” when CPropertySheet::DoModal() is called

Answer"Parameter is incorrect” when CPropertySheet::DoModal() is called

  • Tuesday, April 07, 2009 10:18 AM Ramesh Kumar. S Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    //The code in .cpp file

     

    AfxMessageBox("near if condition");

     

    if(InputSheet.DoModal()== IDOK)

     

    {

     

    AfxMessageBox("Entered if condition");

     

    }

     

    The outer message box “near if condition” get displayed, followed by “Parameter is incorrect” dialog box. Why “Parameter is incorrect” is getting displayed? What goes wrong? Any ideas. Plz do help.

     

    //The declaration of InputSheet is as follows:

    CInputSheet     InputSheet(this,_T("Input Screen"));

     

    //The CInputSheet.h file content is as follows:

     

    class CInputSheet : public CPropertySheet

    {

          DECLARE_DYNAMIC(CInputSheet)

     

    // Construction

    public:

          CInputSheet(UINT nIDCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);

          CInputSheet(LPCTSTR pszCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);

          CInputSheet(CMainFrame* pMainFrame, LPCTSTR pszCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);

         

    public:

          CMainFrame*      m_pMainFrame;

         

         

    // Operations

    public:

     

          public:

          virtual BOOL OnInitDialog();

         

        void MyTab();

         

    public:

          virtual ~CInputSheet();

     

          // Generated message map functions

    protected:

                afx_msg void OnContextHelp();

         

          DECLARE_MESSAGE_MAP()

    };

     

     

    #endif

Answers

  • Friday, April 10, 2009 11:56 AM davewilkMVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
      Answer
    I don't know what is the matter with your code, but if it were me and I was having trouble adding seven pages, I would try just adding one page (or even no pages).

    Did you follow these rules when creating your pages:

    • Set the Caption edit box on the General page to the text you wish to appear in the tab for this page.

    • Set the Style list box on the Styles page to Child .

    • Set the Border list box on the Styles page to Thin .

    • Ensure that the Titlebar check box on the Styles page is selected.

    • Ensure that the Disabled check box on the More Styles page is selected.

    ?
    David Wilkinson | Visual C++ MVP
    • Marked As Answer byWesley Yao Monday, April 13, 2009 2:31 AM
    •  
  • Saturday, April 11, 2009 2:48 PM davewilkMVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
      Answer
    Maybe GetCurSel() is returning CB_ERR because there is no selection?

    Really, you should be checking these things for yourself. You have (finally) found the place in your code where the problem arises.
    David Wilkinson | Visual C++ MVP

All Replies

  • Tuesday, April 07, 2009 11:55 AM nobugzMVP, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Use Debug + Break All when the dialog is displayed.  Look at the call stack to find the code that is complaining.
    Hans Passant.
  • Tuesday, April 07, 2009 12:52 PM Ramesh Kumar. S Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thanks nobugz!

                           This is the output result after using Debug + Break

    First-chance exception at 0x7c81eb33 in MultiLateral.exe: Microsoft C++ exception: COleException at memory location 0x0012b56c..


    This appears exactly when it executes if statement.

    Any help.

    Thanks in advance.
                         
  • Tuesday, April 07, 2009 1:04 PM nobugzMVP, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Call stack, not the Output window.
    Hans Passant.
  • Tuesday, April 07, 2009 2:53 PM Ramesh Kumar. S Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hi nobugz,

    Here is my Call Stack

    > Sample.exe!CMainFrame::OnOpenSampleFile()  Line 3099 C++
      mfc80.dll!_AfxDispatchCmdMsg(CCmdTarget * pTarget=0x00000000, unsigned int nID=32772, int nCode=1242612, void (void)* pfn=0x00000000, void * pExtra=0x00000000, unsigned int nSig=56, AFX_CMDHANDLERINFO * pHandlerInfo=0x00000000)  Line 82 C++
      mfc80.dll!CCmdTarget::OnCmdMsg(unsigned int nID=32772, int nCode=0, void * pExtra=0x00000000, AFX_CMDHANDLERINFO * pHandlerInfo=0x00000000)  Line 381 + 0x16 bytes C++
      mfc80.dll!CFrameWnd::OnCmdMsg(unsigned int nID=32772, int nCode=0, void * pExtra=0x00000000, AFX_CMDHANDLERINFO * pHandlerInfo=0x00000000)  Line 891 + 0x13 bytes C++
      mfc80.dll!CMDIFrameWnd::OnCmdMsg(unsigned int nID=32772, int nCode=0, void * pExtra=0x00000000, AFX_CMDHANDLERINFO * pHandlerInfo=0x00000000)  Line 82 C++
      mfc80.dll!CWnd::OnCommand(unsigned int wParam=0, long lParam=2297564)  Line 2299 + 0xd bytes C++
      mfc80.dll!CFrameWnd::OnCommand(unsigned int wParam=32772, long lParam=2297564)  Line 317 + 0xf bytes C++
      mfc80.dll!CMDIFrameWnd::OnCommand(unsigned int wParam=32772, long lParam=2297564)  Line 51 + 0xc bytes C++
      mfc80.dll!CWnd::OnWndMsg(unsigned int message=273, unsigned int wParam=32772, long lParam=2297564, long * pResult=0x0012f7bc)  Line 1755 + 0x10 bytes C++
      mfc80.dll!CWnd::WindowProc(unsigned int message=273, unsigned int wParam=32772, long lParam=2297564)  Line 1741 + 0x17 bytes C++
      mfc80.dll!AfxCallWndProc(CWnd * pWnd=0x00000000, HWND__ * hWnd=0x001e0e3c, unsigned int nMsg=273, unsigned int wParam=32772, long lParam=2297564)  Line 243 C++
      mfc80.dll!AfxWndProc(HWND__ * hWnd=0x001e0e3c, unsigned int nMsg=273, unsigned int wParam=32772, long lParam=2297564)  Line 388 + 0x10 bytes C++
      mfc80.dll!AfxWndProcBase(HWND__ * hWnd=0x001e0e3c, unsigned int nMsg=273, unsigned int wParam=32772, long lParam=2297564)  Line 407 + 0x16 bytes C++
      user32.dll!77d48709()  
      [Frames below may be incorrect and/or missing, no symbols loaded for user32.dll] 
      user32.dll!77d487eb()  
      user32.dll!77d70494()  
      user32.dll!77d4b368()  
      user32.dll!77d70494()  
      user32.dll!77d4b3b4()  
      ntdll.dll!7c90eae3()  
      user32.dll!77d494e3()  
      user32.dll!77d4de6e()  
      user32.dll!77d4b7ab()  
      comctl32.dll!5d0cb204()  
      comctl32.dll!5d09ad6c()  
      user32.dll!77d494e3()  
      user32.dll!77d4de6e()  
      user32.dll!77d48709()  
      user32.dll!77d487eb()  
      user32.dll!77d70494()  
      user32.dll!77d4c00e()  
      user32.dll!77d4e366()  
      mfc80.dll!CWnd::DefWindowProcA(unsigned int nMsg=514, unsigned int wParam=0, long lParam=1769489)  Line 1035 + 0x13 bytes C++
      mfc80.dll!CWnd::WindowProc(unsigned int message=514, unsigned int wParam=0, long lParam=1769489)  Line 1742 + 0x13 bytes C++
      mfc80.dll!CControlBar::WindowProc(unsigned int nMsg=514, unsigned int wParam=0, long lParam=1769489)  Line 504 + 0xc bytes C++
      mfc80.dll!AfxCallWndProc(CWnd * pWnd=0x00000000, HWND__ * hWnd=0x00230edc, unsigned int nMsg=514, unsigned int wParam=0, long lParam=1769489)  Line 243 C++
      mfc80.dll!AfxWndProc(HWND__ * hWnd=0x00230edc, unsigned int nMsg=514, unsigned int wParam=0, long lParam=1769489)  Line 388 + 0x10 bytes C++
      mfc80.dll!AfxWndProcBase(HWND__ * hWnd=0x00230edc, unsigned int nMsg=514, unsigned int wParam=0, long lParam=1769489)  Line 407 + 0x16 bytes C++
      user32.dll!77d48709()  
      user32.dll!77d487eb()  
      user32.dll!77d4ecd2()  
      user32.dll!77d70494()  
      user32.dll!77d489a5()  
      user32.dll!77d553a0()  
      user32.dll!77d70494()  
      user32.dll!77d489e8()  
      user32.dll!77d6e819()  
      user32.dll!77d65ce2()  
      mfc80.dll!CWnd::IsDialogMessageA(tagMSG * lpMsg=0x00154aa8)  Line 197 + 0xd bytes C++
      mfc80.dll!CWnd::PreTranslateInput(tagMSG * lpMsg=0x00154aa8)  Line 4267 + 0x6 bytes C++
      mfc80.dll!CControlBar::PreTranslateMessage(tagMSG * pMsg=)  Line 443 + 0xa bytes C++
      mfc80.dll!CWnd::WalkPreTranslateTree(HWND__ * hWndStop=0x001e0e3c, tagMSG * pMsg=0x00154aa8)  Line 2882 + 0xb bytes C++
      mfc80.dll!AfxInternalPreTranslateMessage(tagMSG * pMsg=0x00154aa8)  Line 233 + 0xe bytes C++
      mfc80.dll!CWinThread::PreTranslateMessage(tagMSG * pMsg=0x00154aa8)  Line 773 + 0x9 bytes C++
      mfc80.dll!AfxPreTranslateMessage(tagMSG * pMsg=0x00154aa8)  Line 255 C++
      mfc80.dll!AfxInternalPumpMessage()  Line 178 + 0xf bytes C++
      mfc80.dll!CWinThread::Run()  Line 625 + 0x7 bytes C++
      mfc80.dll!AfxWinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * hPrevInstance=0x00000000, char * lpCmdLine=0x00151f23, int nCmdShow=1)  Line 47 + 0x7 bytes C++
      Sample.exe!__tmainCRTStartup()  Line 578 + 0x1d bytes C
      kernel32.dll!7c816d4f()  
      kernel32.dll!7c8399f3()  
      libmmd.dll!0069006c()  
      libmmd.dll!00720070()  
      libmmd.dll!00720070()  
      libmmd.dll!00720070()  
      libmmd.dll!00720070()  
      libmmd.dll!0065005f()  
      libmmd.dll!0065005f()  




    Actually

    if(InputSheet.DoModal()== IDOK) is giving the problem,

     

    if I step into that, the exact code which is stopping my flow is from

    from dlgprop.cpp is making the  “Parameter is Incorrect” dialog box to be popped up  is

     

    HWND hWnd = (HWND)::AfxPropertySheet(&m_psh);

     

  • Tuesday, April 07, 2009 3:10 PM davewilkMVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I would think the problem must lie in your

    CInputSheet(CMainFrame* pMainFrame, LPCTSTR pszCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);

    constructor.
    David Wilkinson | Visual C++ MVP
  • Wednesday, April 08, 2009 5:31 AM Ramesh Kumar. S Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Thanks Davewilk. If the problem is on constructor, what could be done to resolve this issue?

    If a press F11 at this statement:

    if(InputSheet.DoModal()== IDOK)

    It opens up dlgprop.cpp and it reaches this line:

    HWND hWnd = (HWND)::AfxPropertySheet(&m_psh);

    If i further F11 at this line. It opens afxstate.cpp and  enters into this function code

    AFX_MODULE_STATE* AFXAPI AfxGetModuleState()

     

    if (pState->m_pModuleState != NULL)

     

    // thread state's module state serves as override

    pResult = pState->m_pModuleState;

    }

     

    else

    {

     

    // otherwise, use global app state

    pResult = _afxBaseModuleState.GetData();

    }

    ENSURE(pResult != NULL);

     

    return pResult;

     

    }

    Here, when i add watch to pstate, it says no symbols loaded.
    It nither enters if or else condition. Whether this could be the problem? Any help. Plz let me know.

    {

     

    {

    _AFX_THREAD_STATE* pState = _afxThreadState;

    ENSURE(pState);

    AFX_MODULE_STATE* pResult;

     

  • Wednesday, April 08, 2009 11:59 AM davewilkMVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Just think about it. Your code is like this:

    CInputSheet InputSheet(this ,_T("Input Screen" ));

    if (InputSheet.DoModal()== IDOK)

    {

    //

    }

     

    The DoModal() call is MFC code, so there must be something wrong in the CInputSheet constructor. Maybe the way you added the pages.


    David Wilkinson | Visual C++ MVP
  • Wednesday, April 08, 2009 12:57 PM Ramesh Kumar. S Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    This is the way pages are added:

    CPage1 m_pPage1(this);
    CPage2 m_pPage2(
    this);
    CPage3 m_pPage3(
    this);
    CPage4 m_pPage4(
    this);
    CPage5 m_pPage5(
    this);
    CPage6 m_pPage6(
    this);
    CPage7 m_pPage7(
    this);

     

     

    InputSheet.AddPage(&m_pPage1);
    InputSheet.AddPage(&m_pPage2);
    InputSheet.AddPage(&m_pPage4);
    InputSheet.AddPage(&m_pPage3);
    InputSheet.AddPage(&m_pPage6);
    InputSheet.AddPage(&m_pPage5);
    InputSheet.AddPage(&m_pPage7);


    Also when we try to dropdown a combobox in the dialog, same "parameter is incorrect" message box appears.

  • Wednesday, April 08, 2009 3:04 PM davewilkMVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    If this is the actual code in the constructor, it would seem that your pages are local variables that are going out of scope,
    David Wilkinson | Visual C++ MVP
  • Thursday, April 09, 2009 2:13 PM Ramesh Kumar. S Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Actually the declaration all are done in MainFrm.cpp itself

    CPage1 m_pPage1( this );
    CPage2 m_pPage2(
    this );
    CPage3 m_pPage3(
    this );
    CPage4 m_pPage4(
    this );
    CPage5 m_pPage5(
    this );
    CPage6 m_pPage6(
    this );
    CPage7 m_pPage7(
    this );

     

    InputSheet.AddPage(&m_pPage1);
    InputSheet.AddPage(&m_pPage2);
    InputSheet.AddPage(&m_pPage4);
    InputSheet.AddPage(&m_pPage3);
    InputSheet.AddPage(&m_pPage6);
    InputSheet.AddPage(&m_pPage5);
    InputSheet.AddPage(&m_pPage7);

    AfxMessageBox("near if condition" );

     

    if (InputSheet.DoModal()== IDOK)

     

    {

     

    AfxMessageBox("Entered if condition" );

     

    }

     

    The problem still continues. Plz do help

  • Thursday, April 09, 2009 2:37 PM davewilkMVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Ah, OK, you are adding the pages from outside the CInputSheet object. I usually make the pages members of the sheet, but I guess your way is OK.

    What I am saying is that it is most unlikely that there is anything wrong with the MFC code invoked by DoModal() so the error must be in your code before the DoModal() call. If I were you I would simplify this code as much as possible.
    David Wilkinson | Visual C++ MVP
  • Friday, April 10, 2009 5:21 AM Ramesh Kumar. S Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    No davewilk, as you see in the code given above, there were no code in between declaration and addpage and calling DoModal().

    Still, I couldn't understand what it conveys by saying "Parameter is incorrect" ?
  • Friday, April 10, 2009 11:56 AM davewilkMVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
      Answer
    I don't know what is the matter with your code, but if it were me and I was having trouble adding seven pages, I would try just adding one page (or even no pages).

    Did you follow these rules when creating your pages:

    • Set the Caption edit box on the General page to the text you wish to appear in the tab for this page.

    • Set the Style list box on the Styles page to Child .

    • Set the Border list box on the Styles page to Thin .

    • Ensure that the Titlebar check box on the Styles page is selected.

    • Ensure that the Disabled check box on the More Styles page is selected.

    ?
    David Wilkinson | Visual C++ MVP
    • Marked As Answer byWesley Yao Monday, April 13, 2009 2:31 AM
    •  
  • Friday, April 10, 2009 3:36 PM Ramesh Kumar. S Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi Davewilk,
                       First of all, I would like to thank you for showing interest on this issue. However, when i try to add one page, the objects i have created for the remaining pages are used throughout the Mainfrm.cpp. Hence, i couldn't try that.

    All the pages are adhering to the 5 property settings you had mentioned.

    But still, the problem continues...Plz do help.


    Also,

    CInputSheet    InputSheet(this,_T("JTI MultiLateral Input Screen"));
     int ret = InputSheet.DoModal();
        

    If i change the code like this, ret holds 0. After adding the pages, DoModal() is giving "Parameter is incorrect".
  • Friday, April 10, 2009 4:13 PM davewilkMVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    All I can say is the error must lie in some of your code before the DoModal() call.

    You never did show your CInputSheet constructor.
    David Wilkinson | Visual C++ MVP
  • Friday, April 10, 2009 4:22 PM Ramesh Kumar. S Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi Davewilk,
                      Here is my InputSheet.cpp Implementation file. Help us to resolve this issue.

    <!-- /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";} @page Section1 {size:595.3pt 841.9pt; margin:72.0pt 90.0pt 72.0pt 90.0pt; mso-header-margin:35.4pt; mso-footer-margin:35.4pt; mso-paper-source:0;} div.Section1 {page:Section1;} -->

    // InputSheet.cpp : implementation file

    //

     

    #include "stdafx.h"

    #include "Sample.h"

    #include "InputSheet.h"

     

    #include "TabCtrlEx.h"

     

    #ifdef _DEBUG

    #define new DEBUG_NEW

    #undef THIS_FILE

    static char THIS_FILE[] = __FILE__;

    #endif

     

    /

    // CInputSheet

     

    IMPLEMENT_DYNAMIC(CInputSheet, CPropertySheet)

    /**

      * This method is generated by MFC

      *

      */  

     

     

     

     

    CInputSheet::CInputSheet(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage)

          :CPropertySheet(nIDCaption, pParentWnd, iSelectPage)

    {

    }

    /**

      * This method is generated by MFC

      *

      */  

     

     

    CInputSheet::CInputSheet(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage)

          :CPropertySheet(pszCaption, pParentWnd, iSelectPage)

    {

    }

    /**

      * This method is generated by MFC

      *

      */  

    CInputSheet::CInputSheet(CMainFrame* pMainFrame, LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage)

          :CPropertySheet(pszCaption, pParentWnd, iSelectPage)

    {

     

          m_pMainFrame = pMainFrame;

     

     

     

    }

    //Function added on March 11 2008

     

     

    /**

      * This method is generated by MFC

      *

      */  

    CInputSheet::~CInputSheet()

    {

    }

     

    /**

      * This method is generated by MFC

      *

      */  

    BEGIN_MESSAGE_MAP(CInputSheet, CPropertySheet)

          //{{AFX_MSG_MAP(CInputSheet)

    //    ON_COMMAND(ID_CONTEXT_HELP, CMDIFrameWnd::OnHelpFinder)

          //}}AFX_MSG_MAP

     

          ON_COMMAND(ID_HELP, CMDIFrameWnd::OnHelpFinder)

    END_MESSAGE_MAP()

     

    /

    // CInputSheet message handlers

     

    /*BOOL CInputSheet::OnInitDialog()

    {

          BOOL bResult = CPropertySheet::OnInitDialog();

         

          // TODO: Add your specialized code here

         

          //GetDlgItem(ID_APPLY_NOW)->ShowWindow(SW_HIDE);

         

                SetActivePage(3);

         

          return bResult;

    }*/

    /*

    void CInputSheet::OnContextHelp()

    {

          // TODO: Add your command handler code here

         

    }

    */

     

    BOOL CInputSheet::OnInitDialog()

    {

          BOOL bResult = CPropertySheet::OnInitDialog();

          m_pMainFrame-> m_tab.Install(this );

     

          if ( m_pMainFrame ->openMultiInitialFlag == FALSE)

          {

                     

                      m_pMainFrame->openMultiInitialFlag =TRUE;

                      m_pMainFrame-> m_tab.EnableItem (0,TRUE);

                     

          }

     

          if (m_pMainFrame->userReadyFlag == FALSE)

          {

                m_pMainFrame-> m_tab.EnableItem (1,FALSE);

                m_pMainFrame-> m_tab.EnableItem (2,FALSE);

                m_pMainFrame-> m_tab.EnableItem (3,FALSE);

                m_pMainFrame-> m_tab.EnableItem (4,FALSE);

                m_pMainFrame-> m_tab.EnableItem (5,FALSE);

                m_pMainFrame-> m_tab.EnableItem (6,FALSE);

          }

     

     

          if (m_pMainFrame ->wellReadyFlag == FALSE)

          {

                m_pMainFrame-> m_tab.EnableItem (1,FALSE);

                m_pMainFrame-> m_tab.EnableItem (2,FALSE);

                m_pMainFrame-> m_tab.EnableItem (3,FALSE);

               

          }

     

          if (m_pMainFrame ->caseReadyFlag == FALSE)

          {

                m_pMainFrame-> m_tab.EnableItem (4,FALSE);

                m_pMainFrame-> m_tab.EnableItem (5,FALSE);

                m_pMainFrame-> m_tab.EnableItem (6,FALSE);

          }

     

     

         

     

          return bResult;

    }

     

     

    void CInputSheet:: MyTab()

    {

    //    m_tab.Install(this);

     

    /*    AfxMessageBox("Hai i am in Front");

          BOOL bResult = CPropertySheet::OnInitDialog();

     

          m_tab.EnableItem (1,FALSE);

          m_tab.EnableItem (2,FALSE);

          m_tab.EnableItem (3,FALSE);

          m_tab.EnableItem (4,FALSE);

          m_tab.EnableItem (5,FALSE);

          m_tab.EnableItem (6,FALSE);

     

          AfxMessageBox("Hai i am in Mid");

     

          if(m_pMainFrame->wellReadyFlag == TRUE)

          {

                m_tab.EnableItem (1,TRUE);

                m_tab.EnableItem (2,TRUE);

                m_tab.EnableItem (3,TRUE);

          }

          AfxMessageBox("Hai i am in END");

    */

    }

  • Friday, April 10, 2009 6:11 PM davewilkMVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Constructor looks OK, but I would just simplify, simplify,simplify. Comment out OnInitDialog(), reduce the number of pages....

    I did not understand what you said about the pages being used throughout MainFrm.cpp. In the code you showed before, the pages look like local variables (despite the m_ prefix).

    Also, surely the call stack you showed before is not the entire call stack at the time of the error.
    David Wilkinson | Visual C++ MVP
  • Saturday, April 11, 2009 8:15 AM Ramesh Kumar. S Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hello Davewilk, Thanks a lot to you. You directed me in a right direction, all other pages Except General Page is working fine. When i include General page it creates this parameter incorrect problem. Could you please help me in resolving this issue in general page? Plz do help. Once again thanks.

     

  • Saturday, April 11, 2009 9:58 AM davewilkMVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Help you with what? You haven't shown anything about this General Page?

    But if it were me I would:

    1. Make absolutely sure that this page is the problem by adding the pages in a different order.

    2. Of so, look carefully at the template and code of this page to see why it is different from the others.

    3. If you see nothing, then Simplify, Simplify, Simplify. Comment out OnInitDialog(), do whatever you have to to narrow down the problem.

    This is debugging 101.

    BTW, your recent posts are showing with some garbage style information at the top. Why is that?
    David Wilkinson | Visual C++ MVP
  • Saturday, April 11, 2009 10:14 AM Ramesh Kumar. S Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thanks DaveWilk,

    BTW, hope that's because i pressed ctrl-v after i copying a header page over here.

    Here is my GeneralPage.h

     

     

    // GeneralPage.h : header file

    //

    #include "MainFrm.h"

    class CGeneralPage : public CPropertyPage

    {

          DECLARE_DYNCREATE(CGeneralPage)

     

    public :

          CGeneralPage(CWnd* pParent = NULL);

          CGeneralPage(CMainFrame* pMainFrame, CWnd* pParent = NULL);

          ~CGeneralPage();

          CString GetUserId();

          CString GetWellId();

          void OnSelendokUserlist1();

          void EnableButtons();

          void RestoreDrainholeData();

     

     

         

     

          int    ActionFlag;

     

          int    UserList;

          int    WellList;

          int    CaseList;

          CString CaseId;

          BOOL deleteWell;

         

          BOOL GeneralUserCreateFlag;

    public :

          enum { IDD = IDD_GENERAL_PAGE };

          CStatic     m_pCaseStatus;

          CComboBox   m_ctlWellList;

          CComboBox   m_ctlUserList;

          CComboBox   m_ctlCaseList;

          CString     m_nUserId;

          CString     m_nWellId;

          CString     m_nCaseId;

          CString     m_Phd_PathName;

          CString WellId;

          CString CaseDesc;

          CString WellDescription;

          double Well_MD;

          double Well_TVD ;

          CString caseId;

          CString caseDescription;

          CString     m_userStatus;

          CString     m_wellStatus;

          CString     m_caseStatus;

          CMainFrame  *m_pMainFrame;

         

          protected :

          virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

          //}}AFX_VIRTUAL

     

    // Implementation

            // @access Protected Member Functions

    protected :

          // Generated message map functions

          //{{AFX_MSG(CGeneralPage)

          virtual BOOL OnInitDialog();

          afx_msg void OnCreateButton();

          afx_msg void OnEditButton();

          afx_msg void OnDeleteButton();

          afx_msg void OnSelendokUserlist();

          afx_msg void OnSetfocusUserlist();

          afx_msg void OnSelendokCaseList();

          afx_msg void OnSetfocusCaseList();

          afx_msg void OnSelendokWelllist();

          afx_msg void OnSetfocusWelllist();

          afx_msg void OnPressure();

          afx_msg void OnRate();

          afx_msg void OnUserCreate();

          afx_msg void OnReservoirCreate();

          afx_msg void OnCaseCreate();

          afx_msg void OnUserEdit();

          afx_msg void OnReservoirEdit();

          afx_msg void OnCaseEdit();

          afx_msg void OnUserDelete();

          afx_msg void OnReservoirDelete();

          afx_msg void OnCaseDelete();

          afx_msg void OnModeDisplay();

          afx_msg void OnSelchangeUserlist();

          afx_msg void OnSelchangeWelllist();

          afx_msg void OnSelchangeCaseList();

          afx_msg void OnPageStatus();

         

          //}}AFX_MSG

          DECLARE_MESSAGE_MAP()

     

    public :

          afx_msg void OnEnChangePhdPath();

    };

     I will edit .cpp file and post here soon, because the file has more than 6000 chars

    One thing, I surprised was the same code works fine in Visual Studio 6.0 without any problem. When it is converted to VC++8.0 using Visual Studio 2005. This problem arised.
  • Saturday, April 11, 2009 11:40 AM davewilkMVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    The goal here is not to cut down your code so you can dump it on the forum, but rather so you can find out what is causing the problem.

    If your code works on VC6, it is unlikely that someone will spot the problem by looking at the code.
    David Wilkinson | Visual C++ MVP
  • Saturday, April 11, 2009 2:26 PM Ramesh Kumar. S Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thanks Davewilk,
                             I am learning so much from you. Exactly, as u said, when DoModal() is invoked it then goes to Generalpage::OnInitDialog, There it reaches a function call called CGeneralPage::OnSelendokWelllist() and it goes through the code in that function. Once it reaches the following line:

    m_ctlWellList.GetLBText(m_ctlWellList.GetCurSel(),
        m_pMainFrame->m_caseSet.m_strWellIdParam);       

    //Where definitions of variables in Generalpage.h are
    CComboBox    m_ctlUserList;
    CMainFrame* m_pMainFrame;
    CCaseSet m_caseSet

    where CCaseSet is a class derived from RecordSet


    It jumps to LRESULT AFXAPI AfxCallWndProc(CWnd* pWnd, HWND hWnd, UINT nMsg,
        WPARAM wParam = 0, LPARAM lParam = 0) of
    Wincore.cpp

    and gets into catch block
    CATCH_ALL(e)
        {
            lResult = AfxProcessWndProcException(e, &pThreadState->m_lastSentMsg);
            TRACE(traceAppMsg, 0, "Warning: Uncaught exception in WindowProc (returning %ld)./n",
                lResult);
            DELETE_EXCEPTION(e);
        }
        END_CATCH_ALL

        pThreadState->m_lastSentMsg = oldState;
        return lResult;
    }

    lResult is 0 and then "Parameter is incorrect" dialog box appears. Any help?
  • Saturday, April 11, 2009 2:48 PM davewilkMVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
      Answer
    Maybe GetCurSel() is returning CB_ERR because there is no selection?

    Really, you should be checking these things for yourself. You have (finally) found the place in your code where the problem arises.
    David Wilkinson | Visual C++ MVP
  • Saturday, April 11, 2009 4:05 PM Ramesh Kumar. S Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Yeah DaveWilk,
                          I agree with you. These things I have to look. This is because i am beginner in VC++. I really appreciate your patience in guiding me to reach this stage. Thanks a lot DaveWilk.
         I will check the GetCurSel() and resolve this issue and i will share with you what happened.
  • Monday, April 13, 2009 8:42 AM Ramesh Kumar. S Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    THANKS DAVEWILK, THOUSANDS OF THANKS TO YOU. YOU MADE MY DAY!


    Exactly, GetCurSel() created this problem. And this is because, there is the wrong entry in MS-Access database, when we rectified that everything went fine. It works now as same as VC++6.0 code.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值