Article ID: 279164 - Last Review: May 25, 2005 - Revision: 4.0 Certain WScript methods and properties not accessible in Visual BasicThis article was previously published under Q279164 SUMMARY
WScript methods and properties cannot be created in the context of a Visual Basic object because they are part of the Windows Script Host (WSH) object model and must be hosted within a WScript object, which can only run in a WSH script.
MORE INFORMATION
The WScript object is often confused with the automation objects in WSH, such as WScript.Shell and WScript.Network. These automation objects can exist outside of a WSH script, but they must be created in the ObjectContext of the hosting environment (in other words, Server.CreateObject for Microsoft Active Server Pages [ASP] or WScript.CreateObject for WSH or simply CreateObject for Microsoft Visual Basic). Take note of the differences in the following examples. WSH and ASP have intrinsic methods and properties that are not available outside of their respective environments (WSH - Wscript.Echo, ASP - Response.Write). WSH Sample ASP Sample Visual Basic Sample Unlike the examples above, which demonstrate WScript automation objects, the following example illustrates a WScript method that cannot be called by an ObjectContext.CreateObject method (note that WScript is not instantiated prior to calling WScript.Sleep and can only be used in a WSH script):
All of the methods of WSH are duplicated by other API calls that Visual Basic can access. Although the WSH object model cannot be accessed through Visual Basic objects, the same functionality is available through the Visual Basic language and the Win32 API. REFERENCES
For more information about the SetWaitbleTimer() Win32 API, click the following article number to view the article in the Microsoft Knowledge Base:
231298
(http://support.microsoft.com/kb/231298/
)
How to use SetWaitableTimer with Visual Basic
For more information, click the following article numbers to view the articles in the Microsoft Knowledge Base:
190000
(http://support.microsoft.com/kb/190000/
)
How to get started programming with the Windows API (LONG)
202179
(http://support.microsoft.com/kb/202179/
)
How to call Windows API functions with special requirements from Visual Basic
171654
(http://support.microsoft.com/kb/171654/
)
How to attach a console window to your Visual Basic program
APPLIES TO
| Article Translations
|

Back to the top
