|
-
Jun 13th, 2000, 09:15 PM
#1
Thread Starter
Lively Member
Have anyone made a CallByName for VB5 probably using API?
-
Jun 14th, 2000, 10:15 AM
#2
Please explain (aussie joke)
What fo you mean by a CallByName Function???????How should it work, hoe do you want it to work?????
-
Jun 14th, 2000, 11:13 AM
#3
PowerPoster
CallByName is a new function in VB6 and not for others old VB version.
Code:
CallByName (Object, Procedure, Calltype, [Arguments()])
sample code:
Code:
Private Sub cmdQuery_Click()
Dim sType as String
Dim vControl as Variant
On Error GoTo errorhandler
For Each vControl In Controls
If vControl.Name = txtObject.Text Then
Exit For
End If
Next
If chkProp.Value = vbChecked Then
If chkLet.Value = vbChecked Then
CallByName vControl, txtPropMeth.Text, vbLet, txtValue
Else
txtValue = CallByName(vControl, txtPropMeth, vbGet)
End If
Else
CallByName vControl, txtPropMeth.Text, vbMethod
End If
Exit Sub
errorhandler:
MsgBxo Err.Description
End Sub
Hope this will help. 
-
Jun 14th, 2000, 11:45 AM
#4
That explains it then
Am using VB5 SP3...............sad but true
-
Jun 14th, 2000, 12:25 PM
#5
Fanatic Member
Jethro, Explanation from Pauline (Aussie Joke Cont.)
Call by name has some interesting uses.
I have only used it once in a cut-down version of an XML parser which never saw the light of day 
I had one program running on one system and text arriving through the winsock in pseudo XML format could make RPC (Remote procedure calls) out of it.
It is of course possible to have a case statement on the incoming text and call the function but I wanted to add new functions to the program and have the client software just call them from a text based browser.
You can just pass a string containing the function name and it will call it.
It's slower then proper function calls by a long way, you'd never use it in a performance algorithm but it can be used to "Open up" an app to the outside.
VB5...
Not any way I can think of to create this funtion youself but I can't see why you couldn't imitate the functionality you need, it's not really that usefull and usually (unless I'm missing the point of it) there is a better way of writing the program without it. To me it was a cheap and dirty short cut.
Paul Dwyer 
Network Engineer
Aussie In Tokyo
Using Powerbasic 6 & VB6 SP4 (Please also add your VB Version to your signature!)
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
|