Solved

How define and update this string buffer

Posted on 2009-04-03
2
248 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
ID: 24057765
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
C++ question 3 74
How can I build my own IDE using ASP.NET MVC? 2 62
Error creating a new C++ project in ,net 20 51
Android development question 2 75
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

680 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