10/09/11 18:18:30
Dim X As BytePtr
Dim Y As BytePtr
Dim Z As BytePtr
Function test(a As BytePtr,b As Long) As String
Dim p As BytePtr
test=a '戻り値の文字列設定
p=StrPtr(test) '戻り値へのポインタを取得
If b=1 Then X=p
If b=2 Then Y=p
If b=3 Then Z=p
End Function
Sub main()
Dim t As BytePtr
t=calloc(10)
lstrcpy(t,test("ABCDE",1))
lstrcpy(t,test("12345",2))
lstrcpy(t,test("abcdef",3))
free(t)
End Sub
'↓ここからプログラム実行
main()
MsgBox 0,X,"X"
MsgBox 0,Y,"Y"
MsgBox 0,Z,"Z"