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. Accessing Protected Functions

Accessing Protected Functions

Scheduled Pinned Locked Moved C / C++ / MFC
csharphelpquestion
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.
  • B Offline
    B Offline
    Bob Broadway
    wrote on last edited by
    #1

    The following code is from an artical on "Catching the 'Enter' Key in windows and controls" by Randy More. UINT SMUPPGrid::OnGetDlgCode() { UINT result = CListCtrl::OnGetDlgCode(); result = result | DLGC_WANTALLKEYS; return result; } The function, OnGetDlgCode(), generates a compiler error indicating that this is a protected function and is not accessible. What would it take to make this function accessible? Bob Broadway bob.broadway@att.net

    G M 2 Replies Last reply
    0
    • B Bob Broadway

      The following code is from an artical on "Catching the 'Enter' Key in windows and controls" by Randy More. UINT SMUPPGrid::OnGetDlgCode() { UINT result = CListCtrl::OnGetDlgCode(); result = result | DLGC_WANTALLKEYS; return result; } The function, OnGetDlgCode(), generates a compiler error indicating that this is a protected function and is not accessible. What would it take to make this function accessible? Bob Broadway bob.broadway@att.net

      G Offline
      G Offline
      G Steudtel
      wrote on last edited by
      #2

      well, look for the header file and move the method to the public part. Probably you have to go up the whole 'pedigree'. Derive a class from that class you want the function and in that class you have access to the protected function. First method is to handle with care, second method sometimes is just kind of overkill. Regards G.Steudtel

      1 Reply Last reply
      0
      • B Bob Broadway

        The following code is from an artical on "Catching the 'Enter' Key in windows and controls" by Randy More. UINT SMUPPGrid::OnGetDlgCode() { UINT result = CListCtrl::OnGetDlgCode(); result = result | DLGC_WANTALLKEYS; return result; } The function, OnGetDlgCode(), generates a compiler error indicating that this is a protected function and is not accessible. What would it take to make this function accessible? Bob Broadway bob.broadway@att.net

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

        Does SMUPPGrid class inherit from CListCtrl? The code you've shown seems correct, providing SMUPPGrid inherits CListCtrl. Michael 'Logic, my dear Zoe, merely enables one to be wrong with authority.' - The Doctor: The Wheel in Space

        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