0% found this document useful (0 votes)
33 views

Chapter 15-Advanced Topics in Visual Basic: 1. What Is An Activex Control? Give An Example

This document contains answers to review questions about advanced topics in Visual Basic, including ActiveX controls, DLLs, APIs, the Declare statement, passing arguments by value or reference, linking vs embedding objects, MDI forms, and creating parent and child forms. ActiveX controls allow reuse of objects across applications and some common examples are provided. DLLs store commonly used procedures that can be called from projects. The API uses Windows DLLs. Declare statements specify how to call procedures from other libraries. Arguments are passed by value or reference, with strings typically passed by value for Windows APIs. Linking accesses objects maintained elsewhere while embedding stores objects within the project. The types of objects available are determined by installed applications. MDI

Uploaded by

Vishal Rane
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views

Chapter 15-Advanced Topics in Visual Basic: 1. What Is An Activex Control? Give An Example

This document contains answers to review questions about advanced topics in Visual Basic, including ActiveX controls, DLLs, APIs, the Declare statement, passing arguments by value or reference, linking vs embedding objects, MDI forms, and creating parent and child forms. ActiveX controls allow reuse of objects across applications and some common examples are provided. DLLs store commonly used procedures that can be called from projects. The API uses Windows DLLs. Declare statements specify how to call procedures from other libraries. Arguments are passed by value or reference, with strings typically passed by value for Windows APIs. Linking accesses objects maintained elsewhere while embedding stores objects within the project. The types of objects available are determined by installed applications. MDI

Uploaded by

Vishal Rane
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

CREATED BY: VISHAL RANE

July 16, 2010

Chapter 15-Advanced Topics in Visual Basic


ANSWERS TO REVIEW QUESTIONS

1. What is an ActiveX control? Give an example. ANS:The term ActiveX was originally used to refer to controls that could be used with the Internet. Since then the term has been expanded to refer to executable files, controls (COM or Component Object Model objects), and DLLs that are used by multiple applications. These controls were called OLE controls for a period of time, but the term OLE currently refers only to the process of object linking and embedding. The terminology has been changing rapidly and likely will change somewhat in the next few years as the use of the Internet expands. In general, Microsoft refers to any controls as ActiveX controls. These controls may be part of Visual Basic, created by other companies, or you may create your own. The controls that are part of Visual Basic are called intrinsic controls; those that must be added later are called components. There is a large selection of ActiveX controls available, to solve many problems. You can purchase controls to display various types of gauges and indicators, display data in grids, send and receive faxes, display video, scan bar codes, display calendars and appointments, and perform many other functions. Many ActiveX controls are available as shareware, and a few are freeware. Many can be downloaded from a variety of web sites. The files for ActiveX controls have extensions of .ocx or .vbx. (Any controls developed for Visual Basic 4.0 or later should be .ocx files.)

CREATED BY: VISHAL RANE

July 16, 2010

2. What is a DLL? ANS:Windows uses dynamic link libraries (DLLs) to store collections of commonly used procedures. This means that functions available in Windows but not available in Visual Basic can still be used. As a project executes, it can call procedures from the libraries. The DLL file is then linked to your project when it runs. This is especially useful for procedures used by multiple projects; only one copy of the library is kept in memory and its procedures can be called by more than one project. 3. What does API mean? ANS:API is the Windows application programming interface. API uses Windows DLLs for such tasks as moving and resizing windows. Visual Basic uses many API DLLs to create the Visual Basic environment.

4. What are the purposes of a Declare statement? ANS:Any time you will call a procedure which is in a library, a DLL, you must include a Declare statement. Declare statements tell Visual Basic the name of the procedure and the library where it can be found, along with the arguments needed by the procedure. Once you have included the Declare, you can call the procedure as you would one of your own. You can call both sub procedures and function procedures from DLLs; the Declare statement specifies the type of procedure. (Recall that a function returns a value.) 5. Explain the difference between ByVal and ByRef. When is each used? ANS:Arguments may be passed to a called procedure by value or by reference. When passed ByVal, only a copy of the original value is passed; the called procedure cannot alter the original value. When items are passed ByRef, the memory address of the original value is passed to the procedure, allowing the procedure to change the original value. You will pass ByVal or ByRef based upon the requirements of the specific DLL. If no specification is made, the default ByRef is implied. When you are calling Windows API procedures, always declare a string

CREATED BY: VISHAL RANE

July 16, 2010

argument ByVal. (DLLs are usually written in the C language and Visual Basic and C do not store strings in the same way.) 6. Explain the difference between linking and embedding an object into a Visual Basic project. ANS:Linking causes your program to access an object that is actually maintained by the application that creates it. A reference to the linked object is kept in your code but the actual object is kept in the other application. This means that any other application that has linking ability can access the linked object and change it. When your application runs you can access the current state of the object. Embedding places the object in your code. Hence, the object is maintainable only from within your project and cannot be accessed by other projects. Another result of embedding is that the Visual Basic project file becomes significantly larger because of the embedded code. 7. What determines the list of objects that can be used with OLE on a particular system? ANS:You can create your own objects or access those available through word processors, spreadsheets, graphics programs, and the multitude of software available. Of course, the types of objects available to use in a project depend upon the applications that are installed on a particular computer system or network. 8. What does MDI mean? ANS:MDI is an acronym for multiple document interface. An example of MDI would be an application such as Microsoft Word. Word has a parent form (the main window) and child forms (each document window).

CREATED BY: VISHAL RANE

July 16, 2010

9. What are the advantages of having parent and child forms? ANS:You can open multiple child windows, maximize, minimize, restore, or close each child window, which always stays within the boundaries of the parent window. When you close (unload) the parent window, all child windows close (unload) automatically. 10. How can a child form be created? parent form? ANS:Setting the MDIChild property of a form to True will create a child form. Any form that is not set as a child form will operate independently and will not be confined to the parent window. To add an MDI (parent) form to a project, choose Project / Add MDI Form. Only one form in a project can be set as the parent.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy