Frequently Asked Questions on Developing with the ActiveX SDK
You must obtain a redistribution license for Internet Explorer (IE) 3.0 and use the IE 3.0
self-extracting executable (Msie30.exe) to install the necessary files and registry entries.
You can license Microsoft Internet Explorer for Windows 95, Windows 3.1, Windows NT
Workstation, and Macintosh royalty-free to redistribute within your organization or to
your customers.
More information on this can be found in article Q155969 in the Microsoft Knowledge Base. The KnowledgeBase is an excellent resource
for technical articles and samples on various Microsoft products, and is currently available on the Internet
under the Microsoft Support Page at
http://www.microsoft.com/kb. Related articles on developing with the ActiveX SDK can be found by choosing "ActiveX SDK" or
"Misc Internet Topics" from the list of products/technologies on that page.
Although the WebBrowser Control does not support a print method, you can
print its contents using one of two ways:
1. Set focus to the Web Browser Control and send a key combination of Ctrl-P, or
LPDISPATCH lpDispatch = NULL; lpDispatch = m_ctlWebBrowser.GetDocument(); lpDispatch->QueryInterface(IID_IOleCommandTarget, (void**)&lpOleCommandTarget); lpDispatch->Release(); // print contents of web browser control More information on this can be found in article Q156732 in the Microsoft Knowledge Base. The KnowledgeBase is an excellent resource
for technical articles and samples on various Microsoft products, and is currently available on the Internet
under the Microsoft Support Page at
http://www.microsoft.com/kb. Related articles on developing with the ActiveX SDK can be found by choosing
"ActiveX SDK" or "Misc Internet Topics" from the list of products/technologies on that page.
The WebBrowser automation model does not support a method that will allow you to change
the font of the text of the currently displayed page.
The WebBrowser Control, however, exposes this functionality through the IOleCommandTarget
interface. Call the GetDocument() method, which returns an *IDispatch. Using this IDispatch
pointer, call QueryInterface() on IID_IOleCommandTarget. With this IOleCommandTarget
pointer, call Exec() with OLECMDID_ZOOM and use the pvaIn input argument to pass a value
in the range of 0 to 5 (where 0 is smallest) indicating the desired scale of the font.
This, in effect, mimicks the functionality available through Internet Explorer's View\Fonts
menu.
LPDISPATCH pDisp = NULL; pDisp = m_ctlWebBrowser.GetDocument();
pDisp->QueryInterface(IID_IOleCommandTarget, (LPVOID*)&pCmdTarg); VARIANT vaZoomFactor; // Input arguments VariantInit(&vaZoomFactor); if (pCmdTarg) pCmdTarg->Release(); // release document's command target More information on this can be found in the IEZOOM sample described in article Q156693 in the Microsoft Knowledge Base. The KnowledgeBase is an excellent resource
for technical articles and samples on various Microsoft products, and is currently available on the Internet
under the Microsoft Support Page at
http://www.microsoft.com/kb. Related articles on developing with the ActiveX SDK can be found by choosing
"ActiveX SDK" or "Misc Internet Topics" from the list of products/technologies on that page.
Other than the information provided in the Internet Control Pack Web site on
http://www.microsoft.com/icp,
Microsoft does not support any of the controls that are part of the Internet Control Pack
(ICP). The controls included in the ICP are the FTP, HTML, HTTP, NNTP, POP, SMTP, WinSock
TCP, and WinSock UDP controls.
Questions on these controls should be directed to:
NetManage More information on this can be found in article Q156692 in the Microsoft Knowledge Base. The KnowledgeBase is an excellent resource
for technical articles and samples on various Microsoft products, and is currently available on the Internet
under the Microsoft Support Page at
http://www.microsoft.com/kb. Related articles on developing with the ActiveX SDK can be found by choosing
"ActiveX SDK" or "Misc Internet Topics" from the list of products/technologies on that page.
The AcitveX Control Pad can be used to quickly and easily author the <OBJECT> tags
which are used to support ActiveX Controls in HTML. Also included is the Script Wizard,
which can be used to quickly connect controls together in either VBScript or in JScript.
HTML Layout Controls are also authored using this tool. The ActiveX Control Pad is not
included with the ActiveX SDK, but may be downloaded for free from http://www.microsoft.com/workshop/author/cpad.
ActiveX Controls are a superset of OLE Controls. Originally, OLE Controls were required to support a number of
interfaces which are optional for ActiveX Controls. For ActiveX Controls, the only requirements are that the control
supports IUnknown and is self-registering (ie exports DllRegisterServer and DllUnregisterServer).
Mike McKeown addresses this very confused issue of OLE Controls versus ActiveX Controls in the Oct. 1996 issue of the
MIND (Microsoft Interactive Developer) magazine. More information on enabling controls for the Internet, as well as various documentation on interfaces and functions
an ActiveX Control should support, can be found on the "ActiveX Controls" section of the ActiveX SDK online docs.
Yes. All OCXs are ActiveX Controls.
Yes, all MFC Controls are ActiveX Controls. An old Visual C++ 4.0 Control is an ActiveX Control, as is one created
with VB4, or the ActiveX Controls BaseCtl Framework that comes as part of the ActiveX SDK samples.
Look at the term ActiveX Control as a renaming and restructuring of the OLE Control technology -
an evolution.
A control can be architected to work efficiently on the Internet, or to be hosted in desktop container
apps, or to do both. Sure, some controls are not as better suited to be used on the Internet due to their
large size and synchronously loading of properties, but they are still ActiveX Controls. This is where
most of the confusion comes in.
Yes. The OLE Control and Control Container Guidelines v2.0 describe a number of optional features which may be
implemented. Some controls will implement features which require corresponding features in the container in order to work
properly. Conversely, some containers will only recognize controls which implement some optional features.
Older containers will typically only recognize controls which are marked in the registry with the "Control" key and
which implement the older OLE Control specification, although they may be able to use newer controls as Automation objects.
Newer controls and containers can use something called "Component Categories" to describe their abilities and requirements.
Component Categories are defined in the OLE Programmer's Guide, which is part of the ActiveX SDK and Win32 SDK. The OLE Control and Control Container Guidelines v2.0 and other related specifications can be found under the
InetSDK\Specs subdirectory of the ActiveX SDK installation.
Most ActiveX Controls should work with VB4. It is possible that a control will require container support that VB4 does not provide. This is true for any
control and container combination.
Again, it is possible that controls will require container support that IE3 does not provide.
IE3 also includes security features which may prevent some ActiveX Controls from working with all IE3 configurations. This is most likely for older controls.
In order for controls to work smoothly with IE when it is configured for the high safety level for active-content security (which is the default), the controls must be marked as
"safe for initialization" and/or "safe for scripting". If a control is used on an HTML page in a way which conflicts with its safety identification and the user's safety level,
IE will not create the control. See the "Safety API Reference" in the ActiveX SDK documentation for more information.
Typically, when someone uses this term, they are referring to controls which are written to be as small as possible, so they can be downloaded quickly.
Lightweight controls are ActiveX Controls, but may not implement all the required features of the older OLE Control specification.
The ActiveX Controls BaseCtl Framework mentioned above, that ships with the ActiveX SDK samples, provides small self-sufficient "lightweight" controls
not dependent on associated DLL's (such as the MFC or VB runtimes), although it requires a solid understanding of OLE and COM technologies.
If you want to know more about ActiveX controls, particularly on developing web pages, check out another FAQ available
on the "ActiveX Controls" section of the ActiveX SDK page.
Depending on how Internet Explorer's Safety Level is set, IE brings up a
"Potential Safety Violation" message box, which indicates "the page contains active
content that is not verifiably safe to display." It then either refuses to display the
control or gives the user an option to allow it to be used.
Internet Explorer is trying to protect the client workstation by refusing to execute content
that may be potentially unsafe. There are three ways to resolve this issue.
The first, and least satisfactory, option is for the end-user to reduce the security
settings of their browser via Internet Explorer's View\Options\Security\Safety Level option.
This is the least appealing option because it reduces or disables security on all content
displayed in the browser.
The second option is for control developers to register their controls as implementing
the "safe for scripting" component category. When Internet Explorer encounters an
<OBJECT> tag, it uses the Component Categories Manager to determine whether or
not the specified CLASSID is safe for scripting.
The third option is for control developers to implement the IObjectSafety interface.
More information about the second and third options can be found under the "Safety API
Reference" in the ActiveX SDK documentation.
This information is available in the SDK documention under \inetsdk\specs\register.htm.
Registering an ActiveX object is essential in order for Internet Explorer to launch the correct
player when interpreting the standard HTML <A HREF> tag, or Netscape's
<EMBED> tag. Without the registration described in this document, it is impossible
for ActiveX containers to guess what application to use to display or play an unknown media file.
The document outlines the four steps necessary for registering your ActiveX Control, including
the special registry settings that allow ActiveX Controls to
(a) Launch with the <EMBED> tag (that is, without <OBJECT> and without
CLSID specified) Step1: Register the CLSID for the ActiveX object. What's missing from the document, however, is how to get the file name from within
your control. This is passed to IPersistPropertyBag as a parameter called SRC.
Use the LPK_TOOL that is part of the ActiveX SDK on inetsdk\bin directory. For example, if you run the LPK_TOOL, add the Masked Edit Control, and save it out to
Maskedit.lpk, your HTML code will look like the following:
<OBJECT CLASSID="clsid:5220cb21-c88d-11cf-b347-00aa00a28331">
<OBJECT CLASSID="clsid:C932BA85-4374-101B-A56C-00AA003668DC" WIDTH=200 HEIGHT=200> Refer to the "Licensing ActiveX Controls" section of the ActiveX SDK documentation for more information.
No, IE3 does not support windowless controls. Watch for this feature in future versions of Internet
Explorer. Currently, you can work around this with the HTML layout Control, which allows the windowless controls
to be transparent relative to the background of the Layout Control.
Not currently, but as a workaround you could host the WebBrowser Control and point it
to the file in question. IE supports an Automation interface called IWebBrowserApp. It also supports an object
model for scripting through a hierarchy of interfaces, the root of which is IHTMLDocument.
The IHTMLDocument interface has one property, Script, which returns the dispinterface for
the IOmWindow interface. This corresponds to the window object described in the ActiveX
SDK documentation. From a contained control or doc object, you can get the dispinterface
for IWebBrowserApp with the following code:
IOleClientSite* pClientSite; // already points to the control's client site
pClientSite->QueryInterface(IID_IServiceProvider, (void **)&pISP); To get the dispinterface for IHTMLDocument, given that you already have the ISP
pointer as above, you can use this code: IDispatch* pScriptIEDisp; Yes, this is done through the magic of OLE Automation and the InternetExplorer object.
The InternetExplorer object allows an application to create and manipulate an instance of
IE through OLE Automation. Here's how you can launch IE3 in Visual Basic, for instance,
and have it open the Microsoft Web page at http://www.microsoft.com. Note, however, that this
method launches a new instance of IE everytime.
Dim Explorer As Object
Explorer = CreateObject ("InternetExplorer.Application") More information on the InternetExplorer object can be found on the ActiveX SDK page under the "IE Object Model" section.
Another way an application can launch IE, and have it navigate to a specified URL, is through DDE.
Internet Explorer provides support for DDE (Dynamic Data Exchange) so that applications
could to talk to a currently running instance of IE, or even open a new IE window.
Applications could communicate to IE in this manner by establishing a DDE connection with IE,
specifying iexplore as the appName, the verb WWW_OpenURL as the topicName,
and the desired URL, say http://www.microsoft.com, for its XTYP_EXECUTE string.
More information on Internet Explorer's DDE support, particularly the various topicNames you can
specify, can be found on
http://www.microsoft.com/ie/support/docs/tech30/dde.htm. A more detailed documentation on this is
made available by Spyglass on
http://www.spyglass.com/techspec/specs/sdi_spec.html.
Yes. Check out the WebPost API, in particular the WpPost function. This function allows you
to upload a bunch of files (or directories even!) to an Internet site. The URLPAD and WEBPOST
samples available on Inetsdk\Samples directory both demonstrate how to use this function
correctly.
WinInet requires enhancements for asynchronous operations, which is only available with
Windows NT 3.51 Service Pack 4 (SP4). Be sure to install SP4 when running WinNT 3.51.
Also, verify that you're using Wint351.exe, which installs Wininet.dll and dependencies on WinNT 3.51.
Refer to the ActiveX SDK's Readme.txt file for more information.
There is no JScript specific document. JScript is exactly like JavaScript syntactically.
The Scripting Object Model document applies to both VBScript and JScript as both are just
language engines calling a common model. Almost all questions are answered in this document.
Refer to
http://www.microsoft.com/jscript for more information. There is also an FAQ
on that page that addresses the top JScript issues.
Documentation for VBScript is available on the VBScript
Web page, which is updated frequently. That site will soon be updated to contain links to good VBScript books.
There is also an FAQ available
on that page that addresses the most common VBScript issues.
Yes. Check out the ActiveX SDK Page.
Scroll through the various topics on the left frame and you'll find FAQs on ActiveX Controls,
Java, Internet Security Framework, Authenticode, and other topics we believe are of special
interest to the Internet developer.
Last updated: October 16, 1996
I'm using the WebBrowser Control in my application. How do I redistribute it?
How do I print from the WebBrowser Control?
2. Call the GetDocument() method, which returns an *IDispatch. Using this IDispatch pointer,
call QueryInterface() on IID_IOleCommandTarget. With the object pointer returned,
call Exec (NULL, OLECMDID_PRINT, 0, NULL, NULL).
LPOLECOMMANDTARGET lpOleCommandTarget = NULL;
ASSERT(lpDispatch);
ASSERT(lpOleCommandTarget);
lpOleCommandTarget->Exec(NULL, OLECMDID_PRINT, 0, NULL,NULL);
lpOleCommandTarget->Release();
How do I change the font from a WebBrowser Control?
LPOLECOMMANDTARGET pCmdTarg = NULL;
ASSERT(pDisp);
ASSERT(pCmdTarg);
V_VT(&vaZoomFactor) = VT_I4;
V_I4(&vaZoomFactor) = fontSize;
pCmdTarg->Exec(NULL, OLECMDID_ZOOM, OLECMDEXECOPT_DONTPROMPTUSER, &vaZoomFactor, NULL);
VariantClear(&vaZoomFactor);
if (pDisp) pDisp->Release(); // release document's dispatch interface
Where do I get support for the controls in the Internet Control Pack?
http://www.netmanage.com
10725 North De Anza Blvd.
Cupertino, CA 95014
(408) 973-7171 sales phone
(408) 257-6405 fax
(408) 973-8181 support phone
What is the ActiveX Control Pad, and where can I find out more about it?
What really is the difference between an OLE Control and an ActiveX Control?"
So are out of the box OCX's such as the one shipped with VB4 also ActiveX controls?
How about MFC Controls, are they also ActiveX Controls?
Are there different types of ActiveX Controls?
So, will all ActiveX Controls work with VB4?
Will all ActiveX Controls work with IE3?
How do "lightweight OLE Controls" come into play?
Why does IE bring up a "Potential Safety Violation" warning when I
try to display a page that contains a control I've written?
How does one register a control as a player for a particular
file/MIME type?
(b) Work full-frame (that is, for <A HREF> tags). Even ActiveX Controls work
full-frame, so you no longer need to have a DocObject to work full-frame (although
controls won't get the full menu-negotiation, and so forth.)
Step2: Associate the object's CLSID with a ProgId.
Step3: Associate the object with a MIME type.
Step4: Associate the file extension with a ProgId and optionally with a MIME type.
I'm trying to license my control. Is there a tool available for
generating .lpk (license package) files?
Be sure to specify the ClassID of the IE licensing manager, not the control you're licensing.
<PARAM NAME="LPKPath" VALUE="maskedit.lpk">
</OBJECT>
</OBJECT>
Does IE3 support windowless controls? If not, when will support for this be available?
Is there an API to render JPEG/GIFs from an ActiveX Control?
How do I access IE's object model from a contained control?
IServiceProvider* pISP;
IDispatch* pIEIDisp;
pISP->QueryService(IID_IWebBrowserApp, IID_IDispatch, (void **)&pIEIDisp);
pISP->QueryService(SID_SContainerDispatch, IID_IDispatch, (void**)&pScriptIEDisp);
Is there a way to launch Internet Explorer and have it open a URL?
Explorer.Navigate "http://www.microsoft.com"
Explorer.Visible = True
I've been able to download a file using the URL Open Stream functions. Is there a similar
functionality available to upload a file to the Internet?
How do I get WinInet to work correctly in Windows NT 3.51?
Where can I find JScript documentation? I can't seem to find it in the SDK.
Where can I find VBScript documentation?
Are there any other FAQs on related topics that I should know about?