Solved

How define and update this string buffer

Posted on 2009-04-03
2
250 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

728 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