Bluebit Software
Bluebit Software Support Forum
 Home          Members     Calendar     Who's On

Welcome Guest ( Login | Register )
        



Use with Borland Builder C++ Expand / Collapse
Message
Posted Tuesday, March 02, 2004 1:13 AM Post #8
 

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie
I recently downloaded your evaluation version of the Matrix Active control and have been trying to put it through some tests. I am not a professional program, but a mechanical engineer, so bear with me...

The Matrix ActiveX control appears to be targeted to Visual Basic users, which I am one. I've used it with VB, and found it very easy to use. I am currently trying to use it in Borland's C++ Builder. Borland C++ Builder is capable of importing the ActiveX through the dll and puts a wrapper on it for use in the program as an ActiveX control. The Matrix and CMatrix controls are easy to use, but when it comes to performing math on the matrices, the compiler indicates that it is expecting reference to IMatrix not Matrix.

Do you know how I can perform the math functions using Borland's C++ Builder? I believe Borland's Delphi is similar except it uses Pascal instead of C++.
Posted Tuesday, March 02, 2004 10:19 AM Post #163
 

Bluebit SupportBluebit SupportBluebit SupportBluebit SupportBluebit SupportBluebit SupportBluebit SupportBluebit Support
I must confess I have no experience with Borland's C++ builder but I think I can imagine where your problem is.

Visual Basic makes no distinction between a Class and its interface, but this is not the case with C++ .

COM Classes become accessible through their interfaces. IMatrix is the COM interface for the Matrix Class. The variable that we will use to access the functions of a Matrix class has to be defined as an IMatrix pointer.

Please install the latest version of MaXC (version 3.1). In the samples directory (default location C:\Program Files\Matrix ActiveX Component 3.1\Samples)
you will find a demo project in visual C++. Just open the EigenDemo.Cpp. There you will see the variables that will be used to access matrices to be declared as IMatrix pointers, e.g.

IMatrix *A, *B, *C, *X;

HRESULT hr;
hr = ::CoCreateInstance(__uuidof(Matrix), NULL, CLSCTX_INPROC, __uuidof(IMatrix), (void**)&A);

When using the CoCreateInstance function to instantiate a Matrix object we specify the REFCLSID to be of Matrix type and REFIID to be of IMatrix type. Reference to the newly created object is hold to the IMatrix * A pointer.

I am not sure of how Borland's C++ builder handles this but I am sure that there must be a way to handle Matrix and IMatrix in the same way.

Try to use this C++ demo program as your quide.



Trifon Triantafillidis

Lead Developer

Bluebit Software

Posted Saturday, March 13, 2004 7:33 PM Post #164
 

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie
Did get the Matrix control to work very well with Borland C++ Builder 6. It was actually quite easy and is very easy to interface. For anyone that is interested (I know the user ratio is about 1000:1 compared to MSVC++) this is the general procedure...

Import the Type Library from the dll which will provide access to all methods, properties, etc. This will generate the reference files, BluebitMatrix30_TLB.h and BluebitMatrix30_TLB.cpp. Reference to these is generated in you application from the Import Type Library wizard under the Project Menu.

In your application, define the variables in the declaration section.
TCOMIMatrix A;
TCOMIMatrix B;
TCOMIMatrix C;
IMatrixPtr TempPtr;

Create the Matrix A,B,C
A = BluebitMatrix30_TLBH::CoMatrix::Create();
B = BluebitMatrix30_TLBH::CoMatrix::Create();
C = BluebitMatrix30_TLBH::CoMatrix::Create();

Once this is done, the rest is straight forward. For instance, to size and fill the A Matrix:
A->Size(4,4);
A->FillRandom(0,10,2);

Example to access the Matrix data
Memo1->Text = (A->GetString(2,BSTR('/n')));

To access Functions (this is the plus function):
IMatrix *Xcopy = B;
TempPtr = A->Plus(&Xcopy);
C = TempPtr->Clone();
Memo3->Text = (C->GetString(2,BSTR('/n')));

Hope this helps others...
Posted Saturday, March 13, 2004 7:46 PM Post #166
 

Bluebit SupportBluebit SupportBluebit SupportBluebit SupportBluebit SupportBluebit SupportBluebit SupportBluebit Support
Thank you so mutch for posting the above info!

Enjoy your programming with MaXC


Trifon Triantafillidis

Lead Developer

Bluebit Software

« Prev Topic | Next Topic »


Reading This Topic Expand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Trifon

Permissions Expand / Collapse

All times are GMT -5:00, Time now is 12:02pm

Powered by InstantForum.NET v4.1.4 © 2010
Execution: 0.266. 9 queries. Compression Disabled.
.NET Matrix Library