Today, a few people were looking for how to start Explorer in a specific folder. I thought that it was an interesting request for two reasons; seemed like something that could easily be tried and the source code is available with Platform Builder.
So first, I tried it. There are several ways to try it, I chose to use Run from the Start menu. In the dialog, I typed in “Explorer \Flash Disk” and there was the answer, Explorer started in the \Flash Disk folder. It took less time than a Google search.
Second, I checked out the source code to see what it could do. That wasn’t as exciting as I had hoped, but it did tell me that Explorer can handle a command line parameter. I did discover that Explorer only runs one instance, so when you start it again it just requests that the original instance start a new window and passes it your command line parameters.
So now we know that this can be done, how can we do it without using the Start\Run? One way is to use a shortcut. I have shown examples of shortcuts and the syntax in Windows CE: Automatically Start Application with Command Line Parameters, so I will just create a shortcut that starts Explorer in my \Flash Disk folder.
Explore Flash Disk.exe.lnk
20#Explorer \Flash Disk
Back to the source code. If you are working on Windows CE devices and applications and you don’t have Platform Builder, you should consider obtaining the trial version from Microsoft. It is a big download, but worth it. The distributors might be able to send you the evaluation disks.
You may not ever need to actually use the tool, but the source code includes thousands of lines of example source code. In this case, the source code for the Explorer shell is in the Public\Shell folder. To find the answer to the question about command line parameters I did a simple search for “main”, then narrowed to “winmain” and quickly found what I wanted to know.
I also find that the control panel source code is very valuable. This is especially so when creating a kiosk type application, where the control panel isn’t exposed to the end user but some of the functionality needs to be. The source code for the control panel applets is in PUBLIC\WCESHELLFE\OAK\CTLPNL.
Copyright © 2008 – Bruce Eitman
All Rights Reserved