KeyStuff

Description

Here's a simple little demo that takes a basic concept, stuffing the keyboard buffer of a console application, and builds it into an incredibly poweful CDW command line utility.  With a Sub Main that amounts to perhaps 15 or 20 lines of code, we build a tool that displays a "browse for folder" dialog, then upon exit it issues the appropriate changedrive and changedirectory commands to the parent process.

There are lots of hidden gems in this sample, so by all means dig through it. Besides the several ways it offers to call the folder browse dialogs, you'll also add another handy method to your console application arsenal.

Published

This sample hasn't been published anywhere except here on this website, but first rights to such publication are jealously guarded - you have been warned. <g>

APIs Usage

This sample uses the following API calls:

Module Library Function
MCDW.bas kernel32



user32
ExitProcess
GetShortPathName
GetVersionEx
RtlMoveMemory
EnumThreadWindows
GetWindowLong
MFolderBrowse.bas kernel32





ole32
shell32



user32
GetVersionEx
LocalAlloc
LocalFree
lstrcpyA
lstrlenA
RtlMoveMemory
CoTaskMemFree
SHBrowseForFolder
SHGetPathFromIDList
SHGetSpecialFolderLocation
SHSimpleIDListFromPath
SendMessage
MKeyStuff.bas kernel32



user32
CloseHandle
GetStdHandle
RtlMoveMemory
WriteConsoleInput
MapVirtualKey
VkKeyScan

Don't see what you're looking for? Here's a complete API cross-reference.

Download

Download KeyStuff.zip   Please, enjoy and learn from this sample. Include its code within your own projects, if you wish. But, in order to insure only the most recent code is available to all, I ask that you don't share the sample by any form of mass distribution.

Download KeyStuff.zip, 49Kb, Last Updated: Thursday, July 29, 2010

See Also

The following resources may also be of interest: