Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I just got into programming VBA in Excel and thought it would be nice
to be able to call some old C++ functions I have floating around. I take it I'll have to create a DLL go get the job done. My questions are how do I call the C++ functions through VBA and how do I pass inherited classes to my functions? A rough outline of what I want to do is: 1) Create an instance of a child class inside of VBA. 2) Set the properties of the instance of the child class by calling a function. The instance will be passed along with a child class type. 3) Pass the now initialized instance along with some other variables to a function and get the returned value. In C++ the code usually runs like this: Child_Class Child1; Child_Class_Type Child1Type = C1; Set_Child_Properties(Child1, Child1Type); Now that Child1 is all loaded up ready to go. Then I can call my functions like this: AAA = My_Function(Child1, A, B) AAA is the value I want to use in VBA. My prototypes are at the bottom of this note. Thanks much for any help anyone can give. enum Child_Class_Type { C1, C2, C3, C4 }; void Set_Child_Properties(Child_Class &C_Cls, Child_Type &CT_ID) double My_Function(Child_Class &C_Cls, const double A, const double B) class Parent_Class { public: void Set_A(short index, double aaa); void Set_B(short bbb); void Set_C(short index, double ccc); void Set_H(double hhh); const double Get_A(short index); const short Get_B(); const double Get_C(short index); const double Get_H(); protected: double a[6]; short b; double c[5]; double h; }; class Child_Class:public Parent_Class { public: Child_Class(); ~Child_Class(); void Set_L(short index, double lll); void Set_M(double mmm); void Set_N(double nnn); const double Get_L (short index); const double Get_Q(short index, double qqq); const double Get_R(short index, double rrr); const double Get_S(short index, double sss); const double Get_M(); const double Get_N(); private: double l[32]; short Is_l_Set[32]; double m; double n; }; |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Are Excel Shim Dll's have COM support | Excel Programming | |||
Unloading DLL's | Excel Programming | |||
Recommended reading DLL's VBA | Excel Programming | |||
dll's and performance | Excel Programming | |||
call dll's from Excel asynchronously ? | Excel Programming |