140 likes | 241 Vues
Chapter 15. Advanced Topics in VB. Advanced Topics in VB. Using ActiveX controls Linking from VB to a Web site Include DLL procedures in your projects Understand Windows API Use OLE container VB and VBA Differentiating between MDI and SDI interfaces. Introduction.
E N D
Chapter 15 Advanced Topics in VB
Advanced Topics in VB • Using ActiveX controls • Linking from VB to a Web site • Include DLL procedures in your projects • Understand Windows API • Use OLE container • VB and VBA • Differentiating between MDI and SDI interfaces
Introduction • Windows programs have access to other objects through • ActiveX controls • OLE (Object Linking and Embedding) • DLLs (Dynamic Link Libraries) • MDI interface allows multiple forms within an application—such as Excel or Word
ActiveX Controls • Refers to executable files, controls (COM), and DLLs that are used in multiple applications • Microsoft refers to any controls as ActiveX controls. • They can be home brew or part of a package • VB controls are called intrinsic controls • Controls that are added are called components
ActiveX Controls • Tabbed dialog box has several properties that can be set at design or run time • Click the builder button in the tab’s Custom property • Place controls on tabbed dialog boxes by manually drawing them—double-clicking a tool places the control on every tab page
ActiveX Controls (cont'd) • You can also purchase ActiveX controls • ActiveX control files end in .OCX or .VBX • Project, Components lists controls—most are .OCX • The Web Browser control allows you to browse the Web from VB—control is one of the extra components
Creating ActiveX Controls • Select ActiveX control, ActiveX EXE or ActiveX DLL in the New Project dialog box • Create an ActiveX control comprising a calendar control, a text box, and a command button
Dynamic Link Libraries • Libraries store frequently used procedures • Windows uses dynamic link libraries (DLLs) so store collections of executable procedures • Windows DLL procedures are available to VB programs • DLLs that are used to move/resize windows are called APIs (application programming interfaces) • Most DLLs require arguments that you pass to them
Calling a DLL Procedure • Call a procedure within the scope of a declare statement • Arguments to procedure can be constants or variables • Windows provides an API viewer to get help on DLL procedures
Object Linking and Embedding • OLE allows you to link or embed objects from another application into VB project • Linking: access object maintained by another program; shared object stored elsewhere • Embedding: object and ref. to application managing object are stored in your project
Visual Basic for Applications (VBA) • Microsoft office products include VBA for writing procedures to automate office applications (Excel, Word, etc.) • Record Excel macros that accomplish a series of steps • Macros are stored as VBA code • Open code and inspect it
Multiple Document Interface (MDI) • MDI interface is one in which several child forms can be open with a larger, parent form • Word and Excel both are examples of MDI • You can open, close, and resize each child window (form)
Defining Shortcut Menus • Create shortcut menus (right-click accessible menus) with the Menu Editor • Clear the visible checkbox of a shortcut menu so it is invisible until the user calls for it • Code is required to display the shortcut menu
The Report Designer • VB’s Report Designer creates a printed report • Reports based on a database use the Data Environment • Once created, use Show to display it on screen or print it with the PrintReport method • A report design is its template