Marshal Class
来源:互联网 发布:逻辑思维 知乎 编辑:程序博客网 时间:2024/04/30 05:44
Marshal Class
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemRuntimeInteropServicesMarshalClassTopic.asp
Marshal.AllocHGlobal Method
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemRuntimeInteropServicesMarshalClassAllocHGlobalTopic.asp
Marshal.FreeHGlobal Method
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemRuntimeInteropServicesMarshalClassFreeHGlobalTopic.asp
How to call the EnumJobs function from a Visual Basic.NET application
http://support.microsoft.com/default.aspx?scid=kb;en-us;821769
Example :
Public Function DatatoDeserial(ByVal datas() As Byte, ByVal type_to_change As Type, _
ByVal NumJub As Long) As Object
'Returns the size of the JOB_INFO_2 structure
Dim Data_to_Size As Long = Marshal.SizeOf(type_to_change)
If Data_to_Size > datas.Length Then
Return Nothing
End If
Dim buffer As IntPtr = Marshal.AllocHGlobal(Data_to_Size)
Dim startindex As Long
Dim i As Integer
For i = 0 To NumJub - 1
If i = 0 Then
startindex = 0
Else
startindex = startindex + Data_to_Size
End If
Next
'Copy data from the datas array to the unmanaged memory pointer.
Marshal.Copy(datas, startindex, buffer, Data_to_Size)
'Marshal data from the buffer pointer to a managed object.
Dim result_obj As Object = Marshal.PtrToStructure(buffer, type_to_change)
'Free the memory that is allocated from the unmanaged memory.
Marshal.FreeHGlobal(buffer)
Return result_obj
End Function
- Marshal Class
- Call Unmanaged Code Part 2 - Marshal Class
- How to Marshal a C++ Class
- How to Marshal a C++ Class
- C# struct class 在Marshal.SizeOf 的区别
- Marshal类
- Marshal.GetDelegateForFunctionPointer
- Marshal 类
- 什么是marshal
- Marshal C#
- Marshal 类
- Marshal 类
- Marshal 类
- Marshal类
- Marshal.AllocHGlobal VS Marshal.AllocCoTaskMem, Marshal.SizeOf VS sizeof()
- Marshal.GetDelegateForFunctionPointer 方法和Marshal.GetFunctionPointerForDelegate 方法
- 微软Marshal.ReleaseComObject
- jaxb 使用 之 marshal
- 在VS.NET IDE中集成VSS的常见问题
- 签名applet实践
- 将已注册hotmail邮箱升级到25M的方法
- 无法打开Web项目
- 设优秀网站的六大原则
- Marshal Class
- MUP "多 UNC提供者"( Multiple UNC Provider, MUP)资源定位符
- 重新开始,启用两年前的计划--家佳进销存计划(一)
- 前天晚上写完年度总结,昨天修改了一下系统tag,今天起开始通读系统tag
- 留言本
- 通过一个网络打开 //Myserver/Myshare/Sample.mp3,各组件的通信情况
- 每天抱你,一直到老
- 用代码动态添加windows用户
- 在线播放器代码大全