How to make a custom DLL with WordSmith?

xujiajin

管理员
Staff member
http://www.lexically.net/wordsmith/version4/WordSmith4CustomDLL.txt

我不大懂,不知道对大家有没有用。
library WordSmith4CustomDLL;

uses
Windows;

{
SOURCE CODE WRITTEN IN PASCAL FOR DELPHI

This example uses a very straightforward Windows routine for comparing
strings, CompareStringA and CompareStringW which are in a Windows .dll.

The function does a case-insensitive comparison because
NORM_IGNORECASE (=1) is used. If it was replaced by 0, the comparison
would be case-sensitive.

In this example, EASTER gets changed to CHRISTMAS.
}

function WordlistChangeWord(
original : pointer;
language_identifier : DWORD;
is_Unicode : WordBool) : pointer; stdcall;
begin
Result := original;
if is_Unicode then begin
if CompareStringW(
language_identifier,
NORM_IGNORECASE,
PWideChar(original), -1,
PWideChar(widestring('EASTER')), -1) - 2 = 0
then
Result := pwidechar(widestring('CHRISTMAS'));
end else begin
if CompareStringA(
language_identifier,
NORM_IGNORECASE,
PChar(original), -1,
PChar('EASTER'), -1) - 2 = 0
then
Result := pchar('CHRISTMAS');
end;
end;

function ConcordChangeWord(
original : pointer;
language_identifier : DWORD;
is_Unicode : WordBool) : pointer; stdcall;
begin
Result := WordlistChangeWord(original,language_identifier,is_unicode);
end;

function KeyWordsChangeWord(
original : pointer;
language_identifier : DWORD;
is_Unicode : WordBool) : pointer; stdcall;
begin
Result := WordlistChangeWord(original,language_identifier,is_unicode);
end;

exports

ConcordChangeWord,
KeyWordsChangeWord,
WordlistChangeWord;

begin
end.
 
Back
顶部