A "wrapper" refers to code created to allow a program to link to something else. Most DLLs that are not ActiveX use these, including the Windows API. An example of the difference would be:
<Wrapper>
---------
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
<Script>
--------
'Search the window
WinWnd = FindWindow(vbNullString, "MUSHClient")
If WinWnd = 0 Then MsgBox "Couldn't find the window ...": Exit Sub
'Show the window
ShowWindow WinWnd, SW_SHOWNORMAL
So, basically a wrapper is a set of definitions that specify 'which' DLL something is in, such as "user32", and 'what' parameters they expect. ActiveX uses something called IUnknown, to access an internal 'wrapper', which contains these same definitions, for those functions available to programs. Instead of explicitly defining what functions you want to use, you create a copy of the DLL, then refer to the internal functions. If "user32" was an ActiveX component, then using it would look like this:
a = createobject("User32API")
WinWnd = a.FindWindow(vbNullString, "MUSHClient")
a.ShowWindow WinWnd, SW_SHOWNORMAL
The reasion being that 'createobject' automatically reads the internal definitions using IUnknown (the ActiveX wrapper), and provides immediate access to the functions. Since standard DLLs do not contain their own internal table, they require a 'wrapper' to tell your program what to do with them. Mushclient itself comes with a file called MUSHClient.tlb, which VB Studio and other programs that know how to read them can generate their own wrappers from. Python includes something to do this, and probably Lua as well, otherwise you end up having to write your own.
Some things like VBScript are intentionally disabled on some levels, so such wrappers can't be created for them. The idea was to keep someone from linking to the file system API or the like and causing the system to tranfer files, delete them, format your hard drive, etc. Its didn't work, since all it takes to do those things anyway is to get some fool to install an ActiveX program, and in some cases even force IE to install one without you knowing, then use createobject to do the same thing anyway... The result is that all MS based script systems are useless as full languages, since none of them can access APIs or non-ActiveX components. As my father sometimes says, "It just keeps the honest criminals from taking advantage of you.", wihout really doing what that limitation was supposed to prevent. |