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. About MFC

About MFC

Scheduled Pinned Locked Moved C / C++ / MFC
c++csharphelpquestion
6 Posts 4 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.
  • A Offline
    A Offline
    Aqueel
    wrote on last edited by
    #1

    Hi I added a class in my MFC dialog based project. Now i want to declare a pointer object of my dialog class in .cpp file of newly added class to access members of dialog class in that cpp file. I declared that pointer like this CFileSenderDlg *fsD = new CFileSenderDlg; But program crashes at the point where i use this pointer to access a member function of dialog class. What it the mistake i am doing? Can anyone please help me in this regard? Thank you. We Believe in Excellence www.aqueelmirza.cjb.net

    S K H 3 Replies Last reply
    0
    • A Aqueel

      Hi I added a class in my MFC dialog based project. Now i want to declare a pointer object of my dialog class in .cpp file of newly added class to access members of dialog class in that cpp file. I declared that pointer like this CFileSenderDlg *fsD = new CFileSenderDlg; But program crashes at the point where i use this pointer to access a member function of dialog class. What it the mistake i am doing? Can anyone please help me in this regard? Thank you. We Believe in Excellence www.aqueelmirza.cjb.net

      S Offline
      S Offline
      Sarath C
      wrote on last edited by
      #2

      The code seems very clean. 1. Check whether the pointer get allocated properly or not (NULL or Junk value). 2. Check for the missing resources, which hadn' is not removed on deleting the control. 3. Check the message handlers SaRath.
      "Don't Do Different things... Do Things Differently..." Understanding State Pattern in C++

      A 1 Reply Last reply
      0
      • S Sarath C

        The code seems very clean. 1. Check whether the pointer get allocated properly or not (NULL or Junk value). 2. Check for the missing resources, which hadn' is not removed on deleting the control. 3. Check the message handlers SaRath.
        "Don't Do Different things... Do Things Differently..." Understanding State Pattern in C++

        A Offline
        A Offline
        Aqueel
        wrote on last edited by
        #3

        Sorry i was wrong. In fact error occures when i try to declare the pointer. When i tried to debug it, It took me to afxwin1.inl and current pointer was on following lines. Can you please tell me what is the problem? _AFXWIN_INLINE HINSTANCE AFXAPI AfxGetResourceHandle() { ASSERT(afxCurrentResourceHandle != NULL); We Believe in Excellence www.aqueelmirza.cjb.net

        S 1 Reply Last reply
        0
        • A Aqueel

          Hi I added a class in my MFC dialog based project. Now i want to declare a pointer object of my dialog class in .cpp file of newly added class to access members of dialog class in that cpp file. I declared that pointer like this CFileSenderDlg *fsD = new CFileSenderDlg; But program crashes at the point where i use this pointer to access a member function of dialog class. What it the mistake i am doing? Can anyone please help me in this regard? Thank you. We Believe in Excellence www.aqueelmirza.cjb.net

          K Offline
          K Offline
          khan
          wrote on last edited by
          #4

          Aqueel wrote:

          CFileSenderDlg *fsD = new CFileSenderDlg;

          After this, you should create the dialog box also like: fsD->Create(IDD_WHATEVER,Parent); Also check that the actual dialog resource is really present by looking at the resource view, and then checking the ID for the dialog. this is this.

          1 Reply Last reply
          0
          • A Aqueel

            Hi I added a class in my MFC dialog based project. Now i want to declare a pointer object of my dialog class in .cpp file of newly added class to access members of dialog class in that cpp file. I declared that pointer like this CFileSenderDlg *fsD = new CFileSenderDlg; But program crashes at the point where i use this pointer to access a member function of dialog class. What it the mistake i am doing? Can anyone please help me in this regard? Thank you. We Believe in Excellence www.aqueelmirza.cjb.net

            H Offline
            H Offline
            Hamid Taebi
            wrote on last edited by
            #5

            See here CTest::CTest(CWnd* pParent /*=NULL*/) : CDialog(CTest::IDD, pParent) { Create(CTest::IDD,pParent); } -------------------- CTest *m_Test; m_Test=new CTest(this);_**


            **_

            whitesky


            1 Reply Last reply
            0
            • A Aqueel

              Sorry i was wrong. In fact error occures when i try to declare the pointer. When i tried to debug it, It took me to afxwin1.inl and current pointer was on following lines. Can you please tell me what is the problem? _AFXWIN_INLINE HINSTANCE AFXAPI AfxGetResourceHandle() { ASSERT(afxCurrentResourceHandle != NULL); We Believe in Excellence www.aqueelmirza.cjb.net

              S Offline
              S Offline
              Sarath C
              wrote on last edited by
              #6

              Sorry for the late reply. Walk ur call stack and find from where this call occurs. check for missing resources that may be the problem SaRath.
              "Don't Do Different things... Do Things Differently..." Understanding State Pattern in C++

              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