View Full Version : How to point to a function/method
joe_gan
01-05-2002, 03:57 AM
Hi,
I know in the C++ language, it is possible to pass the pointer of a function to an object. How about VB ?, I saw there is "GetRef" in the WSH's method, are they the same?, how to make used of GetRef?
Thank you.
darkness
01-07-2002, 02:58 PM
There are functions and Sub routines in VBS script, my question though is the object/function your referencing outside the wsh script? or in a DLL not included in the default WSH libraries?
1) You can reference a function in a DLL registered with the system.
2) If your trying to call a function from another script file, then NO it will not work. All code that you want to execute must be in the same script file. EXCEPT!
3) there is a way around this by using XML and writing all your functions in a second file. Then you can reference both files in XML and use VBS or Jscript in the same WSH program.
Or did I miss the question totally?
Michael McLaughlin/images/forums/icons/smile.gif
Systems Manager
Minnesota State University Mankato
joe_gan
01-09-2002, 11:06 AM
Thank for your reply.
Now, I know how to make use of GetRef in my application. Here is a sample if anyone is interested
Dim hFunc ' Function Holder
Function myFunc(Data)
myFunc = "Processed : " & Data
End Function
Set hFunc = GetRef("myFunc")
Wscript.echo hFunc("ABCDE")
=================
Output : "Processed : ABCDE"
Powered by vBulletin™ Version 4.1.0 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.