Re: How are the icons in windows explorer made
Adrian Buehlmann <[email protected]>
| Newsgroups | gmane.comp.version-control.cvs.tortoisecvs.user |
|---|---|
| Message-ID | <[email protected]> |
On 05.08.2009 17:03, Marc Wentink wrote: > How does tortoiseCVS change the icons, how does it add CVS icons in the > right lower corner of a pictogram representing the file in the windows > explorer? > > I am asking this since a customer wants something like that, and I > thought of tortoiseCVS as a program where something similar is done. > Sorry for the strange question, but if somebody has a hint, please let > me know. I want to add a ‘tortoiseCVS’ like icon to a file pictogram, if > the file is used by an application the customer is using. > > Any help welcome. If you really want to go this route: See "Creating Icon Overlay Handlers:" (aka shell extensions) http://msdn.microsoft.com/en-us/library/bb776858(VS.85).aspx But there is a very important caveat: (Quoting from msdn page above): ''' Note The number of different icon overlay handlers that the system can support is limited by the amount of space available for icon overlays in the system image list. There are currently fifteen slots allotted for icon overlays, some of which are reserved by the system. For this reason, icon overlay handlers should be implemented only if there are no satisfactory alternatives. ''' Because of the very limited number of slots, the tortoise* projects (I know at least TortoiseHg and TortoiseSVN) share a common component, namely the TortoiseOverlays, provided by the TortoiseSVN project. TortoiseOverlays is available from http://tortoisesvn.tigris.org/svn/tortoisesvn/TortoiseOverlays/ (log in as user "guest", leave password empty). Strongly recommended read: http://tortoisesvn.tigris.org/svn/tortoisesvn/TortoiseOverlays/version-1.0.7/Documentation.txt Installers are in: http://tortoisesvn.tigris.org/svn/tortoisesvn/TortoiseOverlays/version-1.0.7/bin/ Before TortoiseOverlays was used, the Tortoise* projects conflicted with each other on the overlay handler slots. Now, TortoiseHg and TortoiseSVN share the same slots (apologies, I've only hacked on TortoiseHg so I don't know if TortoiseCVS is using TortoiseOverlays as well). And you really need to know what you do, since you will have to implement the shell extension dll in C++, which has the potential to tear down explorer as it is loaded in to the process space of explorer. Of course, you need to understand COM programming, too. (Customers tend to get highly confused if their explorer crashes.) Also make you sure you carefully test your extension on all relevant Windows versions: Windows XP, Windows Vista, Windows 7. And you need to think about providing 32bit and 64bit versions of your shell extension dll, since on the 64bit versions of Windows, explorer is 64bit as well and thus needs a 64bit shell extension dll. If that's not enough, you should know that explorer of vista (and Windows 7) calls the overlay handlers on multiple threads. So your code must be multi thread safe. Last but not least the overlay handler shell extensions are loaded into the address space of every application (Word, Excel, etc.!) as soon as it fires up an open file dialog. So you can crash (and slow down) all applications as well. You should also make sure that your shell extension is fast enough, as it slows down explorer (and applications open file dialog, which has a very high potential to annoy users. Still think this is is good idea? Good luck then :) In other words: think twice before doing it. ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july