Código Delphi [-] //************************************************************* //************************************************************* // TSHChangeNotify component by Elliott Shevin shevine@aol.com // vers. 3.0, October 2000 // // See the README.TXT file for revision history. // //* //* I owe this component to James Holderness, who described the //* use of the undocumented Windows API calls it depends upon, //* and Brad Martinez, who coded a similar function in Visual //* Basic. I quote here from Brad's expression of gratitude to //* James: //* Interpretation of the shell's undocumented functions //* SHChangeNotifyRegister (ordinal 2) and SHChangeNotifyDeregister //* (ordinal 4) would not have been possible without the //* assistance of James Holderness. For a complete (and probably //* more accurate) overview of shell change notifcations, //* please refer to James' "Shell Notifications" page at //* http://www.geocities.com/SiliconValley/4942/ //* //* This component will let you know when selected events //* occur in the Windows shell, such as files and folders //* being renamed, added, or deleted. (Moving an item yields //* the same results as renaming it.) For the complete list //* of events the component can trap, see Win32 Programmer's //* reference description of the SHChangeNotify API call. //* //* Properties: //* MessageNo: the Windows message number which will be used to signal //* a trapped event. The default is WM_USER (1024); you may //* set it to some other value if you're using WM_USER for //* any other purpose. //* TextCase: tcAsIs (default), tcLowercase, or tcUppercase, determines //* whether and how the Path parameters passed to your event //* handlers are case-converted. //* HardDriveOnly: when set to True, the component monitors only local //* hard drive partitions; when set to False, monitors the //* entire file system. //* //* Methods: //* Execute: Begin monitoring the selected shell events. //* Stop: Stop monitoring. //* //* Events: //* The component has an event corresponding to each event it can //* trap, e.g. OnCreate, OnMediaInsert, etc. //* Each event handler is passed either three or four parameters-- //* Sender=this component. //* Flags=the value indentifying the event that triggered the handler, //* from the constants in the SHChangeNotify help. This parameter //* allows multiple events to share handlers and still distinguish //* the reason the handler was triggered. //* Path1, Path2: strings which are the paths affected by the shell //* event. Whether both are passed depends on whether the second //* is needed to describe the event. For example, OnDelete gives //* only the name of the file (including path) that was deleted; //* but OnRenameFolder gives the original folder name in Path1 //* and the new name in Path2. //* In some cases, such as OnAssocChanged, neither Path parameter //* means anything, and in other cases, I guessed, but we always //* pass at least one. //* Each time an event property is changed, the component is reset to //* trap only those events for which handlers are assigned. So assigning //* an event handler suffices to indicate your intention to trap the //* corresponding shell event. //* //* There is one more event: OnEndSessionQuery, which has the same //* parameters as the standard Delphi OnCloseQuery (and can in fact //* be your OnCloseQuery handler). This component must shut down its //* interception of shell events when system shutdown is begun, lest //* the system fail to shut down at the user's request. //* //* Setting CanEndSession (same as CanClose) to FALSE in an //* OnEndSessionQuery will stop the process of shutting down //* Windows. You would only need this if you need to keep the user //* from ending his Windows session while your program is running. //* //* I'd be honored to hear what you think of this component. //* You can write me at shevine@aol.com. //************************************************************* //************************************************************* { ******************************************** Zarko Gajic About.com Guide to Delphi Programming http://delphi.about.com email: delphi.guide@about.com free newsletter: http://delphi.about.com/library/blnewsletter.htm forum: http://forums.about.com/ab-delphi/start/ ******************************************** }
//************************************************************* //************************************************************* // TSHChangeNotify component by Elliott Shevin shevine@aol.com // vers. 3.0, October 2000 // // See the README.TXT file for revision history. // //* //* I owe this component to James Holderness, who described the //* use of the undocumented Windows API calls it depends upon, //* and Brad Martinez, who coded a similar function in Visual //* Basic. I quote here from Brad's expression of gratitude to //* James: //* Interpretation of the shell's undocumented functions //* SHChangeNotifyRegister (ordinal 2) and SHChangeNotifyDeregister //* (ordinal 4) would not have been possible without the //* assistance of James Holderness. For a complete (and probably //* more accurate) overview of shell change notifcations, //* please refer to James' "Shell Notifications" page at //* http://www.geocities.com/SiliconValley/4942/ //* //* This component will let you know when selected events //* occur in the Windows shell, such as files and folders //* being renamed, added, or deleted. (Moving an item yields //* the same results as renaming it.) For the complete list //* of events the component can trap, see Win32 Programmer's //* reference description of the SHChangeNotify API call. //* //* Properties: //* MessageNo: the Windows message number which will be used to signal //* a trapped event. The default is WM_USER (1024); you may //* set it to some other value if you're using WM_USER for //* any other purpose. //* TextCase: tcAsIs (default), tcLowercase, or tcUppercase, determines //* whether and how the Path parameters passed to your event //* handlers are case-converted. //* HardDriveOnly: when set to True, the component monitors only local //* hard drive partitions; when set to False, monitors the //* entire file system. //* //* Methods: //* Execute: Begin monitoring the selected shell events. //* Stop: Stop monitoring. //* //* Events: //* The component has an event corresponding to each event it can //* trap, e.g. OnCreate, OnMediaInsert, etc. //* Each event handler is passed either three or four parameters-- //* Sender=this component. //* Flags=the value indentifying the event that triggered the handler, //* from the constants in the SHChangeNotify help. This parameter //* allows multiple events to share handlers and still distinguish //* the reason the handler was triggered. //* Path1, Path2: strings which are the paths affected by the shell //* event. Whether both are passed depends on whether the second //* is needed to describe the event. For example, OnDelete gives //* only the name of the file (including path) that was deleted; //* but OnRenameFolder gives the original folder name in Path1 //* and the new name in Path2. //* In some cases, such as OnAssocChanged, neither Path parameter //* means anything, and in other cases, I guessed, but we always //* pass at least one. //* Each time an event property is changed, the component is reset to //* trap only those events for which handlers are assigned. So assigning //* an event handler suffices to indicate your intention to trap the //* corresponding shell event. //* //* There is one more event: OnEndSessionQuery, which has the same //* parameters as the standard Delphi OnCloseQuery (and can in fact //* be your OnCloseQuery handler). This component must shut down its //* interception of shell events when system shutdown is begun, lest //* the system fail to shut down at the user's request. //* //* Setting CanEndSession (same as CanClose) to FALSE in an //* OnEndSessionQuery will stop the process of shutting down //* Windows. You would only need this if you need to keep the user //* from ending his Windows session while your program is running. //* //* I'd be honored to hear what you think of this component. //* You can write me at shevine@aol.com. //************************************************************* //************************************************************* { ******************************************** Zarko Gajic About.com Guide to Delphi Programming http://delphi.about.com email: delphi.guide@about.com free newsletter: http://delphi.about.com/library/blnewsletter.htm forum: http://forums.about.com/ab-delphi/start/ ******************************************** }