In: Categories » » Windows registry » Visual Basic controls were the first generation of ActiveX controls
VBX controls, or Visual Basic controls, were the first generation of ActiveX controls. When VBX controls were first developed, they served in dialog boxes as custom controls, things such as progress bars, and so on. Generally, a VBX control doesn't handle data, while an ActiveX control might. In addition, only Visual Basic was able to easily create VBX controls. Programmers who developed in C/C++, for example, had difficulty creating their own VBX controls. However, Microsoft eventually developed a system to create VBX controls using development platforms other than Visual Basic. Microsoft also realized that the concept of VBX (embeddable controls) was a good one, and that these controls were here to stay. In came the OCX (OLE Control) technology; it was development-platform independent, usage-platform independent, and more flexible. Evolution and the name game reared their heads again. Microsoft moved to ActiveX controls more as a change in name than in function. It is common to see ActiveX controls referred to as OCX controls, and vice versa. Some ActiveX controls display data. Some don't do anything other than provide some form of user interface. For example, these controls were on one of my computers:
• BtnMenu Object
• CarPointProximityCtrl
• ChatShowClt Object
• DirectAnimation Java Classes
• HHCtrl Object
• Internet Explorer Classes for Java
• IPTDImageControl.Slmage
• Label Object
• Microsoft MSChat Control Object
• Microsoft Search Settings Control
• Microsoft XML Parser for Java
• PopupMenu Object
• Win32 Classes
All of these controls were installed in the %SystemRoot%\Occache directory. If you are not using Internet Explorer or are not active on the Internet, you probably won't have many of these controls. Note If you don't find an Occache directory, don't panic. It is probably because you don't have any ActiveX controls installed on your computer!
Liar, Liar, Pants on Fire!
Remember when I said previously that OLE controls don't have a user interface? Well actually, I lied a little. It is possible to use RunDll32 to execute some OLE controls. RunDll32 doesn't have a user interface either, and any control that works with RunDll32 must be written specifically for this type of usage. For example, the OLE Active Movie control will run with the command:
%SystemRoot%\System32\rundll32.exe amovie.ocx,RunDll
This opens the Active Movie OLE control (RunDll provides a main window for the control), and Active Movie then displays an Open File dialog box. You might select an Active Movie file (try clock.avi in Windows XP's %SystemRoot% directory) and run it using amovie.ocx. This is possible because Active Movie was written to work with RunDll, and as such, it works. Try this trick with most any other OLE control, and you will get the message, "Missing entry point RunDll," which indicates that the entry point passed in the command was not found. Oh, yes, you can also pass parameters to your OLE control with the command:
RunDll:%SystemRoot%\System32\rundll32.exe amovie.ocx,RunDll %SystemRoot%\clock.avi
This command loads Active Movie, loads clock.avi, and allows the user to interact with the control. Try it. Better yet, try this:
%SystemRoot%\System32\rundll32.exe amovie.ocx,RunDll /play /close %SystemRoot%\clock.avi
Don't mistakenly insert spaces between the executable file (amovie.ocx in the previous example), the comma, and the entry point (RunDll in the previous example). This will break RunDll without telling you why it failed. Get the hint? I passed a parameter to the Active Movie control to play the clock.avi file and then close it when the .avi file is finished. Active Movie loaded the file specified, played the file, and closed it-all without user intervention. Oh, don't blame me if the clock.avi file is a bit annoying. Actually, RunDll will run more than OLE controls-RunDll will (or will at least attempt to) execute any executable file, including DLL (Dynamic Link Library) and EXE (executable) files. This is true as long as you know the file's entry point and the file to be executed follow the RunDll protocol. For more information, see Microsoft Knowledge Base article Q164787, which can be viewed at http://support.microsoft.com/default.aspx?scid=kb;EN-US;q164787.
Though originally written for Windows 95/98, it has been updated to include support for Windows XP users. Note Don't have amovie.ocx? This control is part of many versions of Microsoft Internet Explorer. Virtually all Windows 9x or Windows 2000 computer have a copy that you can use. You can download from Microsoft; however, the amovie.ocx file is combined with an earlier version of Microsoft Internet Explorer.
Client-Server OLE Applications
Client-server OLE applications make up a substantial number of programs on most Windows computers. Even though the user may not be aware of which client-server OLE applications are installed, there are many. One of the best-designed and best-integrated sets of applications is Microsoft Office, currently released as Office XP. Note Office XP is really Office, version 10. Microsoft has not used the version number as part of the product name for some time. However, many of Office's registry entries and file/folder names use the version number. Just remember that Office XP is Office version 10 (and Office 2000 is Office version 9). Office XP combines word processing (Word XP for Windows), spreadsheets (Excel XP), a database system (Access XP), a presentation program (PowerPoint XP), and a host of utilities (such as Chart). Each of the main applications in Microsoft Office works as both a client and a server application. Some applications-such as the Word Art and Chart utilities-are not designed to run as simple clients. For example, take Word XP (a program that at least I know how to use). Word, as a client is . . . Word. Open Word and edit a document. Write a short letter to someone-it doesn't matter whom. Create something, about a page long, three or four paragraphs. You have Word's functionality in all these paragraphs; you did everything using Word and nothing else. Now things start to get exciting. Insert an object. For grins, insert a drawing into a Word document. Click Insert → Object. Word displays the Object dialog box that lists all the embeddable OLE server objects (see Figure 6.1). Actually, OLE uses an API call to display the dialog box.
Some servers work by totally embedding themselves into Word. For example, Microsoft Photo Editor is called to edit (or select, if you are creating a new object) the picture you have inserted. With Office XP, Word does not embed the server, rather the server is called as a separate process. Word XP displays the standard picture toolbar, and you may edit the picture either by selecting Edit → Photo Editor Photo Object → Edit or by simply double-clicking the image. (I'm jumping ahead some here, but notice how Figure 6.3 shows Word XP with the image of Figure 6.2 embedded as a Microsoft Photo Editor object.)
It is quite incredible that Microsoft Photo Editor (or any other object server, for that matter) works without Microsoft Word having prior knowledge of it. Actually, select (double-click the object, for example) a Microsoft Photo Editor object, and Word gives control to Microsoft Photo Editor. Microsoft Photo Editor then displays its own window along with Word's window, so that the user can switch between the Word document and the object as necessary-I use this same process while I write. When the Microsoft Photo Editor object is not selected, Word allows normal operation (see Figure 6.2). You do context-switching between Word and Microsoft Photo Editor whenever you select something in the document. If your selection is a Microsoft Photo Editor object (see Figure 6.3), Microsoft Photo Editor is put in control; otherwise, Word takes control. A lot of magic goes on behind the scenes here. When saving a complex document containing OLE objects, the objects' servers save the OLE objects when and where instructed to do so by Word. Oops, topic-drift. I'm trying to make everyone an OLE expert. Let's see if I can wrap this up in a nutshell, then connect everything with the registry. So, in a nutshell:
• Client applications may have OLE objects embedded into their documents, and/or have OLE server functionality embedded into their basic functionality.
• This embedding is done at runtime, so the developer knows nothing about what embedding will be done when the program is being written.
• When a client application wants to embed an OLE object, the client application calls OLE to display the Insert Object dialog box to the user. The user then selects the embedded object.
• By selecting the object, OLE allows the client's user interface (menus and toolbars, for example) to be turned over to the server application.
• Server applications may edit the object in place, or may create a special editing window, which may have menu/toolbar support, as appropriate. Usually, complex objects have their own windows for editing just to keep things simpler for the user.
• OLE uses the registry to learn about embeddable server applications.
• OLE server and client applications are identified by CLSIDs; call 'em UUIDs, or GUIDs, if you want. A CLSID is a unique long string of numbers.
• The server application is able to use OLE to tell the client what capabilities the server has. This allows the client to behave in a predictable manner. Note It is possible to embed a purely functional OLE object into a document. From time to time with database programming, OLE controls (ActiveX) and OLE applications (without instance-specific data, such as Microsoft Calendar Control 10.0) are used. OK, I've prattled on about OLE long enough (is that a wild cheer I hear?), so let's get to the registry component of OLE.
legal notice
Our website is not responsible for the information contained by this article. Web-articles is a free articles resource.
Suggestion: If you need fresh, daily updated content for your website, feel free to use our service. Click here for more information.
Useful tools and features
related articles
Recovering a Copied Registry A registry that has been backed up using copy or xcopy is restored in the opposite manner from which it was backed up. For example, if you have the NTFS file system, then you have to restart the system using your backup copy of Windows XP. FAT and NTFS When restoring a registry on a FAT-based file system running Windows XP, it's necessary to boot DOS, Windows 95/98/Me, or a second copy of Windows XP. If you have a dual-boot installed (either DOS or Windows 95/98/M...
2. The Windows XP Recovery Console is a tool that allows recovery
The Recovery Console The Windows XP Recovery Console is a tool that allows recovery from a number of failures. Previously, all you could do was boot another copy of Windows XP and hack your way around, replacing files, even registry components, in the blind hope that you would somehow fix the problem. With Windows XP, you have two tools to use: the Recovery Console and the Safe Mode feature. The Recovery Console is a powerful, simple (no, that's not an oxymoron!) feature that is supplied with Windows XP, but it i...
3. What the registry is and the terminology used for its various components
Anatomy of the Registry–The Blood, Gore, and Guts Overview In tutorial 1, we talked a little about what the registry is and the terminology used for its various components. In tutorial 2, we covered backing up and restoring the registry. In this tutorial, we will get into more of the details of what actually is in the registry. If you're only interested in how to use (or recover) the registry, but not what the registry is, it's possible to skip this tutorial. However, if you're unsure about this,...
4. The current control set is copied into the Last Known Good control set
When Is the Current Control Set the Last Known Good Control Set? At some point in the boot process, the current control set is copied into the Last Known Good control set. In Windows XP, the process of replacing the Last Known Good control set is done after the initial logon is performed. This allows the system to catch any problems related to the logon process. HKEY_USERS: Settings for Users Let's take a closer look at SIDs. No, despite what you may think, SID is not the kid down the street;...
5. Windows XP uses only one registry editor
Registry Tools and Tips–Getting the Work Done Overview Windows XP uses only one registry editor. Gone are the separate RegEdit and RegEdt32 editors that existed in Windows 2000. No matter which command you enter in Windows XP, RegEdt32 or RegEdit, the same program (RegEdit, which is called the Registry Editor) will run. Windows XP also has a utility called REG that is included as part of the system installation no more needing to install a separate Resource Kit. This tool is run at the comman...
6. The Registry Editor allows you to quickly create
Creating, Renaming, and Deleting Entries The Registry Editor allows you to quickly create, delete, or rename an entry. Entries may consist of keys, subkeys, or value entries. Creating a New Key You can quickly create a new key by following these steps: 1. Select the hive or key in which the new key is to be created. Either right-click the object or select Edit → New, and then select the type of object to create. 2. The Registry Editor creates the new subkey, giving it a default name of N...
7. The Registry Editor may be used from the command line
Using the Registry Editor from the Command Line The Registry Editor may be used from the command line, without user interaction. The commands that the Registry Editor uses include those described below. (Note that not all commands may be available under all operating systems.) • To import a registry file into the Registry Editor: REGEDIT [/L:system] [/R:user] filename1 • To create a registry object from a file: REGEDIT [/L:system] [/R:user] /C filename2...
8. Several tips come to mind when using the Registry Editor
Tips for Registry Editor Users Several tips come to mind when using the Registry Editor: • First, when saving a hive using Save Key (under the Registry menu), make absolutely sure that the filename saved to is descriptive enough to enable the successful restoration of the hive at a later time. The Registry Editor doesn't check whether a hive being restored is the same hive as the one being replaced. • Second, as with the Registry Editor, be aware that printing can create reports of incredible s...
9. The export function invoked with the command reg export
Export The export function, invoked with the command reg export, exports the registry object specified to a disk file. The object may be a single-level key, such as HKLM\TEMP. Parameters include the name of the key to export and the name (qualified as necessary) of the file to export to. Export is only allowed on the local machine. The command line for export is: REG EXPORT keyname filename As with other registry tools, the registry path to be queried may be a ROOTKEY or a hive, ...
10. Installing Remote Registry Editing on Windows 95
Installing Remote Registry Editing on Windows 95, Windows 98, and Windows Me Note This section addresses the concerns of system administrators working in mixednetworking environments. Though Windows NT Workstation and Windows 2000 Professional have remote registry editing installed already, Windows 95, 98, and Me do not. The installation process is similar on both operating systems, though the source of the necessary drivers differs with each version. You have to install a network service to enable remote regis...
