Solved

How define and update this string buffer

Posted on 2009-04-03
2
237 Views
Last Modified: 2013-12-14
Hi All,
I've created a string buffer in VB and then call a c++ MFC dll with an external function as follows. I pass the buffer through by reference. Then...
What I'm not sure about is how declare it as a parameter to the function and populate it with a value from a CString variable.

The code below doesn't work but hopefully gives you an idea of where I'm heading. It's kind of like a API. Also the return value must non-unicode.

Any suggestions will be greatly appreciated.
int __declspec(dllexport) __stdcall ReadXML(CString &MtBuffer, int length, BSTR xmlFilePath, BSTR xmlNode)

{

	AFX_MANAGE_STATE(AfxGetStaticModuleState());

 

	CString str_xmlFilePath = BSTR2CString(xmlFilePath);

	CString str_xmlNode = BSTR2CString(xmlNode);

	

	CString	m_xml_value;

	m_xml_value = _T("");

	std::string _label;

	

	ParamIO inXml;

	inXml.readFile(str_xmlFilePath);

	inXml.read(str_xmlNode, _label, std::string(""));

	m_xml_value = _label.c_str();

	

	MtBuffer = m_xml_value;

	return 0;

}

Open in new window

0
Comment
Question by:ill_comms
2 Comments
 
LVL 19

Accepted Solution

by:
alb66 earned 125 total points
Comment Utility
Give alook at
"How to pass arrays and strings between Visual Basic and C functions or between Visual Basic and C++ functions by using Visual Basic 6.0"
http://support.microsoft.com/?scid=kb%3Ben-us%3B205277&x=19&y=10
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now