Solved

Marshal.PtrToStructure(pointer, Point) returns error.

Posted on 2008-10-28
2
3,047 Views
Last Modified: 2013-12-17
Hi,

When i use the Marshal.PtrToStructure i get the following error
The structure must not be a value class.Parameter name: structure.

I pass the function a IntPtr and and a reference to a structure Point.

As far as i can see this is done like Micrsoft says it's supposed to be done.
0
Comment
Question by:Kapalua
2 Comments
 
LVL 8

Accepted Solution

by:
mac-will earned 250 total points
ID: 22823290
Hmm... try adding [StructLayout(LayoutKind.Sequential)] above your struct.

Checkout: http://msdn.microsoft.com/en-us/library/0t2cwe11(vs.71).aspx
0
 

Author Closing Comment

by:Kapalua
ID: 31510702
Thanks!
0

Featured Post

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

856 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