怎么调用API?

coolbye 2003-06-17 05:43:22
ZeroMemory(lpDest as Any, byval nNum as Long)

Dim a(1) as Byte
ZeroMemory a(0), 1

执行后非法操作,不知要怎么用
Any要怎么调
...全文
50 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
coolbye 2003-06-17
  • 打赏
  • 举报
回复
astring = "A"
不是已经有一个字节的空间吗?
of123 2003-06-17
  • 打赏
  • 举报
回复
Dim strTmp As String * 256
ZeroMemory strTmp, Len(strTmp)
coolbye 2003-06-17
  • 打赏
  • 举报
回复
我这样
dim astring as string
astring = "A"
ZeroMemory byval astring, len(astring)

也不行,错在哪
of123 2003-06-17
  • 打赏
  • 举报
回复
Public Declare Sub ZeroMemory Lib "KERNEL32" Alias "RtlMoveMemory" (dest As Any, ByVal numBytes As Long)

Dim CurrChars(0 To 255) As Byte
Call ZeroMemory(CurrChars(0), 256 * Len(CurrChars(0)))
rappercn 2003-06-17
  • 打赏
  • 举报
回复
Private Declare Sub FillMemory Lib "kernel32.dll" Alias "RtlFillMemory" (Destination As Any, ByVal Length As Long, ByVal Fill As Byte)
Private Declare Sub ZeroMemory Lib "kernel32.dll" Alias "RtlZeroMemory" (Destination As Any, ByVal Length As Long)
Private Sub Form_Load()
Dim TestString As String
'Mak sure Visual Basic repaint the form automatically
Me.AutoRedraw = True
'Create a buffer string
TestString = String(25, "X")
Me.Print "This is our initial string: " + TestString
'Fill the buffer-string with A's
FillMemory ByVal TestString, Len(TestString), Asc("A")
Me.Print "This is our string after FillMemory: " + TestString
'Empty the string
ZeroMemory ByVal TestString, Len(TestString)
Me.Print "This is our string after ZeroMemory: " + TestString
End Sub

1,486

社区成员

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

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