Solved

Marshal.PtrToStructure(pointer, Point) returns error.

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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

738 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