Click here to Skip to main content
       

Managed C++/CLI

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page  Show 
AdminThe C++ / CLI is for managed and mixed-mode C++ programming onlyadminChris Maunder9 Jan '06 - 9:36 
This message board is for managed and mixed-mode C++ programming only: Managed C++ in VC++.NET or C++/CLI. Please post all standard C++ programming questions in the Visual C++ board[^].
 
cheers,
Chris Maunder
CodeProject.com : C++ MVP

Questionetting Access Violation Exception -Attempted to read or write protected memory - when trying to convert unmanaged array of structures into managed class in Vb.Net (VS2010,4.0 framework) in Windows 7 -64 bit mode.groupVijaySandur25 Apr '13 - 3:44 
Getting Access Violation Exception when trying to convert unmanaged array of structures into managed in Vb.Net(VS2010,4.0 framework) in Windows 7 -64 bit mode.
Sample Source Code
 
_
Public Class vb_menu_dotnet
Public level As Short
Public menu_id As String
Public short_desc As String
Public parent_id As String
Public access As Short
Public flag As Short
Public menu_desc As String
End Class
 

Dim current As IntPtr
Dim outArray As IntPtr
Dim manArray(100) As vb_menu_dotnet
 
vb_dotnet_get_menu_hierarchy(p_menu_handle, p_apl_id, outArray) //C API call
current = outArray
 
Dim j As Integer
For j = 1 To 100
manArray(j) = New vb_menu_dotnet()
Marshal.PtrToStructure(current, manArray(j)) //Access Violation Exception
Vijay

AnswerRe: etting Access Violation Exception -Attempted to read or write protected memory - when trying to convert unmanaged array of structures into managed class in Vb.Net (VS2010,4.0 framework) in Windows 7 -64 bit mode.memberJohn Schroedl25 Apr '13 - 7:52 
You may need to try a VB.NET forum. This is for C++/CLI code.
AnswerRe: etting Access Violation Exception -Attempted to read or write protected memory - when trying to convert unmanaged array of structures into managed class in Vb.Net (VS2010,4.0 framework) in Windows 7 -64 bit mode.mvpRichard MacCutchan25 Apr '13 - 22:29 
Dim current As IntPtr
Dim outArray As IntPtr
Dim manArray(100) As vb_menu_dotnet
 
vb_dotnet_get_menu_hierarchy(p_menu_handle, p_apl_id, outArray) //C API call
You have not initialised any of the pointers that you are sending to the C-language library. Take a look at this P/Invoke tutorial[^] for more information.
Use the best guess

GeneralRe: etting Access Violation Exception -Attempted to read or write protected memory - when trying to convert unmanaged array of structures into managed class in Vb.Net (VS2010,4.0 framework) in Windows 7 -64 bit mode.memberTripurari Chaudhary13 May '13 - 23:43 
Hi ,
whatever database u r acessing or data retrieval policy u might be using for e.g INI file,must be in Read Mode,Try to make it Write protected
QuestionRe: etting Access Violation Exception -Attempted to read or write protected memory - when trying to convert unmanaged array of structures into managed class in Vb.Net (VS2010,4.0 framework) in Windows 7 -64 bit mode.mvpRichard MacCutchan13 May '13 - 23:50 
Did you actually read the OP's question?
Use the best guess

AnswerRe: etting Access Violation Exception -Attempted to read or write protected memory - when trying to convert unmanaged array of structures into managed class in Vb.Net (VS2010,4.0 framework) in Windows 7 -64 bit mode.memberTripurari Chaudhary13 May '13 - 23:44 
Hi ,
whatever database  u r acessing or data retrieval policy u might be using for e.g INI file,must be in Read Mode,Try to make it Write protected

QuestionAd Hoc routing protocolmember3bood.ghzawi18 Apr '13 - 2:43 
can anyone help me finding the source code or the simulation of the Dual Busy Tone Multiple Access (DBTMA) protocol ????
 
regards...
Sniff | :^) Unsure | :~ WTF | :WTF:
AnswerRe: Ad Hoc routing protocolmvpRichard MacCutchan18 Apr '13 - 4:27 
A simple Google search[^].
Use the best guess

GeneralRe: Ad Hoc routing protocolmember3bood.ghzawi18 Apr '13 - 5:09 
Thanks alot, but i need a simulation for any BTMA, DBTMA or DUCHA .
i've a similar project based on multi-channel and busy tones.
regards

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   


Advertise | Privacy | Mobile
Web02 | 2.6.130523.1 | Last Updated 14 May 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid