|
-
Jun 10th, 2005, 02:29 PM
#1
Thread Starter
New Member
Pointers, like in C?
Hi everyone:
I was wondering if anyone knew how to define and call pointers to functions/subs in VB like we used to do in C? I tried to use the AddressOf opperator, but I can't seem to get it to work. I attempted a simple test: When a command button is clicked, it calls a function by pointer...
I tried various arangements, but the closest I came was -
[In a form (with 1 text box and one command button...) -]
Private Sub Command1_Click()
Dim FnPtr As Long
FnPtr = GetFnPtr(AddressOf testfunction)
Call FnPtr '<-Didn't work; gave error
End Sub
[In a module -]
'Function wrapper?
Public Sub testfunction(testval As Integer)
Form1.Text1.Text = "DID IT!"
End Sub
'Assign address
Public Function GetFnPtr(ByVal ptr As Long) As Long
GetFnPtr = ptr
End Function
Any ideas?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|