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. Public Variable access : New problem

Public Variable access : New problem

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++
5 Posts 5 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.
  • K Offline
    K Offline
    Krugger404
    wrote on last edited by
    #1

    Dear Mr Bhavani; Thank you for the help that you have given me in accessing a public variable from anywhere within my application. The problem is that the code did not work at all. The compiler strongly complained when i added these code: ((CDatastructorView *) AfxGetMainWnd())->m_main.Navigate"file://c:/datastructor/lectures/recursion_implementation.htm",0,0,0,0); CDatastructorView is my view class and m_main is a web-control which i want to use. The compiler responded as : :\datastructor\lefttooldlg.cpp(1296) : error C2065: 'CDatastructorView' : undeclared identifier C:\datastructor\lefttooldlg.cpp(1296) : error C2059: syntax error : ')' C:\datastructor\lefttooldlg.cpp(1296) : error C2059: syntax error : ')' Ps. I have tried whatever Mr Davy and Mr Chen told me but when i include the "datastructorView.h" file within lefttooldlg, i have a few errors telling me that some "doc" stuff are not recognised.... Could you please help me out because i am still pretty at lost. Krugger Krugger

    J M N L 4 Replies Last reply
    0
    • K Krugger404

      Dear Mr Bhavani; Thank you for the help that you have given me in accessing a public variable from anywhere within my application. The problem is that the code did not work at all. The compiler strongly complained when i added these code: ((CDatastructorView *) AfxGetMainWnd())->m_main.Navigate"file://c:/datastructor/lectures/recursion_implementation.htm",0,0,0,0); CDatastructorView is my view class and m_main is a web-control which i want to use. The compiler responded as : :\datastructor\lefttooldlg.cpp(1296) : error C2065: 'CDatastructorView' : undeclared identifier C:\datastructor\lefttooldlg.cpp(1296) : error C2059: syntax error : ')' C:\datastructor\lefttooldlg.cpp(1296) : error C2059: syntax error : ')' Ps. I have tried whatever Mr Davy and Mr Chen told me but when i include the "datastructorView.h" file within lefttooldlg, i have a few errors telling me that some "doc" stuff are not recognised.... Could you please help me out because i am still pretty at lost. Krugger Krugger

      J Offline
      J Offline
      jmkhael
      wrote on last edited by
      #2

      Redo what Mr Davy and Mr Chen and report the errors here Papa while (TRUE) Papa.WillLove ( Bebe ) ;

      1 Reply Last reply
      0
      • K Krugger404

        Dear Mr Bhavani; Thank you for the help that you have given me in accessing a public variable from anywhere within my application. The problem is that the code did not work at all. The compiler strongly complained when i added these code: ((CDatastructorView *) AfxGetMainWnd())->m_main.Navigate"file://c:/datastructor/lectures/recursion_implementation.htm",0,0,0,0); CDatastructorView is my view class and m_main is a web-control which i want to use. The compiler responded as : :\datastructor\lefttooldlg.cpp(1296) : error C2065: 'CDatastructorView' : undeclared identifier C:\datastructor\lefttooldlg.cpp(1296) : error C2059: syntax error : ')' C:\datastructor\lefttooldlg.cpp(1296) : error C2059: syntax error : ')' Ps. I have tried whatever Mr Davy and Mr Chen told me but when i include the "datastructorView.h" file within lefttooldlg, i have a few errors telling me that some "doc" stuff are not recognised.... Could you please help me out because i am still pretty at lost. Krugger Krugger

        M Offline
        M Offline
        Michael P Butler
        wrote on last edited by
        #3

        datastruct wrote: Ps. I have tried whatever Mr Davy and Mr Chen told me but when i include the "datastructorView.h" file within lefttooldlg, i have a few errors telling me that some "doc" stuff are not recognised.... Due to the way the MFC AppWizard builds files, you will also have to include datastructorDoc.h before you include datastructorView.h datastruct wrote: ((CDatastructorView *) AfxGetMainWnd())->m_main.Navigate"file://c:/datastructor/lectures/recursion_implementation.htm",0,0,0,0); This looks wrong to me. AfxGetMainWnd returns a pointer to the m_pMainWnd which in a DocView architecture is usually the CMainFrame class. I suspect your code needs to be more like this

        CMainFrame* pFrame = (CMainFrame*) AfxGetMainWnd();
        if(pFrame != NULL)
        {
        CDatastructorView* pView = (CDatastructorView*) pFrame->GetActiveView();
        if(pView != NULL)
        {
        pView->m_main.Navigate"file://c:/datastructor/lectures/recursion_implementation.htm",0,0,0,0);
        }

        }

        Michael CP Blog [^]

        1 Reply Last reply
        0
        • K Krugger404

          Dear Mr Bhavani; Thank you for the help that you have given me in accessing a public variable from anywhere within my application. The problem is that the code did not work at all. The compiler strongly complained when i added these code: ((CDatastructorView *) AfxGetMainWnd())->m_main.Navigate"file://c:/datastructor/lectures/recursion_implementation.htm",0,0,0,0); CDatastructorView is my view class and m_main is a web-control which i want to use. The compiler responded as : :\datastructor\lefttooldlg.cpp(1296) : error C2065: 'CDatastructorView' : undeclared identifier C:\datastructor\lefttooldlg.cpp(1296) : error C2059: syntax error : ')' C:\datastructor\lefttooldlg.cpp(1296) : error C2059: syntax error : ')' Ps. I have tried whatever Mr Davy and Mr Chen told me but when i include the "datastructorView.h" file within lefttooldlg, i have a few errors telling me that some "doc" stuff are not recognised.... Could you please help me out because i am still pretty at lost. Krugger Krugger

          N Offline
          N Offline
          nguyenvhn
          wrote on last edited by
          #4

          The compiler responsed that erros because you did not include header file of CDatastructorView class in lefttooldlg.cpp. In spite of you have done as few guides but errors stilled occurring. It can be that you did not included header correctly. I guess that you have included header file in dialog implementation file, so compiler complained about GetDocument member function which declared in such header file. In this case, you should include document header file (I guess it may be DatastructorDoc.h) before view header file. #include "DocHeader.h" #include "ViewHeader.h" There are few others way can help you resolve that problem. If you need to include view header file in dialog header file: In header file of dialog, at before dialog declaration, declare: class CDatastructorView; In dialog implementation file (cpp), include CDatastructorView header file at before DatastructorView.h such below: #include "DatastructorView.h" #include "dialog.h" //Replace by your file name Good luck

          1 Reply Last reply
          0
          • K Krugger404

            Dear Mr Bhavani; Thank you for the help that you have given me in accessing a public variable from anywhere within my application. The problem is that the code did not work at all. The compiler strongly complained when i added these code: ((CDatastructorView *) AfxGetMainWnd())->m_main.Navigate"file://c:/datastructor/lectures/recursion_implementation.htm",0,0,0,0); CDatastructorView is my view class and m_main is a web-control which i want to use. The compiler responded as : :\datastructor\lefttooldlg.cpp(1296) : error C2065: 'CDatastructorView' : undeclared identifier C:\datastructor\lefttooldlg.cpp(1296) : error C2059: syntax error : ')' C:\datastructor\lefttooldlg.cpp(1296) : error C2059: syntax error : ')' Ps. I have tried whatever Mr Davy and Mr Chen told me but when i include the "datastructorView.h" file within lefttooldlg, i have a few errors telling me that some "doc" stuff are not recognised.... Could you please help me out because i am still pretty at lost. Krugger Krugger

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            Errrr, stupid question: ((CDatastructorView *) AfxGetMainWnd())->m_main.Navigate**_(_**"file://c:/datastructor/lectures/recursion_implementation.htm",0,0,0,0); Isn't there missing this bracket right after "Navigate"? regards

            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