3.5 The Shell Extension Project

only for RuBoard - do not distribute or recompile

3.5 The Shell Extension Project

All of the handlers that we will implement will be contained in a single ActiveX DLL project called RadEx . A stub project with the appropriate settings is included with the book's downloadable code for this chapter. The project is an ActiveX DLL project set for Apartment threading (see Appendix A ), which is a requirement for shell extensions. The component will not load if this is not set. That's all there is to it; there is nothing more to the project.

Registering Components the Easy Way

The easiest way to register components is to associate DLL files with regsvr32.exe . This simplifies component registration to a double click.

If the .dll file type is currently not associated with any program, you can make this association yourself by simply double-clicking on any .dll file in the shell. This action displays the Open With dialog box, which will allow you to select a program for association. Just navigate to regsvr32.exe , which is located in your system directory.

If you want to be really hard- core about it, you can add the keys for the association yourself into the registry. This information is placed under the application identifier for .dll files, which happens to be called dllfile , as illustrated in Figure 3.8.

Of course, the path to regsvr.exe might be different on your machine. Notice the %1 on the command line. This will be replaced by the name of the DLL that is being registered.

The source code that is provided with this chapter in the book's sample code serves as a template for future chapters. As the book progresses, the downloadable code for each subsequent chapter will contain source for the extensions created up to that point and an accompanying DLL. This is only to provide Binary Compatibility and keep the GUIDs referred to in this book the same as the GUIDs on your system. Remember, since each chapter contains a new component, it will have to be registered.

Figure 3.8. Associating regsvr32.exe with the dllfile file type

A type library containing all the interfaces you will need is included with the source code for the book, which is available for download from http://vb.oreilly.com. It will be necessary to add a reference to this library for each of the projects we will build in the book. The complete listing for this type library is also provided in Appendix A.

Unfortunately, MKTYPLIB does not allow IDL files to be included within other IDL files. Therefore, all our interfaces are defined within one file, called vbshell.idl . This makes for one really gigantic file, but the interfaces will be listed in alphabetical order. It should be fairly simple to navigate the file to examine its contents.

Incidentally, since vbshell.idl defines all of the interfaces used in building shell extensions, it will remain a valuable resource long after you've finished reading this book. You can continue to use it to access information about interfaces and their methods from Visual Basic for all of the shell extensions you build.

only for RuBoard - do not distribute or recompile

Visual Basic Shell Programming
Visual Basic Shell Programming
ISBN: B00007FY99
Year: 2000
Pages: 128

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net