CommandLine

Up
CommonControls
CreateFont
Database
CEDIB
CEFonts
CEGDI
GetOwnerInfo
CESystem
ScreenCapture
CEWindows
ListBoxChildren
Directory Tree
OwnerDrawButtons
CECalenderControl
Imgdecmp
Inking
PropertySheets
CommandLine
VirtualListView
SetOwnerInfo
SystemParameterInfo

Home
Up

 

Name: CommandLine

What is it: Parsing the commandline.

Features:

  1. You can also get the setargv code from the CRT runtime library sources

The Code:

VOID ParseCommandLine( LPTSTR lpcmdline ) {
TCHAR ch;
LPTSTR pname;
TCHAR szbufW[32];
// Follow this pattern strictly:
// /O
// Look for an option, which will be prefaced with '/' or '-'

if (ch == '/' || ch == '-')
{
ch = *lpcmdline++;
switch (ch)
{
case 'O':
//Do stuff
break;
default:

wsprintf(szbufW,_T("%c is an invalid switch."), ch)
MessageBox (NULL, _T("%c is an invalid switch\n"), NULL, MB_OK);
return;
}

//whitepace after option switch

while (isspace(ch))
{
ch = *lpcmdline++;
}
}

// Look for a string

while (ch)
{
*p++ = ch;
ch = *lpcmdline++;
}
*p = '\0';
_tcsupr(p);
return;
}

This page was last updated on 06/03/99.

 Feedback mailto:ppcdev@conduits.com