VB 6.0 调用dll的问题 - .NET技术 / VB.NET
我在VC 6.0中写了一个example.dll,里面一个函数
extern "C" __declspec(dllexport)
HRESULT __stdcall Connect(LPCSTR IpAddr)
{
...
}
example.dll中该函数名称为 _Connect@4 (用depends工具查看)
我在VB 6.0中调用此函数
Private Declare Function Connect Lib "example.dll" Alias "_Connect@4" (ByVal IpAddr As String) As Long
Dim result As Long
result = Connect("138.139.0.230")
If result <> 0 Then
MsgBox ("error_connect")
Else
MsgBox ("connect_ok")
End If
结果返回都是非0,连接失败。
但我用VC编写的代码以及用VB.NET编写同样功能的代码都可以连接上。
不知道这段VB 6.0的代码有什么不对的地方。
(只有45分了,全散了)
VB.NET和VC调用时,example.dll没有加__stdcall。(因为VB 6.0需要是stdcall)
即:
extern "C" __declspec(dllexport)
HRESULT Connect(LPCSTR IpAddr)
{
...
}
VB.NET代码如下:
Imports System.Runtime.InteropServices
<DllImport("./example.dll", CallingConvention:=CallingConvention.Cdecl)> _
Public Function Connect(ByVal IpAddr As String) As Integer
End Function
Dim result As Integer
result = Connect("138.139.0.230") '连接单板
If result &
相关问答:
数据库里有一个字段的内容是二进制,怎么才能把这个二进制读出来
使用字节流对象可以实现
例如现在数据库里有个字段的内容是0x504B03040A0000000800407F263C3B02465390000000820000000A0000006273CECACCE22E7478 ......
form1中有text1-8, 和command1
text8中为程序代码(生成窗体为form2(已做好))
单击command1后将text2中的代码生成EXE到d:\ 并且text1-7分别对应
产品名 公司名 合法版权 合法商标 文件描述 注释 标题
......
vb WebBrowser 小问题,请教:
WebBrowser里的网址跳转后,怎么取得跳转后的页面的URL地址
顶下顶下
引用
BeforeNavigate2
好像没有这个吧 vb6.0
BeforeNavigate2
这个可以有,呵呵。
......
谁能帮我把下面这些代码改成VB形式的,多谢了,急用~~
#include "stdlib.h"
#include "math.h"
#include "stdio.h"
float objfx(float x[]);
void constraint(float x[],float g ......
找了很久这东西了,
用treeview不能满足要求
现在想做的是:界面以树形展现,能不能展开收回无所谓
节点都可以按照规定进行添删
每个节点后面都可能会出现 文本 ......