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. parameter of function

parameter of function

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestion
4 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.
  • D Offline
    D Offline
    durban2
    wrote on last edited by
    #1

    my function f_my() receive identifier of control, for example IDC_DATETIMEPICKER1 How do set type of argument? And how this function to call for execution? As show - unproperly: error C2660: 'GetDlgItem' : function does not take 1 arguments void CADO_MDIApp:: f_my (long identifier) { COleDateTime* p1 = (COleDateTime*) GetDlgItem(identifier); }

    D C C 3 Replies Last reply
    0
    • D durban2

      my function f_my() receive identifier of control, for example IDC_DATETIMEPICKER1 How do set type of argument? And how this function to call for execution? As show - unproperly: error C2660: 'GetDlgItem' : function does not take 1 arguments void CADO_MDIApp:: f_my (long identifier) { COleDateTime* p1 = (COleDateTime*) GetDlgItem(identifier); }

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      durban2 wrote:

      COleDateTime* p1 = (COleDateTime*) GetDlgItem(identifier);

      You are trying to call GetDlgItem() which resides in the global namespace (since CADO_MDIApp is not derived from CWnd). That version requires 2 arguments. Why are you wanting to do this? The application object should not need to know about controls on a dialog.

      "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

      "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

      1 Reply Last reply
      0
      • D durban2

        my function f_my() receive identifier of control, for example IDC_DATETIMEPICKER1 How do set type of argument? And how this function to call for execution? As show - unproperly: error C2660: 'GetDlgItem' : function does not take 1 arguments void CADO_MDIApp:: f_my (long identifier) { COleDateTime* p1 = (COleDateTime*) GetDlgItem(identifier); }

        C Offline
        C Offline
        CPallini
        wrote on last edited by
        #3

        durban2 wrote:

        my function f_my() receive identifier of control, for example IDC_DATETIMEPICKER1 How do set type of argument?

        Maybe an int.

        durban2 wrote:

        As show - unproperly: error C2660: 'GetDlgItem' : function does not take 1 arguments void CADO_MDIApp:: f_my (long identifier) { COleDateTime* p1 = (COleDateTime*) GetDlgItem(identifier); }

        GetDlgItem function takes actually 2 parameters [^]. Possibly you want to call CWnd::GetDlgItem method. :)

        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
        [My articles]

        1 Reply Last reply
        0
        • D durban2

          my function f_my() receive identifier of control, for example IDC_DATETIMEPICKER1 How do set type of argument? And how this function to call for execution? As show - unproperly: error C2660: 'GetDlgItem' : function does not take 1 arguments void CADO_MDIApp:: f_my (long identifier) { COleDateTime* p1 = (COleDateTime*) GetDlgItem(identifier); }

          C Offline
          C Offline
          Cedric Moonen
          wrote on last edited by
          #4

          In addition to what the other said and to remind you what I told some hours ago, GetDlgItem returns a pointer to a CWnd derived object. COleDateTime doesn't inherit from CWnd, so it is a completely different object. So, you can't cast your control to a COleDateTime object and expect everything to work. And as I said David, why are you delegating that stuff to your application class ? Your dialog class should be responsible to manipulate its control, the application class has nothing to do with that.

          Cédric Moonen Software developer
          Charting control [v2.0] OpenGL game tutorial 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