日期:2014-05-19  浏览次数:20923 次

帮忙! VB函数声明转换成C#声明
Declare   Function   MapPhysToLin   Lib   "WinIo.dll "   (ByVal   PhysAddr   As   Long,   ByVal   PhysSize   As   Long,   ByRef   PhysMemHandle)   As   Long
Declare   Function   UnmapPhysicalMemory   Lib   "WinIo.dll "   (ByVal   PhysMemHandle,   ByVal   LinAddr)   As   Boolean
Declare   Function   GetPhysLong   Lib   "WinIo.dll "   (ByVal   PhysAddr   As   Long,   ByRef   PhysVal   As   Long)   As   Boolean
Declare   Function   SetPhysLong   Lib   "WinIo.dll "   (ByVal   PhysAddr   As   Long,   ByVal   PhysVal   As   Long)   As   Boolean
Declare   Function   GetPortVal   Lib   "WinIo.dll "   (ByVal   PortAddr   As   Integer,   ByRef   PortVal   As   Long,   ByVal   bSize   As   Byte)   As   Boolean
Declare   Function   SetPortVal   Lib   "WinIo.dll "   (ByVal   PortAddr   As   Integer,   ByVal   PortVal   As   Long,   ByVal   bSize   As   Byte)   As   Boolean
Declare   Function   InitializeWinIo   Lib   "WinIo.dll "   ()   As   Boolean
Declare   Function   ShutdownWinIo   Lib   "WinIo.dll "   ()   As   Boolean
Declare   Function   InstallWinIoDriver   Lib   "WinIo.dll "   (ByVal   DriverPath   As   String,   ByVal   Mode   As   Integer)   As   Boolean
Declare   Function   RemoveWinIoDriver   Lib   "WinIo.dll "   ()   As   Boolean

' '   ------------------------------------以上是WINIO函数声明-------------------------------------------

Declare   Function   MapVirtualKey   Lib   "user32 "   Alias   "MapVirtualKeyA "   (ByVal   wCode   As   Long,   ByVal   wMapType   As   Long)   As   Long

' '-----------------------------------以上是WIN32   API函数声明-----------------------------------------


谁能帮忙转换一下,谢谢拉:)

------解决方案--------------------
学会用Reflector进行转换,现用某种语言编译一个动态链接库,然后反编译,基本上就Ok了,想要什么要什么,多少调整一下就可以了,就不用再找别人帮忙了。
------解决方案--------------------
c#语法:
[DLLImport"winio.dll"]
public static extern intPro MapPhysTolin(
int ByVal....
)
/*具体返回类型,参数类型请查api,特殊类型用intpro,一般int,string,unit,基本上不存在用longint的情况,我不懂VB*/

------解决方案--------------------
using System.Runtime.InteropServices;

[DLLImport"winio.dll"] 
public static extern int MapPhysToLin(int PhysAddr, int PhysSize, IntPtr PhysMemHandle);
//Declare Function MapPhysToLin Lib "WinIo.dll " (ByVal PhysAddr As Long, ByVal PhysSize As Long, ByRef PhysMemHandle) As Long 

[DLLImport"user.dll"] 
public static extern int MapVirtualKeyA(int wCode, int wMapType);
//Declare Function MapVirtualKey Lib "user32 " Alias "MapVirtualKeyA " (ByVal wCode As Long, ByVal wMapType As Long) As Long 

我找了两个例子弄了下,其他同样.