vb.net语法 转成 c# 怎么转呢 是c++ 写好的Dll 如何用c#来 调用呢

亲亲玲 2011-07-29 02:55:05
Public Declare Function InitComm Lib "termb.dll" (ByVal port As Integer) As Integer
Public Declare Function Authenticate Lib "termb.dll" () As Integer
Public Declare Function Read_Content Lib "termb.dll" (ByVal active As Integer) As Integer
Public Declare Function CloseComm Lib "termb.dll" () As Integer




sdtapi.dll
IDCard.ll

谢谢各位
...全文
61 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
mp6che 2011-08-17
  • 打赏
  • 举报
回复
有工具
[DllImport("termb.dll", EntryPoint = "InitCommExt")]
public static extern int InitCommExt();

[DllImport("termb.dll", EntryPoint = "InitComm")]
public static extern int InitComm(int port);

[DllImport("termb.dll", EntryPoint = "Authenticate")]
public static extern int Authenticate();

[DllImport("termb.dll", EntryPoint = "Read_Content")]
public static extern int Read_Content(int Active);

[DllImport("termb.dll", EntryPoint = "Read_Content_Path")]
public static extern int Read_Content_Path(string cPath, int Active);

[DllImport("termb.dll", EntryPoint = "CloseComm")]
public static extern int CloseComm();
亲亲玲 2011-07-29
  • 打赏
  • 举报
回复

isjoe 你好!

能帮我一下吗
谢谢
isjoe 2011-07-29
  • 打赏
  • 举报
回复
下载一个Reflector,打开vb的DLL或者exe,拷贝出来就OK了。或者直接导出C#版本的项目来。

调用C++的DLL,类似下面:
/// <summary>
///
/// </summary>
/// <param name="hwnd"></param>
/// <returns></returns>
[DllImport("user32.dll", EntryPoint = "SetForegroundWindow")]
public static extern IntPtr SetForegroundWindow(IntPtr hwnd);

/// <summary>
/// 检测网络连接状态
/// </summary>
/// <param name="connectionDescription">连接说明</param>
/// <param name="reservedValue">保留值</param>
/// <returns>为true则连接正常</returns>
[DllImport("wininet.dll")]
public extern static bool InternetGetConnectedState(out int connectionDescription,int reservedValue);

/// <summary>
/// 枚举窗口的回调函数
/// </summary>
/// <param name="hwnd"></param>
/// <param name="lParam"></param>
/// <returns></returns>
public delegate bool CallBack(IntPtr hwnd, int lParam);

/// <summary>
/// 枚举当前桌面窗口
/// </summary>
/// <param name="cb"></param>
/// <param name="lParam"></param>
/// <returns></returns>
   [DllImport("user32")]
public static extern int EnumWindows(CallBack cb, int lParam);
亲亲玲 2011-07-29
  • 打赏
  • 举报
回复
对 c/s 结构的,
亲亲玲 2011-07-29
  • 打赏
  • 举报
回复
vb.net 嵌入 C# 代码 可以吗? 这没有真没有试过呢
youzelin 2011-07-29
  • 打赏
  • 举报
回复
楼主,能不能先告诉我,我如何才能在回复中嵌入 C# 代码?本来可以的,但是现在貌似没有了

111,118

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