Vb 类返回共有结构体

hjessica 2008-04-10 02:31:34
我在一个EXE工程中写了一个类和一个标准模块

我现在在类中写个函数,返回值是标准模块里面的公用结构体,但是一直无法编译,不知道什么错误?
...全文
55 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
vbman2003 2008-04-10
  • 打赏
  • 举报
回复
貌似可以传址再用CopyMemory?

标准模块:
Type aa
s As String
b as byte
End Type

类模块:
Function test(lng as long) As Variant
Dim a As aa
CopyMemory a,lng,len(a)
debug.? a.s
debug.? a.b
End Function

窗体:
dim t as ss
t.s="test"
t.b=123

dim c as new class1
c.test(varptr(t))


这样?
hjessica 2008-04-10
  • 打赏
  • 举报
回复
找到方法了。。。
迈克揉索芙特 2008-04-10
  • 打赏
  • 举报
回复
标准模块:
Type aa
ss As String
End Type

类模块:
Function test() As Variant
Dim a As aa
a.ss = Now
test = a
End Function
东方之珠 2008-04-10
  • 打赏
  • 举报
回复
把代码贴出来看一看!

7,763

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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