Contents

Alerts and the System Tray Icon
Adding the Alert dialog and the alert tray icon seemed to be a simple task at first, but it didn't turn out that way. When you create a tray icon with Shell_NotifyIcon, you need to give it a window handle. This handle is used to send notifications from the tray icon back to the program when the user selects commands in the tray icon's context menu. The problem is, which window should be passed to the icon? The FolderMon event views in Explorer are created on the fly and are volatile by nature, so they can't be used for this purpose. I needed a permanent and uniquely identifiable window.

I decided to make the Alert dialog modeless and to keep it on (but not always visible) at all times once FolderMon was started. The tray icon would communicate directly with the Alert dialog. This seemed straightforward, but it generated numerous problems and crashes in Explorer. Why? Because the thread used to create the dialog box was different, depending on whether the user chose Start FolderMon from the root icon's context menu in Explorer, the FolderMon pull-down menu, or the context menu of the Desktop icon. Those of you familiar with MFC know that an MFC window object can be accessed only within the memory context of the thread that created it. There was only one solution: FolderMon had to create the Alert dialog in a separate thread when the program started. This makes the code more complicated, but it works.

Automatic Renewal Program: Your subscription will continue without interruption for as long as you wish, unless
you instruct us otherwise. Your subscription will automatically renew at the end of the term unless you authorize
cancellation. Each year, you'll receive a notice and you authorize that your credit/debit card will be charged the
annual subscription rate(s). You may cancel at any time during your subscription and receive a full refund on all
unsent issues. If your credit/debit card or other billing method can not be charged, we will bill you directly instead. Contact Customer Service

//our current issue

Select Term:

24 issues for $29.99 ONLY $1.25 an issue! Lock in Your Savings!

12 issues for $19.99ONLY $1.67 an issue!

State

Country

This transaction is secure

Automatic Renewal Program: Your subscription will continue without interruption for as long as you wish, unless
you instruct us otherwise. Your subscription will automatically renew at the end of the term unless you authorize
cancellation. Each year, you'll receive a notice and you authorize that your credit/debit card will be charged the
annual subscription rate(s). You may cancel at any time during your subscription and receive a full refund on all
unsent issues. If your credit/debit card or other billing method can not be charged, we will bill you directly instead. Contact Customer Service