Passing Command Line Arguments to a VB6 program on Windows 7/8


My long national nightmare is over!

Back in the late 90s, I wrote a fax viewer program for my then employer, now client.  It was written in VB6 and has been running  without incident on their fleet of XP machines for well over a decade.

We started to migrate off XP and the fax viewer worked fine, but our ability to “launch by association” went away.  We could open the fax viewer, navigate to our folder full of faxes, open one up and do our thing; but double-clicking on a fax no longer opened the fax up automatically.

The command line was being passed just fine, but for whatever reason, the app just wouldn’t open the file.

MsgBox’s showed me the command line and it was exactly what we were passing… and so I left it as an “inconvenience” – we could still get to the fax, but not as slickly as just clicking on the link in the email.

I looked everywhere – thinking it had to do with security contexts, that the UAC was getting in the way of blahdy-blahdy-blah, I had no idea what.  I didn’t stay up on the intricacies of how the security models changed between “Run it All, All the Time” under XP to the more restrictive security models of Vista/7/8, so I figured it had to be that, and I chalked it off.

Fast forward a bit over a year, and we’re rolling out Windows 8.1 now to the rest of the desks that hadn’t gotten Windows 7.  The fax viewer works the same way on Windows 8.1 and it still drives me nuts, so I dug back  into the code to look again, put back my MsgBox’s to look at the command line arguments at runtime, and it hit me.


WindowsXP passes the command line as C:\TEMP\MYFILE.FAX and Win7/8 passes it surrounded by quotes “C:\TEMP\MYFILE.FAX” and when I did my FileExists checking using the FileSystemObject, the check failed when it was passed the filename wrapped in quotes, so it never loaded the file.

Once I stripped out the quotes from the command-line argument, then it passed the FileExists check, loaded up the document and all was well.

Only took me 13 months, but, dammit, I figured it out!

Recovering from a BSOD when restoring XP into Hyper-V

intelideWe had a mission critical XP machine go belly up — the machine interfaced with some medical hardware and couldn’t be upgraded without great expense — and the hard drive was SATA and the hardware we had to replace onto was IDE.   I made an image of the SATA drive, then restored it onto the IDE drive, and the hardware wouldn’t boot.  It just sat on a black screen with a blinking cursor.  It didn’t even have the decency to turn blue.  UBCD showed me the drive contents, so I knew everything was OK on that end, it just wasn’t booting…

So I figured I’d restore it into a Hyper-V and have a go from there.  That way the client could RDP to the VM and redirect the USB ports to the XP machine and process the data from the sensors.

Of course, upon restoration, it was Blue Screen Of Death city dead ahead, and the machine kept rebooting with the usual Inaccessible Boot Device 0x0000007B error.

VMWare has their migration assistant that after you convert your image, it will inject all of its drivers into the image to make sure everything boots.  Microsoft doesn’t seem to have such a tool, so it’s usually a bunch of frustration.

But, Technet’s Code Break blog to the rescue – P2V Migration Issues with Hyper-V: STOP: 0x0000007B — HEY!  That sounds like my issue!

And, lo and behold, the article details a bunch of registry entries that need to be present in the VMDK file in order to get the image to boot.  I mounted the VMDK, loaded the registry hive and, sure enough, there was a discrepancy — my IntelIDE key was not set to auto-start.  (And why would it, since the drive was SATA based?)

So, I changed the Start DWORD to a 0 as I was instructed in the post, and my VM started without issue!

How Am I Supposed to Uninstall a Program in Safe Mode if the Windows Installer Service Isn’t Running?!?

IMG_20140612_092942149_HDRSo, a client’s server is giving me agita — bluescreening without useful error codes and all that — and I need to uninstall some programs.

We boot into safe mode and we get some things (based on the Nullsoft installer) uninstalled, but when it comes to uninstalling things that rely on the Windows Installer service, we’re told we’re out of luck since the Installer Service can’t run in safe mode.


Happily, there is a quick way around that, depending on which version of safe mode you’re in — “normal” or “with networking”

Open a Command Prompt with Administrative Credentials, and if you’re in the basic safe mode, run the following command:

REG ADD “HKLM\SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\MSIServer” /VE /T REG_SZ /F /D “Service”

If you’re in “with networking” you’ll need to run this command instead:

REG ADD “HKLM\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\MSIServer” /VE /T REG_SZ /F /D “Service”

then, a quick

net start msiserver

and you can install and uninstall in safe mode.


(Oh, and turning off verifer.exe seems to have calmed the blue-screens down.)

Hiding the Metro Tiles in Windows Server 2012 R2

Win12R2_DesktopRegA giant THANK YOU to Pierre Roman over at CanITPro (they beat us in hockey, and they’re beating the Metro interface back with a stick!) for his article: “Step-By-Step: Booting directly to the Desktop in Windows 8.1

Because of it, there is a VERY GOOD chance that I won’t be inundated with support calls Monday morning as this new terminal goes live from people who don’t know what the Metro interface is or how to use it.

But with Windows 8.1 and Server 2012 R2, Microsoft listened and gave us a way to boot directly to the desktop view of Win 8.1, and not the Start screen.

On Win 8.1 it’s an item in the Taskbar and Navigation properties dialog; but to push it out to everyone, you need to use Group Policy to push a Registry change.  This hasn’t made it to an ADMX yet.

According to the article, you want to make a new Group Policy Registry preference and push it out:

Key: HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\StartPage\
Value: OpenAtLogon
Value Type: Reg_DWORD
Value Data: “0” Boots to the Desktop
Value Data: “1” Boots to the Start Screen

And the next time they log in, they’ll go to the desktop, not Start.


Migrating from SBS 2003 to Windows Server Essentials 2012 R2

migr2Just as a heads up, most of the Technet articles I found on doing a SBS 2003 to Windows Server 2012 R2 Essentials migration cover Server 2012, not 2012 R2 and they all mention installing the server in “Migration Mode” and grabbing the “Server Migration Prep Tool” from a folder on the DVD called support\tools.


Server 2012 Essentials R2 is a separate product than Server 2012 Essentials, and the two, tho related, do not share some bits.

I found out the hard way by doing an install, then seeing the Migration Mode stuff, and restarting the install, only to find there was no migration mode option.

But, they do have a document that spells it all out for you, without using the missing Migration Mode install… Lots of threads with “I just installed Server 2012 R2 Essentials and I am also not seeing the migration install option anywhere.” messages.  Happily someone pointed them (and me) here:

Migrate from Previous Versions to Windows Server 2012 R2 Essentials or Windows Server Essentials Experience which can be found here:

Posted so I don’t lose the link, and maybe people Googling will find it easier than I did. 🙂