hiltmaster.blogg.se

Shell extension for flame painter
Shell extension for flame painter




shell extension for flame painter
  1. SHELL EXTENSION FOR FLAME PAINTER CODE
  2. SHELL EXTENSION FOR FLAME PAINTER WINDOWS

add entry only if the program is running IndexMenu, idCmdFirst, idCmdLast, uFlags: UINT): HResult The result of the function is the number of items added to the menu:įunction TToDoMenu.Quer圜ontextMenu(Menu: HMENU

shell extension for flame painter

We can determine this by searching for a window corresponding to the TToDoFileForm class, which should be unique in the system. In this case, we add a new menu item (calling the InsertMenu API function) only if the ToDoFile application is running. The first method, Quer圜ontextMenu, is used to add new items to the local menu of the file. We can now look at the methods of the IContextMenu interface. Any selection of multiple files is not accepted. This complex way of coding is actually the simplest one you can use! At the end of this operation, we have the value of the file name. The initial portion of the method transforms the pointer to the IDataObject interface, which we receive as a parameter, into the same data structure used in a file drop operation, so that we can read the file information by using the DragQueryFile function again. If DragQueryFile (medium.hGlobal, $FFFFFFFF, nil, 0) = 1 thenĭragQueryFile (medium.hGlobal, 0, PChar (fFileName), 1000) transform the lpdobj data to a storage medium structure Lpdobj: IDataObject hKeyProgID: HKEY): HResult stdcall Let’s examine the InitShellExt method first it is definitely the most complex one:įunction TToDoMenu.InitShellExt(pidlFolder: PItemIDList The reason is that I wanted to avoid confusion with the Initialize method of the TComObject base class, which is the hook we have to initialize the object, as described earlier in this chapter. Notice that the class implements the Initialize method of the IShellExtInit interface with a differently named method, InitShellExt. PszName: LPSTR cchMax: UINT): HResult stdcall įunction IShellExtInit.Initialize = InitShellExt įunction InitShellExt (pidlFolder: PItemIDList lpdobj: IDataObject This is the resulting definition of the COM server object class:įunction Quer圜ontextMenu(Menu: HMENU indexMenu, idCmdFirst, idCmdLast,įunction InvokeCommand(var lpici: TCMInvokeCommandInfo): HResult stdcall įunction GetCommandString(idCmd: UINT_PTR uFlags: UINT pwReserved: PUINT The first interface defines specific actions for the context menu, such as defining the number of menu items to add and their text, while the second interface defines a way to access the file or files the user is operating on. A context-menu COM object must implement two different interfaces, IContextMenu and IShellExtInit. Technically, a context menu is a COM server exposing an internal object that is going to be created and used by the system.

SHELL EXTENSION FOR FLAME PAINTER WINDOWS

A context-menu extension is one of the available Windows shell extensions and is activated every time a user right-clicks a file in the Windows Explorer (given the file extensions is associated with the shell extension). Once you have the base program running, you can add a shell extension to the system to let the user simply select a file and “send” it to the application without having to do the dragging operation, which is not always handy when there are many programs running. Here is the dmeo in action, with the active shell extension additional menu item and the target application: In fact, users should not be able to create new records except by dragging a file onto the form (a portion of the program I'm not going to discuss here, as it doesn't related with COM support) or by using an extra Explorer menu. The DBGrid is set up as a read-only component. The form has a DBGrid component showing only a single column containing the filenames and a memo control hosting the notes related to the current file. It has a simple database table storing filenames and notes about these files. The program in question is a “to-do” application tied to files. You've likely seen applications that adds themselves in Explorer, we can use Delphi to do the same. In other words, you can write a COM object (part of an ActiveX or COM library) and register it in the system as a shell extensions. Windows Resource Explorer Extensions, or Shell Extensions, are in-process COM objects that implement given interfaces.

SHELL EXTENSION FOR FLAME PAINTER CODE

In any case, resources for the skill sprint (including video reply) are at  and the code download is at. Not really a new concept, but worth sharing. This is a technical article covering the content of my last week skill sprint about Writing Windows Shell Extensions in Delphi.






Shell extension for flame painter