在DLL中函数类型定位字符串指针。
解决方案 »
- 如何将vb6.0 combobox的list设置为SQL数据库表中某字段的内容
- 【问】XP下如何发送文本到另一软件文本框中?(已得到此句柄及父窗体句柄)
- 编译成DLL文件的问题。
- 特别推荐: EtCell报表控件/WEB插件 http://www.etcell.com/
- 怎样用VB显示一张图片?
- sql语句,选择相同的。
- winsock控件???高分!
- vb系统含有Crystal reports做的报表,做安装盘时除了.rpt外,还应把哪些文件包含进来
- 各位大哥你们好!请问怎样在VB中调用Excel作报表?急!!!!!
- 请问怎样改变显示器分辨率?
- 关于文件的打开问题
- 如何将串行口采集的数据送入Access数据库中?
EXPORT CHAR* DIS()
VB:
Private Declare Function dis Lib "test1.dll" () as string
啥都没有反回
Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As LongSub GetComputerName_test()
Dim Name As String, Length As Long
Length = 255
Name = String(Length, 0)
GetComputerName Name, Length
Name = Left(Name, Length)
MsgBox "此一电脑的名称=" & Name, , "GetComputerName"
End Sub
ByVal 变量=DIS()
(ByVal 变量)为字符串指针
变量为字符串
明白了吧!
in ActiveX DLL, it's very simple.
in normal DLL, your must Convert your string to UNICODE before
return. use MultiByteToWideChar.
if you don't like MultiByteToWideChar in C,
you can also use result = StrConv(buf, vbtoUniCode) in VB
here is a sample:
in VB:
Private Declare Function RevString Lib "MyDLL" Alias "RevString" (ByVal lpBuffer As String, ByRef BufOut, nSizeBuf As Long) As Long s = "xxx[Chinese]XXX"
buf = StrConv(s, vbfromUnicode)
call RevString(buf, sout, 255)
s = StrConv(sout, vbtoUnicode)in C:
__declspec( dllexport ) void RecString(char *, char*, long);
void RecString(char *, char*, long)
{
do something
}
in your MAKEFILE
EXPORTS
RecString@1