TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
jon_thomp
NA
1
0
how can I delete memory allocated by a legacy C++ DLL
Feb 25 2004 7:35 PM
Hi, I am having a problem deleting memory allocated from a legacy C++ DLL. The DLL uses PostMessage to send data to a parent App, and expects the parent app to delete the memory when it has finished with it. I have created a new C++ DLL to interface the calls from my new .NET application as one of the functions in the legacy DLL required a CWnd* parameter. I am trapping the message posted by the legacy DLL by overriding the WndProc of my .NET form, and I am collecting the data from the memory pointer in the posted message with Marshal.PtrToStructure(m.LParam, new myStruct().GetType()). I then tried calling a function in my new C++ DLL, passing m.LParam as the pointer to the memory I need to delete, but I get an error - _CrtIsValidHeapPointer(pUserData) thrown up from the Visual C++ debugger. I have also tried calling Marshal.FreeHGlobal(m.LParam) from my .NET form, but this doesn't work either. Can anyone please help me?
Reply
Answers (
0
)
vb.net button controls and timer control with examples
Random Access Files and Variables