Archive

Author Archive

First public release of DiskWave

March 12th, 2010

I have not been blogging a lot lately. The truth is that I have been busy coding.

WhichSize DiskWave is a freeware for MacOS X 10.6 (hence Intel Macs only for now) that can recursively size the directories on your drive. This allows to quickly identify and reclaim wasted space.

It is freely available here: http://diskwave.barthe.ph/

DiskWave was basically hacked in a weekend, but this is not a new idea. I already worked on a similar project, back in 2004, after discovering OmniDiskSweeper. I was appalled by the terrible performance of OmniDiskSweeper and quickly realized I could do a better job. So I learned Cocoa, ObjectiveC, the Carbon APIs, and came up painfully with a prototype only to discover that another software named WhatSize was free and worked very well. I also had a tricky memory leak due to a bug in Cocoa API.  So I quitted.

Fast forward to 2010. OmniDiskSweeper is no longer a shareware, but its performance is still bad.  WhatSize is no longer a freeware. The old freeware version of WhatSize I have is a PowerPC version, but since I moved to Snow Leopard, I felt like I did not want to install Rosetta. So here is DiskWave.

So this time, I did my homework, and it does not look like there is a suitable alternative. Here is the list of similar tools (on MacOS X) I came up with:

  • OmniDiskSweeper.
    • Freeware (formerly shareware)
    • Slower because it relies on Cocoa APIs. It also consumes a lot of memory.
    • Does not have many more features than DiskWave. I hope to catch up pretty soon…
  • WhatSize
    • Shareware (formerly freeware)
    • Same speed.  Consumes a little bit more of memory, because it supports another feature that requires it
    • Does have many more features than DiskWave. Some of them, I never intend to get: fat binaries removal, locale removals, etc…
    • The thing that annoys me is that you can size/browse only one drive at a time.
  • DaisyDisk
    • Shareware
    • New kid on the block. The visualization is really awesome but… I do not find it that practical.
    • If I ever wish to play with CoreAnimation, I may add an animated sunburst view.
  • GrandPerspective
    • Opensource
    • Seems to work well and is properly maintained. But I do not like this kind of visualization.
  • DiskInventory X
    • Opensource
    • It looks like it is no longer maintained. I do not fancy the GUI. Same as GrandPerspective.

DiskWave being in its early infancy is somewhat limited in terms of features. I hope to gradually upgrade it. If you have ideas of features you would like to see added, just let me know.

Reference:

Update April 12th 2010:

  • Renamed WhichSize into DiskWave after receiving complaints from id design, inc.

DiskWave, MacOS X, My Software

Force Windows to refresh the Desktop (and Start Menu)

February 23rd, 2010

Today I learned a new trick.

When you programatically delete a shortcut from the Desktop folder Windows is “generally” smart enough to update the Desktop and the “recently used programs” section of the Start Menu. But sometimes it does not work and you are left with a “ghost” icon.

As a regular end user, you can hit the F5 key to force a refresh of the Desktop, but for the Start Menu you are left with no alternative than killing/restarting explorer.exe.

I was looking for a better solution for a custom installer application. And after a lot of MSDN scattering and googling around, Eureka, I finally found a magic incantation to programmatically force a refresh of the Desktop.

SHChangeNotify (SHCNE_ASSOCCHANGED, 0, 0, 0);

Programming, Windows, c++, win32

Make LoadLibrary() failures silent on Win2k

December 3rd, 2009

For a custom installer application, I have been working on a crude and efficient way to determine whether the particular version of the C runtime (CRT) we need is installed or not. The technique I use is simply to check if a dummy DLL linked to the CRT libraries would load up properly.

This works gloriously well, except for one simple detail. When the CRT is not installed, on Windows 2000 only, the LoadLibrary error would also cause a MessageBox to be displayed. This stops the flow of the installer and of course, is not very elegant…

Win2k LoadLibrary failure

But there is a simple trick to get rid of the MessageBox, using the very obscure SetErrorMode system call.

::SetErrorMode(SEM_FAILCRITICALERRORS);
HMODULE hDll = ::LoadLibrary("CrtCheck.Dll"); // Won't bark
if (hDll)   ; // CRT is installed
else        ; // CRT is NOT installed

Do you guys know a better (yet simple) way to determine if the CRT is installed?

Update: this is not a Windows 2000 specific issue (thanks Ferruccio). It’s also true for older versions of Windows. As far as I know WinXP, Vista and 7 do NOT display a MessageBox under the same circumstances.

Programming, Windows, c++, win32