290 likes | 451 Views
ActiveX and The Internet. CIS 241 - Advanced Visual Basic. Active X Types. Active X components Active X controls Active X documents. Component Object Model. Defines software components COM Language independent Application Server Client. ActiveX Components.
E N D
ActiveX and The Internet CIS 241 - Advanced Visual Basic
Active X Types • Active X components • Active X controls • Active X documents
Component Object Model • Defines software components • COM • Language independent • Application • Server • Client
ActiveX Components • Standard class placed in its own application separate from any other application that uses is • ActiveX Component application is the server application • Applications that use it are clients
ActiveX Components • Types • ActiveX Dll • ActiveX Exe • Client View • Black box to clients • Client sees only the interface • Client may create and communicate with components • Roles of Programmers • Author (Designer) • Developer (User)
Instancing Property • Private • PublicNotCreatable • MultiUse • GlobalMultiUse
Type Libraries • Information for object browser • Enable applications to reference interface • Used for early binding
Creating an ActiveX Component • New project ActiveX dll (server project) • Properties page • Add class module(s) • Set instancing property for each class • Create dll • Testing the component
Project Properties Page • Name • Description • Component Tab • Project Compatibility • Binary Compatibility • No Compatibility
Active X Controls • Any non-intrinsic control • Composite or from scratch • Author • Developer
Understanding Controls • Design Time • Drag on form • Default values • Design time values • Run Time • Created at start of run • Run time values • Closed at end of run
Events That Are Raised • Initialize • InitProperties • ReadProperties • Terminate • WriteProperties
Activity on Control Developer Action Control Action Event Occurs
Creating a New Control • New control • Add user control to current project • New project type activeX control • Project Description • Toolbox Bitmap Property • Draw Control • Initial Events • Intialize • InitProperties
Properties • Author accesses parts • Programmer only what author exposes • Delegating • Let/Get • Varient
Property Persistence • Property Bag • UserControl_WriteProperties PropBag.WriteProperty propName, Value, Default Value • UserControl_ReadProperties Value = PropBag.ReadProperty(propName, Default Value) • Let Property propName PropertyChanged propName
Changing the Look • Ambient Properties Object • Values • Ambient Changed Event Handler for Control • Resize Event for Control • Keep in range • Keep things centered
Author Defined Events • Author Actions • Public Event eventName() • RaiseEvent eventName() • Developer Response • myControl_eventName
Active X Documents • Run in a container • May be a dll or exe • Consists of UserDocuments
UserDocuments • Each has its own designer • Menus • Files • dob • vbd • while testing • after compilation • UserDocument_Initialize
Hyperlink Object • Available in a UserDocument • NavigateTo • GoBack • GoForward
Making Properties Persistent • PropertyBag • Event • UserDocument_WriteProperties(PropBag as PropertyBag) • UserDocument_ReadProperties(PropBag as PropertyBag) • UserDocument Method • WriteProperty • ReadProperty • PropertyChanged
Sharing Data Between Documents • Standard Code Module Used • Declare global anything to be shared • Initialize in Main document Initialize event • Can be used in any documents
VB WebBrowser • Microsoft Internet Controls • Navigate • Catching a bad URL
Dynamic HTML • Dynamically alter web pages • Each web page has a designer
Web Page Controls • Button • TextField • TextArea • Option • Checkbox • Select • Image • Hyperlink • HiddenField
Web Page Events • onload • onunload • onreadystagechange • onclick • onfocus • onblur • onmouseup
Dynamic Styles • bgcolor • fgcolor • backgroundcolor • color • border • font
Managing State • Standard Code Module • Cookies • Base Window • PutProperty • GetProperty