{$DEFINE SST_SHLWAPIVER6PT0}
{$IFDEF SST_SHLWAPIVER6PT0}
PROCEDURE TForm4.TestShlWAPIStrStrNW(Sender : TObject);
VAR strtosrchfor : WideString;
VAR txttosearch : WideString;
VAR uptocharnum : UINT;
VAR apiretptr : POINTER;
VAR newinfoline : STRING;
BEGIN
strtosrchfor := '';
txttosearch := '';
uptocharnum := 0;
apiretptr := NIL;
newinfoline := '';
strtosrchfor := 'FoX'; //Compare to the first parameter of the first example in the StrStr sample code
uptocharnum := 16;
txttosearch := 'The quick, brown fox jumped over the fence and hid in the fox burrow';
newinfoline := 'StrStrNW called with lpFirst (without the quotation marks) = "' + txttosearch + '", lpSrch = ' +
strtosrchfor + ', and cchMax = ' + IntToStr(uptocharnum);
Memo1.Lines.Add(newinfoline);
apiretptr := StrStrNW(PWChar(txttosearch), PWChar(strtosrchfor), uptocharnum);
IF apiretptr <> NIL THEN
newinfoline := 'StrStrNW returned a pointer to "' + PWChar(apiretptr) + '"'
ELSE
newinfoline := 'StrStrNW returned NIL !';
Memo1.Lines.Add(newinfoline);
strtosrchfor := 'FENCE';
uptocharnum := 42;
txttosearch := 'The quick, brown fox jumped over the fence and hid in the fox burrow';
newinfoline := 'StrStrNW called with lpFirst (without the quotation marks) = "' + txttosearch + '", lpSrch = ' +
strtosrchfor + ', and cchMax = ' + IntToStr(uptocharnum);
Memo1.Lines.Add(newinfoline);
apiretptr := StrStrNW(PWChar(txttosearch), PWChar(strtosrchfor), uptocharnum);
IF apiretptr <> NIL THEN
newinfoline := 'StrStrNW returned a pointer to "' + PWChar(apiretptr) + '"'
ELSE
newinfoline := 'StrStrNW returned NIL !';
Memo1.Lines.Add(newinfoline);
strtosrchfor := ' fence'; //Blank as text to search for
uptocharnum := 42;
txttosearch := 'The quick, brown fox jumped over the fence and hid in the fox burrow';
newinfoline := 'StrStrNW called with lpFirst (without the quotation marks) = "' + txttosearch + '", lpSrch = ' +
strtosrchfor + ', and cchMax = ' + IntToStr(uptocharnum);
Memo1.Lines.Add(newinfoline);
apiretptr := StrStrNW(PWChar(txttosearch), PWChar(strtosrchfor), uptocharnum);
IF apiretptr <> NIL THEN
newinfoline := 'StrStrNW returned a pointer to "' + PWChar(apiretptr) + '"'
ELSE
newinfoline := 'StrStrNW returned NIL !';
Memo1.Lines.Add(newinfoline);
txttosearch := 'The quick, brown fox jumped over the fence and hid in the fox burrow';
strtosrchfor := 'fox';
uptocharnum := Length(txttosearch); // = is the length of the string being searched
newinfoline := 'StrStrNW called with lpFirst (without the quotation marks) = "' + txttosearch + '", lpSrch = ' +
strtosrchfor + ', and cchMax = ' + IntToStr(uptocharnum);
Memo1.Lines.Add(newinfoline);
apiretptr := StrStrNW(PWChar(txttosearch), PWChar(strtosrchfor), uptocharnum);
IF apiretptr <> NIL THEN
newinfoline := 'StrStrNW returned a pointer to "' + PWChar(apiretptr) + '"'
ELSE
newinfoline := 'StrStrNW returned NIL !';
Memo1.Lines.Add(newinfoline);
txttosearch := 'The quick, brown fox jumped over the fence and hid in the fox burrow';
strtosrchfor := 'T';
uptocharnum := 1;
newinfoline := 'StrStrNW called with lpFirst (without the quotation marks) = "' + txttosearch + '", lpSrch = ' +
strtosrchfor + ', and cchMax = ' + IntToStr(uptocharnum);
Memo1.Lines.Add(newinfoline);
apiretptr := StrStrNW(PWChar(txttosearch), PWChar(strtosrchfor), uptocharnum);
IF apiretptr <> NIL THEN
newinfoline := 'StrStrNW returned a pointer to "' + PWChar(apiretptr) + '"'
ELSE
newinfoline := 'StrStrNW returned NIL !';
Memo1.Lines.Add(newinfoline);
txttosearch := 'The quick, brown fox jumped over the fence and hid in the fox burrow';
strtosrchfor := 'T';
uptocharnum := 0;
newinfoline := 'StrStrNW called with lpFirst (without the quotation marks) = "' + txttosearch + '", lpSrch = ' +
strtosrchfor + ', and cchMax = ' + IntToStr(uptocharnum);
Memo1.Lines.Add(newinfoline);
apiretptr := StrStrNW(PWChar(txttosearch), PWChar(strtosrchfor), uptocharnum);
IF apiretptr <> NIL THEN
newinfoline := 'StrStrNW returned a pointer to "' + PWChar(apiretptr) + '"'
ELSE
newinfoline := 'StrStrNW returned NIL !';
Memo1.Lines.Add(newinfoline);
Memo1.Lines.Add('');
END;
{$ENDIF} |
StrStrNW called with lpFirst (without the quotation marks) =
"The quick, brown fox jumped over the fence and hid in the fox burrow",
lpSrch = FoX, and cchMax = 16
StrStrNW returned NIL !
StrStrNW called with lpFirst (without the quotation marks) =
"The quick, brown fox jumped over the fence and hid in the fox burrow",
lpSrch = FENCE, and cchMax = 42
StrStrNW returned NIL !
StrStrNW called with lpFirst (without the quotation marks) =
"The quick, brown fox jumped over the fence and hid in the fox burrow", lpSrch =
fence, and cchMax = 42
StrStrNW returned a pointer to " fence and hid in the fox burrow"
StrStrNW called with lpFirst (without the quotation marks) =
"The quick, brown fox jumped over the fence and hid in the fox burrow",
lpSrch = fox, and cchMax = 68
StrStrNW returned a pointer to "fox jumped over the fence and hid in the fox burrow"
StrStrNW called with lpFirst (without the quotation marks) =
"The quick, brown fox jumped over the fence and hid in the fox burrow",
lpSrch = T, and cchMax = 1
StrStrNW returned a pointer to "The quick, brown fox jumped over the fence and hid in the fox burrow"
StrStrNW called with lpFirst (without the quotation marks) =
"The quick, brown fox jumped over the fence and hid in the fox burrow",
lpSrch = T, and cchMax = 0
StrStrNW returned NIL ! |