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. Default argument for DISP_FUNCTION_ID

Default argument for DISP_FUNCTION_ID

Scheduled Pinned Locked Moved C / C++ / MFC
c++javacomtoolstutorial
2 Posts 2 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.
  • U Offline
    U Offline
    User 12116080
    wrote on last edited by
    #1

    I have a existing function to communicate between Java and c++Activex I am using DISP_FUNCTION_ID. I need to add a default argument to the function so that I can call it from Java script. Is is possible to do so ? Not sure how to add a default argument in the function which is accessed by using DISP_FUNCTION_ID. Need some assitance. Thanks in advance.

    B 1 Reply Last reply
    0
    • U User 12116080

      I have a existing function to communicate between Java and c++Activex I am using DISP_FUNCTION_ID. I need to add a default argument to the function so that I can call it from Java script. Is is possible to do so ? Not sure how to add a default argument in the function which is accessed by using DISP_FUNCTION_ID. Need some assitance. Thanks in advance.

      B Offline
      B Offline
      Bram van Kampen
      wrote on last edited by
      #2

      Well, I Know very little about Java, and this is an MFC/CPP Forum. In CPP a default argument is declared in the function declaration in a class, as in

      class CMyClass{ int MyFunct(int Arg=0);};

      This is a Declaration that MyClass has a Method named'MyFunct', which returns an int, and Optionally takes a Parameter (Arg), and, that when I call this function without a parameter, that 0 will be assumed. You make those declarations in a 'Header File' You Implement the function in the Implementation File,(Typically a CPP File) were you actually Implement the function:

      int MyClass::MyFunct(int Arg)
      if(Arg==0)return 1;
      else return 2;
      }

      The above means that when using the class, you write:

      MyClass myclass;// Instantiate the class.
      myclass.MyFunct();//Will return 1, an Argument 0 is assumed
      myclass.MyFunct(0);// will return 1, the Argument 0 is specified
      myclass.MyFunct(12);//returns 2, as per Calculation, Arg !-0

      Your Marshalling Software beteween Java and CPP should give more details. :)

      Bram van Kampen

      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