Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to "verify" your details, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Entire forum
➜ MUSHclient
➜ VBscript
➜ ActiveX and COM wrapper
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Dlong
(1 post) Bio
|
Date
| Tue 27 Sep 2005 04:09 PM (UTC) |
Message
| What is the difference between the ActiveX and COM wrapper? | Top |
|
Posted by
| Shadowfyr
USA (1,788 posts) Bio
|
Date
| Reply #1 on Tue 27 Sep 2005 07:20 PM (UTC) Amended on Tue 27 Sep 2005 07:22 PM (UTC) by Shadowfyr
|
Message
| 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. | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
16,610 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top