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

can't call COM method containing string

I have a C++ method and I want to call a C# method from it. passing in a
string. Works fine with int's, but if I have a string arg the method call is
skipped.
#import "../util/Release/AcornActuateUtil.tlb" raw_interfaces_only
using namespace AcornActuateUtil;
extern "C" UINT __stdcall InstallActuate (MSIHANDLE hInstall)
{
// Initialize COM.
HRESULT hr = CoInitialize(NULL);
// Get temporary folder name
long status = 0;
BSTR tempDirName;
status = getTempDir(hInstall, tempDirName);
if (status != ERROR_SUCCESS) return status;
// Create the interface pointer.
IConfigureActuateXmlPtr pIConfig(__uuidof(ConfigureActuateXml));
long lResult;
pIConfig->EditActuateConfigFile(tempDirName, &lResult);
The C#:

public interface IConfigureActuateXml
{
int EditActuateConfigFile(string s);
};
// Interface implementation.
public class ConfigureActuateXml:IConfigureActuateXml
{
private static readonly ILog log =
LogManager.GetLogger("ConfigureActuateXml");
public int EditActuateConfigFile(string s)
{

owen
Nov 17 '05 #1
1 1230

I'd use byte[] rather than string, then in the c# method perform a cast to
string, since C++ has no concept of string's as a basic type, but rather
char arrays.

Thanks.

Dan.

"Owen Corpening" <oc********@acornsys.com> wrote in message
news:ux**************@TK2MSFTNGP14.phx.gbl...
I have a C++ method and I want to call a C# method from it. passing in a
string. Works fine with int's, but if I have a string arg the method call
is
skipped.
#import "../util/Release/AcornActuateUtil.tlb" raw_interfaces_only
using namespace AcornActuateUtil;
extern "C" UINT __stdcall InstallActuate (MSIHANDLE hInstall)
{
// Initialize COM.
HRESULT hr = CoInitialize(NULL);
// Get temporary folder name
long status = 0;
BSTR tempDirName;
status = getTempDir(hInstall, tempDirName);
if (status != ERROR_SUCCESS) return status;
// Create the interface pointer.
IConfigureActuateXmlPtr pIConfig(__uuidof(ConfigureActuateXml));
long lResult;
pIConfig->EditActuateConfigFile(tempDirName, &lResult);
The C#:

public interface IConfigureActuateXml
{
int EditActuateConfigFile(string s);
};
// Interface implementation.
public class ConfigureActuateXml:IConfigureActuateXml
{
private static readonly ILog log =
LogManager.GetLogger("ConfigureActuateXml");
public int EditActuateConfigFile(string s)
{

owen

Nov 17 '05 #2

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

Similar topics

47
by: Mountain Bikn' Guy | last post by:
Take some standard code such as shown below. It simply loops to add up a series of terms and it produces the correct result. // sum numbers with a loop public int DoSumLooping(int iterations) {...
13
by: sonald | last post by:
Hi, Can anybody tell me how to change the text delimiter in FastCSV Parser ? By default the text delimiter is double quotes(") I want to change it to anything else... say a pipe (|).. can anyone...
4
by: etuncer | last post by:
Hello All, I have Access 2003, and am trying to build a database for my small company. I want to be able to create a word document based on the data entered through a form. the real question is...
6
by: Christopher | last post by:
Its been awhile and I am rusty. Can the constructor of my class call another method in the same class if that other method does not change any member data? I want to simply have a seperate...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...

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.