导航:  COleCon Class > Constructors >

CONSTRUCTOR (LibName)

上一页返回章节概述下一页

描述

 

这些构造函数注册OCX是合适的,许可或不.

 

语法

 

CONSTRUCTOR COleCon ( _

   BYVAL pWindow AS CWindow PTR, _

   BYVAL cID AS INTEGER, _

   BYREF wszLibName AS WSTRING, _

   BYREF classID AS CONST CLSID, _

   BYREF riid AS CONST IID, _

   BYVAL x AS LONG = 0, _

   BYVAL y AS LONG = 0, _

   BYVAL nWidth AS LONG = 0, _

   BYVAL nHeight AS LONG = 0, _

   BYVAL dwStyle AS DWORD = 0, _

   BYVAL dwExStyle AS DWORD = 0, _

   BYVAL ambientFlags AS DWORD = 0 _

)

 

CONSTRUCTOR COleCon ( _

   BYVAL pWindow AS CWindow PTR, _

   BYVAL cID AS INTEGER, _

   BYREF wszLibName AS WSTRING, _

   BYREF classID AS CONST CLSID, _

   BYREF riid AS CONST IID, _

   BYREF wszLicKey AS WSTRING, _

   BYVAL x AS LONG = 0, _

   BYVAL y AS LONG = 0, _

   BYVAL nWidth AS LONG = 0, _

   BYVAL nHeight AS LONG = 0, _

   BYVAL dwStyle AS DWORD = 0, _

   BYVAL dwExStyle AS DWORD = 0, _

   BYVAL ambientFlags AS DWORD = 0 _

)

 

参数

pWindow

对CWindow类用于创建窗体实例的指针.

cID

控件标识符.它必须是独一无二的.

wszLibName

完全限定路径的OCX文件.

classID

要创建的对象的CLSID,这样"{8E27C92B-1264-101C-8A2F-040224009C02}"

riid

要创建的对象的IID,这样"{8E27C92C-1264-101C-8A2F-040224009C02}".

wszLicKey

可选.如果控件已被授权,则该控件的许可密钥.

x

窗口的左上角相对于父窗口的客户区的左上角的x坐标.

y

相对于父窗口的客户区的左上角的窗口左上角的初始坐标.

nWidth

窗宽.

nHeight

窗口高度.

dwStyle

正在创建窗口的样式.

dwExStyle

正在创建的窗口的扩展样式.

ambientFlags

结合下面的旗帜,使用按位或运算符,表示你的喜好.

 

·DLCTL_DLIMAGES, DLCTL_VIDEOS, and DLCTL_BGSOUNDS: Images, videos, and background sounds will be downloaded from the server and displayed or played if these flags are set. They will not be downloaded and displayed if the flags are not set.
·DLCTL_NO_SCRIPTS and DLCTL_NO_JAVA: Scripts and Java applets will not be executed.
·DLCTL_NO_DLACTIVEXCTLS and DLCTL_NO_RUNACTIVEXCTLS : ActiveX controls will not be downloaded or will not be executed.
·DLCTL_DOWNLOADONLY: The page will only be downloaded, not displayed.
·DLCTL_NO_FRAMEDOWNLOAD: The WebBrowser Control will download and parse a frameset, but not the individual frame objects within the frameset.
·DLCTL_RESYNCHRONIZE and DLCTL_PRAGMA_NO_CACHE: These flags cause cache refreshes. With DLCTL_RESYNCHRONIZE, the server will be asked for update status. Cached files will be used if the server indicates that the cached information is up-to-date. With DLCTL_PRAGMA_NO_CACHE, files will be re-downloaded from the server regardless of the update status of the files.
·DLCTL_NO_BEHAVIORS: Behaviors are not downloaded and are disabled in the document.
·DLCTL_NO_METACHARSET_HTML: Character sets specified in meta elements are suppressed.
·DLCTL_URL_ENCODING_DISABLE_UTF8 and DLCTL_URL_ENCODING_ENABLE_UTF8: These flags function similarly to the DOCHOSTUIFLAG_URL_ENCODING_DISABLE_UTF8 and DOCHOSTUIFLAG_URL_ENCODING_ENABLE_UTF8 flags used with IDocHostUIHandler.GetHostInfo. The difference is that the DOCHOSTUIFLAG flags are checked only when the WebBrowser Control is first instantiated. The download flags here for the ambient property change are checked whenever the WebBrowser Control needs to perform a download.
·DLCTL_NO_CLIENTPULL: No client pull operations will be performed.
·DLCTL_SILENT: No user interface will be displayed during downloads.
·DLCTL_FORCEOFFLINE: The WebBrowser Control always operates in offline mode.
·DLCTL_OFFLINEIFNOTCONNECTED and DLCTL_OFFLINE: These flags are the same. The WebBrowser Control will operate in offline mode if not connected to the Internet.

 

Most of the flag values have negative effects, that is, they prevent behavior that normally happens. For instance, scripts are normally executed by the WebBrowser Control if you don't customize its behavior. But if you set the DLCTL_NOSCRIPTS flag, no scripts will execute in that instance of the control. However, three flags桪LCTL_DLIMAGES, DLCTL_VIDEOS, and DLCTL_BGSOUNDS梬ork exactly opposite. If you set flags at all, you must set these three for the WebBrowser Control to behave in its default manner vis-a-vis images, videos and sounds.

 

引用文件

 

COleCon.inc

 

示例

 

CONST IDC_WEBBROWSER = 1001

 

DIM wszLibName AS WSTRING * 260 = ExePath & "\MSCOMCT2.OCX"

DIM CLSID_MSComCtl2_MonthView AS CLSID = (&h232E456A, &h87C3, &h11D1, {&h8B, &hE3,&h00, &h00, &hF8, &h75, &h4D, &hA1})

DIM IID_MSComCtl2_MonthView AS CLSID = (&h232E4565, &h87C3, &h11D1, {&h8B, &hE3,&h00, &h00, &hF8, &h75, &h4D, &hA1})

DIM RTLKEY_MSCOMCT2 AS WSTRING * 260 = "651A8940-87C5-11d1-8BE3-0000F8754DA1"

DIM pOleCon AS COleCon PTR = NEW COleCon(@pWindow, IDC_WEBBROWSER, wszLibName, CLSID_MSComCtl2_MonthView, _

  IID_MSComCtl2_MonthView, RTLKEY_MSCOMCT2, 0, 0, pWindow.ClientWidth, pWindow.ClientHeight)