2025-04-27 07:49:33 -04:00

171 lines
6.8 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=Windows-1252">
<TITLE>TypeLibrary Declarations</TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!--
TempString = navigator.appVersion
if (navigator.appName == "Microsoft Internet Explorer"){
// Check to see if browser is Microsoft
if (TempString.indexOf ("4.") >= 0){
// Check to see if it is IE 4
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/coua.css">');
}
else {
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/cocss.css">');
}
}
else if (navigator.appName == "Netscape") {
// Check to see if browser is Netscape
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/coua.css">');
}
else
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/cocss.css">');
//-->
</script>
<SCRIPT LANGUAGE="VBScript">
<!--
Sub Window_OnLoad()
Dim frmContents
On Error Resume Next
If Not Parent Is Nothing Then
Set frmContents = Parent.Contents
If Not frmContents Is Nothing Then
frmContents.Window.TOCSynch_Click
End If
End If
End Sub
//--></SCRIPT><META NAME="DESCRIPTION" CONTENT="Internet Information Services reference information">
<META HTTP-EQUIV="PICS-Label" CONTENT='(PICS-1.1 "<http://www.rsac.org/ratingsv01.html>" l comment "RSACi North America Server" by "inet@microsoft.com <mailto:inet@microsoft.com>" r (n 0 s 0 v 0 l 0))'>
<META NAME="MS.LOCALE" CONTENT="EN-US">
<META NAME="MS-IT-LOC" Content="Internet Information Services">
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H2><A NAME="_typelibrary_declarations"></A><SUP></SUP>TypeLibrary Declarations</H2>
<P>A type library is a file that contains information about objects and types supported by a COM component. It is very common for a COM component to describe any constants that it supports in a type library. If your Web application relies on COM objects that have declared data types in type libraries, you can declare the type libraries in Global.asa. Doing so will make it possible to refer to the constants declared in the type libraries from any script within the application boundary.</P>
<P>For more information about using constants in ASP, see <A HREF="iiwavar.htm">Using Variables and Constants</A>.</P>
<H6>Syntax</H6>
<P>&lt;!--<B>METADATA TYPE</B>="TypeLib"</P>
<P><B>FILE</B>="<I>file</I>"</P>
<P><B>UUID</B>="<I>typelibraryuuid</I>"</P>
<P><B>VERSION</B>="<I>majorversionnumber.minorversionnumber"</I></P>
<P><B>LCID</B>="<I>localeid</I>"</P>
<P>--&gt;</P>
<H6>Parameters</H6>
<DL>
<DT><I>file</I></DT>
<DD>Absolute path to a type library. If this parameter and the <I>typelibraryuuid </I>parameter<I> </I>are provided, <I>file</I> is used to identify the type library. Either the <I>file</I> parameter or the <I>typelibraryuuid</I> parameter is required.<BR>
</DD>
<DT><I>typelibraryuuid</I></DT>
<DD>Universally unique identifier for the type library. Either the <I>file</I> parameter or the <I>typelibraryuuid</I> parameter is required.<BR>
</DD>
<DT><I>majorversionnumber</I></DT>
<DD>Used for selecting version. If the requested version is not found, then the most recent version is used (optional).<BR>
</DD>
<DT><I>minorversionnumber</I></DT>
<DD>Used for selecting version. If the requested version is not found, then the most recent version is used (optional).<BR>
</DD>
<DT><I>localeid</I></DT>
<DD>The locale identifier to be used for the type library. If the requested locale is not found, then the System locale identifier will be used. (optional)</DD>
</DL>
<H6>Error Values</H6>
<P>The server can return one of the following error messages.</P>
<TABLE border=0 cellpadding=5 cols=2 frame=box rules=all>
<TR VALIGN="top">
<TD class=blue width=31%><B>Error</B></TD>
<TD class=blue width=69%><B>Description</B></TD>
</TR>
<TR VALIGN="top">
<TD width=31%>ASP 0222</TD>
<TD width=69%>Invalid type library specification. The METADATA tag contains an invalid type library specification.</TD>
</TR>
<TR VALIGN="top">
<TD width=31%>ASP 0223</TD>
<TD width=69%>Type library not found. The METADATA tag contains a type library specification that does not match any registry entry.</TD>
</TR>
<TR VALIGN="top">
<TD width=31%>ASP 0224</TD>
<TD width=69%>Type library cannot be loaded. ASP cannot load the type library specified in the METADATA tag.</TD>
</TR>
<TR VALIGN="top">
<TD width=31%>ASP 0225</TD>
<TD width=69%>Type library cannot be wrapped. ASP cannot create a <B>Type Library Wrapper</B> object from the type libraries specified in the METADATA tag.</TD>
</TR>
</TABLE><BR>
<H6>Remarks</H6>
<P>It is recommended that METADATA tags appear near the top of the Global.asa file. However, these tags can appear anywhere inside of the Global.asa file, including both inside and outside the SCRIPT tags.</P>
<P>You can avoid ambiguous references to constants by adding the type library name as a prefix for the constant. For example, <B>ADODB.adErrItemNotFound</B> would be less ambiguous than <B>adErrItemNotFound</B>.</P>
<P>If you use Microsoft Visual InterDev to create your Global.asa file, the METADATA tags will include the optional STARTSPAN and ENDSPAN keywords. These keywords are ignored by IIS. </P>
<P>If you do not specify a locale identifier for the type library, the default locale identifier for the system will be used. If the system locale identifier can not be used, and you have not specified a locale identifier, the locale identifier for the Type Library will be set to 0.</P>
<H6>Example</H6>
<P><CODE>MyComponent</CODE> in the following example was developed with Visual Basic 5.0. <CODE>MyComponent</CODE> defines the constant <CODE>MyError</CODE> with the following statement.</P>
<PRE><CODE>Public Const MyError = "You are not using MyComponent correctly."
</CODE></PRE>
<P>The type library is contained in mycomponent.lib, which you have installed in the following directory.</P>
<PRE><CODE>C:\MyComponent
</CODE></PRE>
<P>The following METADATA tag is included in the Global.asa file for the MyApp application. </P>
<PRE><CODE>&lt;!--METADATA TYPE="TypeLib"
FILE="<I>MyComponent.tlb</I>"
--&gt;
</CODE></PRE>
<P>Any .asp file in the MyApp application can now include the following script:</P>
<PRE><CODE>&lt;%
Dim MyVar
Set MyVar = Server.CreateObject("MyComponent.MyClass")
Currentreturn = MyVar.MyMethod
If Currentreturn = False
Response.Write(MyError)
End If
%&gt;
</CODE></PRE>
<hr class="iis" size="1">
<p align="center"><em><a href="../../../common/colegal.htm">&copy; 1997-2001 Microsoft Corporation. All rights reserved.</a></em></p>
</BODY>
</HTML>