Solved

Marshal.PtrToStructure(pointer, Point) returns error.

Posted on 2008-10-28
2
3,087 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
[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 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

623 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