473,320 Members | 1,920 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Calling MFC Lib from C# using Wrapper classes

I have an MFC static lib which exports som classes, it still needs to be
available to MFC apps and now C# apps as well. For C# I am creating a wrapper
dll that will link in the library. My question is for the function
ProcessStructs which takes a CTypedPtrArray pointer as a parameter. Are my
steps below correct or is there an easy way to do this?

Redefine my struct to .Net compatible version in my wrapper class
Would I have to make my wrapper function take a .Net array ref and then
convert it over to a CTypedPtrArray?
Call my MFC function ProcessStructs
Copy the structs back to my .Net array before returning from my wrapper
function?

Original MFC class sample

class CMFCTest
{
public:
struct TestStruct
{
CString str1;
CString str2;
int nCnt;
}
void ProcessStructs(CTypedPtrArray<CPtrArray, TestStruct*>* pStructs);
}
Thanks
Kurt



May 10 '06 #1
0 1149

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Hal Vaughan | last post by:
I have a Java program, composed of a number of classes, that I've been running as a command line program. It logs everything it does and, as it logs each event, it also prints that line of info to...
9
by: MacDermott | last post by:
I have an Access MDB which instantiates a class in a custom DLL, manipulates it for a while, then sets it equal nothing. The MDB does other things,too, and generally behaves itself as desired....
14
by: ericellsworth | last post by:
Hi, I'm trying to use a class to pass variables back and forth from a form opened in dialog mode. I have created a class which invokes a form in its show method, like so: Public Sub Show() '...
5
by: Tim Nelson | last post by:
Hi, I've got a legacy application written in C. I'd like to evolve the product (as opposed to completely rewriting it) by adding new features using C#. Is this possible? I know I should be able...
2
by: Ohad | last post by:
Hi, Can I use c++ source files in my c# project, and in c# call the c++ classes? If so, how can I do it? please cc to my mailbox: ohad@usbphone.com Thanks a lot Ohad
4
by: Tim Menninger | last post by:
Just started working on this and have not found any real good resources out there. We have a lot of native C++ Dll code that we use for our app. We want to share the code so that C# ASP.net code...
9
by: Terry | last post by:
I am trying to test out the ability of VB6 (VBA access) to instanciate a VB.net Object and call its methods. I came accross the following article in my vs2005 help search:...
9
by: Amit Dedhia | last post by:
Hi All I have a VC++ 2005 MFC application with all classes defined as unmanaged classes. I want to write my application data in xml format. Since ADO.NET has buit in functions available for...
4
by: a_agaga | last post by:
Hi! Do you know different alternatives to convert exceptions in many methods of some wrapper classes. User -Wrapper classes -LibraryClasses -... Wrapper classes catch an exception of only...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.