Braindump: Dev Issues w/Outlook 2003 Custom Forms and Common Dialogs

I’ve been fighting with Outlook development again lately, custom form development in particular.  OL development is quirky, but there’s one circumstance where it’s downright bug-ridden:
Custom Outlook forms using Windows’ standard Common Dialog control.

The issues are numerous, but I’ll list them as I’ve found them:

“The control could not be created because it is not properly licensed”.

That link is to a thread in which Sue Mosher herself participates regarding her book’s suggestion to use the Common Dialog on Outlook forms.  A reader discovered licensing issues with this, and Sue confesses “I think we didn’t get it right, alas”

Kudos to her for that.  But there is a workaround: when I ran into the same issue several months ago, I found (can’t remember where right now, but I’ll update if I do) that, due to the Common Dialog’s (annoyingly dumb!) licensing, there’s a right way to use it and a wrong way.  Basically, if you programmatically create the control object, licensing restrictions kick in, and it will only work on machines with MS developer tools installed.  However, if you drag/drop the control onto the form, you can programmatically use it without a hitch. 

So, drag/drop the control and code to it, instead of using code like CreateObject("MSComDlg.CommonDialog"), and you should be good.

VBScript’s Native Error Handling is Broken

(Some?) Runtime VBScript Errors on Custom Outlook forms are suppressed.  Even with On Error Goto 0 explicitly set (which is the default in VBScript anyway), certain object-related errors are simply never raised. 

In particular, I was never actually getting the “The control could not be created because it is not properly licensed” error when I ran into it on users’ machines (who didn’t have MS dev tools installed).  Instead, that code was simply never running (as if I had On Error Resume Next set).  The only way I could track it down was by moving the code into a Windows Script, where native VBScript error handling does work:

…Not a great error message, but enough to google the answer.

Drag/Dropped Common Dialog Controls Become Invisible When Reopening a Custom Form

If you drag/drop a Common Dialog onto the form, it shows as a placeholder icon.  Save and the form template, reopen the template, and that placeholder icon is gone. 

I did determine that the Common Dialog is actually still there though.  I simply wrote some code which uses the control — when I reopen, that code still finds and uses the invisible control without issue.  Pretty confusing to anyone who doesn’t know/remember it’s there, though!

Custom Field Data + Common Dialogs Cause Security Warnings

Outlook 2002 SP3 and Outlook 2003 have a security feature which restricts ActiveX controls on one-off forms.  Basically, if you open a form template or one-off form which contains an ActiveX control, OL blocks the control and gives this error:

The solution to this problem is to not use one-off forms, and to instead publish them.

Unfortunately, this is not that issue, but it’s a somehow related OL bug.  What I found is that:
With items created from published custom form, which possess both custom fields and a Common Dialog control, if you save data in one of the custom fields, then you will get that error dialog on future openings of the item.

So another way of putting it:

  • I publish my custom form (with custom fields & Common Dialog). 
  • I can create a new item with it.  No problem.
  • I can even save standard field data in it.  No problem (reopening is flawless).
  • But as soon as I save data in a custom field and close, I get that dialog, and most of the form data is missing.

…I’ve found no documentation of this issue with this set of circumstances.  (Maybe it’s that rare, but I strongly suspect others have had it, which is why I’m airing it here).

It’s also a showstopper for me — I painstakingly worked around the myriad other Common Dialog issues, but I gotta open a file and have custom data on my form.  So now I’m looking into other controls.  Hopefully Sue was right in suggesting Word’s file dialog.  I don’t like the external dependency, but I’ve checked and it appears I can do that (this time).  OR, there’s also Windows’ native Shell.Application object’s BrowseForFolder method (which apparently has its own quirks).

For those considering embarking on the Common Dialog route, I’d recommend against it.  There are lots of alternatives.  I’ll post my results with those later.

Update:

  • The Word route didn’t pan out — 10 seconds to load the Word exe is way too slow for a file dialog.
  • I also tried Shell.Application’s BrowseForFolder method.  It’s a bit clunky, though, and way too quirky.
  • I think I’ve settled on a different common dialog: UserAccounts.CommonDialog, which is nearly identical to MSComDlg.CommonDialog.  Differences:
    • No licensing headaches
    • No OL security warnings
    • It requires Windows XP
    • “InitDir” property is renamed “InitialDir”

    …Not bad at all.  Still nice & snappy, with WinXP as the only requirement (certainly palatable for me).

Wishes for Windows Vista

Admittedly, I haven’t seen the beta yet, but I figured I’d get this out there in the hopes that someone who matters sees it…

Great idea for Windows: User Profile Templates and Machine Templates.  Essentially, they are just collections of registry settings, editable through a Tweak UI-like interface, and (most importantly) saveable as files.

User Profile Templates

