Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel, VBA, & C++ DLL's

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Are Excel Shim Dll's have COM support abhimanyu Excel Programming 1 December 15th 06 10:32 AM
Unloading DLL's Bosco Excel Programming 1 September 29th 06 03:12 PM
Recommended reading DLL's VBA BowMag Excel Programming 3 November 9th 04 08:48 AM
dll's and performance Ludwig Excel Programming 3 April 14th 04 06:27 AM
call dll's from Excel asynchronously ? Emile Besseling Excel Programming 1 August 1st 03 05:38 PM


All times are GMT +1. The time now is 10:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"