473,396 Members | 1,784 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,396 software developers and data experts.

Help to convert C++ 6.0 code to C#

LPO
Hi,

What the solution to convert this code, please ?
Thank's a lot for response

LPO

SAFEARRAYBOUND sabIn[1];
SAFEARRAY *psaInParms= NULL;
sabIn[0].cElements= 4;
sabIn[0].lLbound= 0;
psaInParms= ::SafeArrayCreate(VT_VARIANT, 1, sabIn);

SAFEARRAYBOUND sabOut[1];
SAFEARRAY *psaOutParms= NULL;
sabOut[0].cElements= 4;
sabOut[0].lLbound= 0;
psaOutParms= ::SafeArrayCreate(VT_VARIANT, 1, sabOut);

VARIANT vInParms;
::VariantInit(&vInParms);
VARIANT vOutParms;
::VariantInit(&vOutParms);

V_VT(&vInParms)= VT_ARRAY | VT_BYREF | VT_VARIANT;
V_VT(&vOutParms)= VT_ARRAY | VT_BYREF | VT_VARIANT;

V_ARRAYREF(&vInParms)= &psaInParms;
V_ARRAYREF(&vOutParms)= &psaOutParms;

::PutBSTRElement(psaInParms, 0, CComBSTR(L"")); // D: Returning Status
::PutBSTRElement(psaInParms, 1, ConvertStringToBSTR(szXmlInput)); // I:
Nov 16 '05 #1
1 2470
C# and C++ are completly different languages, so there is no way to just convert the code
All this code does is pass a SAFEARRAY to a function.
I'm not sure how a SAFEARRAY is defined in C#, but I think its just a object[0]
The VARIANT's declared aren't being used, but C#'s object type should understand a COM Variant
Mar

Nov 16 '05 #2

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

Similar topics

3
by: Jim Armstrong | last post by:
Hello all, I have a database with trade information. I have written a stored procedure (code at end of post) which pulls trades from a range of dates. There is a field called "Match ID" which is...
7
by: Timothy Shih | last post by:
Hi, I am trying to figure out how to use unmanaged code using P/Invoke. I wrote a simple function which takes in 2 buffers (one a byte buffer, one a char buffer) and copies the contents of the byte...
0
by: john | last post by:
Hi,All MS Tech Gurus: I need your help!!! It is the second time I post this message, I need get some feedback ASAP, Please Help!! Thanks a lot in advance. John I have a csharp method, using...
3
by: vanidosa27 | last post by:
I need to write a code that calculates the change due after the user has input the amount owed and amount paid. This is easy enough! :rolleyes: My problem comes in when the program wants you to...
0
by: BigAl.NZ | last post by:
Hi Guys, I am trying to write/copy some code that uses events with a GPS. Everytime the GPS position updates the event fires. The GPS code is from a SDK Library that I got called GPS Tools...
3
by: ravi | last post by:
Hi, I am new to C++ .Can anyone please tell me what does ":" operator mean in C++.For ex: there is a program snippet which looks like that class convert { protected: double val1; // initial...
1
by: talhak | last post by:
hello...im trying to make a simple calculator on c# i have written this code as seen under but i cant figure out how to initialize the values from the buttons the add function is working fine but it...
0
by: Pucca | last post by:
Hi I'm using vs2005. I am getting a bunch of compiler warnings after I made some changes to my code that was compiling clean. I'm also getting memory errors when I run my program and it's...
8
by: Dhananjay | last post by:
hello everyone Do you have any information how to generate a tool using .net which is used to translate the web page contents to html format. Plz reply me asap Thanks in advance Dhananjay
6
by: nickels | last post by:
Ok i already made a program that uses char and when someone enters a letter it will give them a conversion i made for that letter. That looks like this. import java.util.Scanner; public class...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.