These templates can be applied to existing profiles or the default user profile.  They would be editable and easily transferrable as files (Why? Because even though I’m a power user, I still like the Welcome screen).

Windows would include these Profile Templates out of the box (with example setting changes):

  • Beginner — pretty much what the default is now.
  • Intermediate — Windows Explorer switches over to details view, visible status bar.
  • Power User — All of Intermediate, plus: Quick Launch bar enabled.  Windows Explorer gets simple folder view disabled, filetype extensions visible, full path in address bar, encrypted/compressed files in color.  Windows Explorer & IE toolbars get compacted like so:

    Simple Folder View is disabled.

I don’t care if the default templates are editable, but if not, they should be copyable as the basis for other custom templates.  (If so, they’d need a “restore default settings” option).

Machine Templates

Same idea here, but for machine-wide (HKLM) settings.  Default templates would be something like:

  • Standalone Workstation — current defaults
  • Networked Workstation — RDP enabled, NetBIOS enabled

Here’s my reasoning behind this:

For Users: short of a new “GPOs for Workgroups” feature (which I’d love), power users need a way to manage workgrouped machines.  Even plain ol’ Power Users with Standalone Machines need an easy way to setup a machine which doesn’t require two hours of fixing stupid defaults.  Profile and Machine templates would greatly mitigate these issues for users.

For the Windows team, these templates would lessen the dev struggle between Features and Beginner simplicity.  Got a great but possibly-confusing feature?  No problem, just disable it for Beginners, and enable it for Power Users.

Also, miscellaneous Windows Explorer fixes/improvements I want:

  • Bring back the file filter which Windows 3.1’s File Manager had.  (Sure, disable it for the Beginner template).
  • Context Menus: speed them up by any means necessary.  (Click/wait is my biggest annoyance with a busy Windows box [like while copying files])
  • Context Menus: make them easier to edit (like IE, or ideally Office).  (I really want to move the “new folder” action from the “New” submenu to the main context menu!)
  • Make it possible to enable the Size column for Folders (without the current crashy 3rd-party addons)
  • Absorb BAxBEx’s FolderBox addon’s functionality.
  • Make the search windows honor the “Launch folder windows in a separate process” setting.  (Currently a hung/crashed search does the same to the shell Explorer despite that setting).
  • more as I think of it…

I realize some of these are advanced features

Rant: The Rise of the Machines

I don’t remember who (for reasons explained shortly), but some blogger I read recently said “It’s sometimes difficult to remember that Technology exists to make things possible.”


This phrase is echoing through my head right now, as I watch my primary work machine slowly image a backup of its hard drive onto another machine, since the hard drive just crashed.  First strange sounds, then periodic freezes, and an hour later my screen is vivid abstract art.


Of course the drive’s S.M.A.R.T. status is still “OK”.


Better than this, it took about two hours to find the right combination of BIOS settings, network boot disk, and Ghost disk before I could even start the imaging process.


This has been a very bad technology year for me.  Ugly details below (including grammar, I’m sure), but here’s the gist: 



  • Computers do a lot less helping me these days, and I do a lot more helping them
  • They are much more prone to problems.
  • Even when they’re working “by design,” they are configured with stupid defaults and limitations which I have to fix (e.g. Windows Explorer).
  • They claim to be smart, offering to configure, automate, or fix themselves, but they create more problems, or actually worsen the problem in the process!

<DETAILS type=“ugly”>
In January, a previously stable workstation had its hard drive die, or so it seemed after 6+ reinstalls.  See, when I replaced the drive, the installation would freeze randomly.  Turns out the BIOS was misdetecting the replacement drive’s geometry, so I got to find and manually input heads, cylinders, etc — something I haven’t done in at least 10 years, and not my idea of a “trip down memory lane.” 
    That fixed the install, but the same spontaneously corrupt files issue has continued with the new drive.  ….I know drives die (moving parts & all), but drive controllers??


In May, the problems with my file server started.  It has mirrored drives.  One drive had a problem, the mirror broke, and the other kicked in (hurrah).  When I let the HighPoint RAID manager software fix the mirror, it “fixed” it alright …in the wrong direction! (since previously visible partition info disappeared afterwards). 
    Drive now non-bootable, with much research I restored the drive’s partitions with BootPart, and (hurrah) it booted, but Windows wanted to “fix” all the errors on the drive.  I let it do so.  Not until later did I realize that it was disconnecting most every file and subfolder from its parent folder, making them all Now “lost”.
    Oh, and Windows just “fixed” itself out of working.  So, time for a reinstall, happy that I keep the OS on its own partition, and careful to leave the others alone.  Ah, something worked, now about those files…
    Half a dozen file-restoration utilities found nothing more than a big jumbled mess of files without structure (and often without names).  At the end of that track, and crossing my fingers, I remembered I’d been doing nightly backups of important data…
    Whadya know, the backups are corrupt!  Again, very much effort to restore (so glad it was a zip file), and hurrah, I see files.  In fact, I think I’ve restored most of them, but we’ve discovered at least one missing, and I’m still wading through the “lost” files for possible luck. 


