Use Delphi to write Windows shell extensions

Source: Internet
Author: User
Tags ftp ftp site object model

Friends who know more about operating system principles will know that a complete operating system provides a shell (shell) to make it easier for ordinary users to use the various features provided by the operating system. Windows (here refers to the Windows 95\windows NT4.0 version of the operating system) shell not only provides a convenient GUI graphical interface, but also provides a powerful shell expansion features, you may see in many software these shell extensions. For example, if you have WinZip installed in your system, when you right-click a folder or file in Windows Explore, a WinZip compression menu appears in the pop-up menu. or the FTP site folder that appears in Windows Explorer in bullet FTP. Windows supports seven types of shell extensions (called handler), and their corresponding roles are summarized as follows:

(1) Context menu handlers: Add context-sensitive menus to specific types of file objects;

(2) Drag-and-drop handlers is used to support OLE data transfer when a user drags and puts on a type of file object;

(3) Icon handlers is used to provide a specific icon to a file object, but also to a certain type of file objects to specify icons;

(4) Property sheet handlers to the file object Add Properties page (that is, right click on the file object or folder object, in the pop-up menu after the selection of Property Items dialog box), the property page can be common to the same class file objects, or to a file object to specify a specific property page;

(5) Copy-hook handlers can be invoked by the system when a Folder object or printer object is copied, moved, deleted, and renamed, allowing or prohibiting certain operations by adding Copy-hook handlers to Windows;

(6) The drop target handlers is called by the system when an object is dragged onto another object;

(7) The data object handlers is called by the system when the file is dragged, copied, or pasted.

All of Windows's shell extensions are based on the COM (Component Object model) component, and the shell accesses the object through an interface (interface). The shell extension is designed as a 32-bit process server program and is serviced by the operating system in the form of a dynamic-link library. Therefore, if you want to expand the user interface of Windows, it is necessary to have some knowledge of writing COM objects. Because of space limitations, COM is not introduced here, readers can refer to Microsoft's MSDN Library or related Help documents, an interface can be seen as a special class, it contains a set of functions can be used to manipulate an object. After you have written the Shell extender, you must register them to take effect. All shell extensions must be registered under the HKEY_CLASSES_ROOT\CLSID key in the Windows registry. There are a number of key names like {0000002f-0000-0000-c000-000000000046} that can be found below the key, which is the globally unique class identifier (GUID). Each shell extension must have a globally unique class identifier, which Windows uses to find the shell extension handler by using this unique class identifier.

The position of the shell expansion dynamic-link library in the system is recorded under the InprocServer32 subkey under the class identifier. The shell extension associated with a file type is registered under the ShellEx primary key of the corresponding type. If the Windows operating system is in Windows NT, the shell extension must also be hkey_local_machine\software\microsoft\windows\currentversion\ in the registry Shellextensions\approved is registered under the primary key. After you compile the shell extension DLL program, you can register the DLL server program with the Regsvr32.exe provided by Windows itself. If you use Delphi, you can also register by selecting Register ActiveX Server in the Run menu.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.