PROCEDURE TForm4.TestShlWAPIPathGetCharType(Sender : TObject);
VAR chartotest : CHAR;
VAR wchartotest : WCHAR;
VAR apiretval : UINT;
VAR ansicp : UINT;
VAR newinfoline : STRING;
BEGIN
chartotest := #0;
wchartotest := #0;
apiretval := 0;
newinfoline := '';
ansicp := GetACP(); //Determine active ANSI code page for reference purposes only
chartotest := ':'; //Colon
apiretval := PathGetCharType(UCHAR(chartotest));
newinfoline := 'PathGetCharType called with ' + AnsiQuotedStr(chartotest, '"') +
' returned : 0x' + IntToHex(apiretval, 8) + ' (' + IntToStr(apiretval) + ')';
Memo1.Lines.Add(newinfoline);
chartotest := '.'; //Period
apiretval := PathGetCharType(UCHAR(chartotest));
newinfoline := 'PathGetCharType called with ' + AnsiQuotedStr(chartotest, '"') +
' returned : 0x' + IntToHex(apiretval, 8) + ' (' + IntToStr(apiretval) + ')';
Memo1.Lines.Add(newinfoline);
chartotest := '\'; //Backslash
apiretval := PathGetCharType(UCHAR(chartotest));
newinfoline := 'PathGetCharType called with ' + AnsiQuotedStr(chartotest, '"') +
' returned : 0x' + IntToHex(apiretval, 8) + ' (' + IntToStr(apiretval) + ')';
Memo1.Lines.Add(newinfoline);
chartotest := '/'; //Slash
apiretval := PathGetCharType(UCHAR(chartotest));
newinfoline := 'PathGetCharType called with ' + AnsiQuotedStr(chartotest, '"') +
' returned : 0x' + IntToHex(apiretval, 8) + ' (' + IntToStr(apiretval) + ')';
Memo1.Lines.Add(newinfoline);
chartotest := '*'; //Asterisk
apiretval := PathGetCharType(UCHAR(chartotest));
newinfoline := 'PathGetCharType called with ' + AnsiQuotedStr(chartotest, '"') +
' returned : 0x' + IntToHex(apiretval, 8) + ' (' + IntToStr(apiretval) + ')';
Memo1.Lines.Add(newinfoline);
chartotest := '?'; //Quetion mark
apiretval := PathGetCharType(UCHAR(chartotest));
newinfoline := 'PathGetCharType called with ' + AnsiQuotedStr(chartotest, '"') +
' returned : 0x' + IntToHex(apiretval, 8) + ' (' + IntToStr(apiretval) + ')';
Memo1.Lines.Add(newinfoline);
chartotest := '~'; //Tilde
apiretval := PathGetCharType(UCHAR(chartotest));
newinfoline := 'PathGetCharType called with ' + AnsiQuotedStr(chartotest, '"') +
' returned : 0x' + IntToHex(apiretval, 8) + ' (' + IntToStr(apiretval) + ')';
Memo1.Lines.Add(newinfoline);
//Test some Latin characters
chartotest := 'A'; //
apiretval := PathGetCharType(UCHAR(chartotest));
newinfoline := 'PathGetCharType called with ' + AnsiQuotedStr(chartotest, '"') +
' returned : 0x' + IntToHex(apiretval, 8) + ' (' + IntToStr(apiretval) + ')';
Memo1.Lines.Add(newinfoline);
chartotest := 'b'; //
apiretval := PathGetCharType(UCHAR(chartotest));
newinfoline := 'PathGetCharType called with ' + AnsiQuotedStr(chartotest, '"') +
' returned : 0x' + IntToHex(apiretval, 8) + ' (' + IntToStr(apiretval) + ')';
Memo1.Lines.Add(newinfoline);
chartotest := 'C'; //
apiretval := PathGetCharType(UCHAR(chartotest));
newinfoline := 'PathGetCharType called with ' + AnsiQuotedStr(chartotest, '"') +
' returned : 0x' + IntToHex(apiretval, 8) + ' (' + IntToStr(apiretval) + ')';
Memo1.Lines.Add(newinfoline);
//Test some Greek characters using the Unicode version
wchartotest := #931; //Greek capital sigma
apiretval := PathGetCharTypeW(wchartotest);
newinfoline := 'PathGetCharTypeW called with ' + AnsiQuotedStr(wchartotest, '"') +
' returned : 0x' + IntToHex(apiretval, 8) + ' (' + IntToStr(apiretval) + ')';
Memo1.Lines.Add(newinfoline);
wchartotest := #963; //Greek lower case sigma
apiretval := PathGetCharTypeW(wchartotest);
newinfoline := 'PathGetCharTypeW called with ' + AnsiQuotedStr(wchartotest, '"') +
' returned : 0x' + IntToHex(apiretval, 8) + ' (' + IntToStr(apiretval) + ')';
Memo1.Lines.Add(newinfoline);
wchartotest := #932; //Greek capital tau
apiretval := PathGetCharTypeW(wchartotest);
newinfoline := 'PathGetCharTypeW called with ' + AnsiQuotedStr(wchartotest, '"') +
' returned : 0x' + IntToHex(apiretval, 8) + ' (' + IntToStr(apiretval) + ')';
Memo1.Lines.Add(newinfoline);
//Test some symbols using the Unicode version
wchartotest := #9829; //Heart suit
apiretval := PathGetCharTypeW(wchartotest);
newinfoline := 'PathGetCharTypeW called with ' + AnsiQuotedStr(wchartotest, '"') +
' returned : 0x' + IntToHex(apiretval, 8) + ' (' + IntToStr(apiretval) + ')';
Memo1.Lines.Add(newinfoline);
wchartotest := #9768; //White smilee
apiretval := PathGetCharTypeW(wchartotest);
newinfoline := 'PathGetCharTypeW called with ' + AnsiQuotedStr(wchartotest, '"') +
' returned : 0x' + IntToHex(apiretval, 8) + ' (' + IntToStr(apiretval) + ')';
Memo1.Lines.Add(newinfoline);
wchartotest := #9835; //Eighth note
apiretval := PathGetCharTypeW(wchartotest);
newinfoline := 'PathGetCharTypeW called with ' + AnsiQuotedStr(wchartotest, '"') +
' returned : 0x' + IntToHex(apiretval, 8) + ' (' + IntToStr(apiretval) + ')';
Memo1.Lines.Add(newinfoline);
//Test some invalid control code characters using the Unicode version
wchartotest := #9; //Tab
apiretval := PathGetCharTypeW(wchartotest);
newinfoline := 'PathGetCharTypeW called with ' + AnsiQuotedStr(wchartotest, '"') +
' returned : 0x' + IntToHex(apiretval, 8) + ' (' + IntToStr(apiretval) + ')';
Memo1.Lines.Add(newinfoline);
wchartotest := #10; //Line feed
apiretval := PathGetCharTypeW(wchartotest);
newinfoline := 'PathGetCharTypeW called with ' + AnsiQuotedStr(wchartotest, '"') +
' returned : 0x' + IntToHex(apiretval, 8) + ' (' + IntToStr(apiretval) + ')';
Memo1.Lines.Add(newinfoline);
Memo1.Lines.Add('');
END; |