In the midst of the file server’s woes, my web server’s Windows Product Activation spontaneously went nuts.  At login, it would insist on activating Windows (which I’d already done), but when I said go ahead, it would say it’s already activated and boot me out.  Much research, booting to safe mode, fiddling with files, finally a Windows installation “repair” operation.  Success?  I login once, twice to check, and stuck again! 
    I gave up on it for a while.  A server mostly doesn’t need console access, so I was able to do a lot of things by other means.  The repair had made it completely unpatched though, which worried me since it’s by necessity exposed as a web server.  Eventually I did fix this, but only because of research on another machine’s WPA woes…


See, I was doing some “quick” troubleshooting of a friend’s laptop.  Windows search didn’t work, and there were a few other quirks, so I quickly ran System File Checker to fix possibly corrupted files.  No idea if this worked, because the subsequent login gave me the required WPA re-activation dialog, and again WPA was broken!  (blank this time).
    SO, I ran another Windows “repair” process, and it asks for a product key?!   (Duh, it’s a repair, not a fresh install, get it yourself!).  I got the key, tried it and it didn’t work. 
    Turns out it didn’t match the CD — there are OEM CDs, Volume License CDs, Retail CDs, and probably other flavors.  They’re all the exact same OS, but with different classes of keys.  I have no idea what this accomplishes for the licensing folks.
    So I restart the repair with a different CD & key.  It works, but then I get mysterious error dialogs with sentence fragments “could not complete the file copy operation, you may need to retry or“ — yes, or what?   I check and clean both disc and drive, but with no luck.  Fortunately it let me cancel that specific copy but continue the rest of the install.  I got the same error about 5 more times, but it worked.  Much re-patching ensued.
</DETAILS>

Aside: System File Checker is good.  Windows Product Activation is bad. 


I know drives fail.  I know software sometimes gets confused.  I could handle these much better if I still trusted the other software which is supposed to prevent, fix, or mitigate such problems. 


….And I’m seriously fantasizing about becoming a farmer. 


Have we reached the point of unsustainable complexity??


 

Stupid Outlook Peeves

That’s the actual title of a scribble note I made a long time ago. 

See, while I mostly love Outlook 2003, and it’s greatly improved since v2000, it still has a bunch of annoyances and artificial limitations that really get my goat.  To finish dumping the note:

  • Only 1 Exchange account setup is allowed per Windows (!) profile
  • POP accounts can only go to default delivery location’s inbox (unlike IMAP or Exchange accounts)
  • “After Sending” rules are missing several action options (which “When Arriving” rules do have).  In particular:
    • No “Move To Folder” option (Copy only)
    • No “Mark as Read” option
  • Tasks & Appointments which are outside the default delivery location are ignored (no reminders)
  • Can’t copy items from one PST to another (Move Items or Copy Folders only)
  • Folder views spontaneously and regularly get messed up
  • Subfolders can’t inherit parent folder’s view (an automatic option would be ideal, but manual would still be nice).

I noticed most of these while trying to maintain multiple accounts in Outlook, and keep their contents separate.  I used to use Outlook profiles, but switching is way too slow for that to be convenient.

Googling just now, I found a couple similar ruminations on the same subject: Limitations of Outlook (without Exchange) at inluminent.com, and
Outlook Limitations at outlookwise.com

More as it bugs me.

MSN Spaces tweaky thingy

Apparently MSN Spaces is now much more customizable, thanks to their new “Tweak UI PowerToy”.

Hey wait, though, Doesn’t Microsoft already already have a “Tweak UI Powertoy”?!  Ah, so they do!  (An indispensible Windows customization program, BTW).

Well, that’s ok, because MSN says to load it by typing “&powertoy=tweakomatic” on the end of the URL.  So perhaps we can just call it “Tweakomatic”…

Whoops, Microsoft already has a program called “Tweakomatic” too!  It writes scripts to programmatically accomplish what Tweak UI does.

…I can understand if the Spaces team really wants to be like the Scripting Guys (heck, I do!), but the name confusion has got to go!

Wardriving

So a couple weeks ago I actually did a little wardriving for about three miles, just to see how many wifi networks I’d find.  At a stop, I connected to one, loaded Slashdot to test, and what do I see? Oh My!, Man Arrested for Using Open Wireless Network.  Hmmm, whoops?

Great quote: “worrisome as it seems, wireless mooching is easily preventable by turning on encryption or requiring passwords.”

Yeah, kinda like putting doors on a building is a good way to keep people (and raccoons) out.  Maybe I should start asking before I use water fountains and public restrooms too.