把你的代码贴出来,要不改用string
解决方案 »
- 缺控件tsdbedit 提示,谁能告诉我下载地址
- delphi 中treeview的节点双击后是可以编辑的,怎么禁止用户编辑?
- 关于自定义桌面的的问题
- Delphi 三层(midas)如何使用数据库连接池
- (高分)创建ActiveX dll时找不到父窗体
- Delphi下深入Windows核心编程
- RadioGroup中怎样才能让其中一个Item变为不可用(灰色)?
- 在哪里能找到关于servers中的office组件的开发帮助文档
- 那里有 fastreport 或者 minireport 控件下载(是delphi中用的)
- Delphi自动升级如何实现?(压缩解压缩)
- 我正在做一个题库系统,请问哪里有数学、化学分子式编辑器(因为有些word搞你定) 谢谢!
- 如果备份移动硬盘里的数据
procedure FormatShortString(var s:shortstring);
var
li_len : integer;
begin
li_len := length(s);
move(s[1],s[0],li_len);
s[li_len] := #0;
end;
function func_test(out msg : shortstring) : shortstring;stdcall
begin
.......
msg := 'message';
result := 'ok';
formatShortSTring(msg);
formatShortString(result)
end;
procedure FormatShortString(var s:shortstring);
var
li_len : integer;
begin
li_len := length(s);
move(s[1],s[0],li_len);
s[li_len] := #0;
end;
function func_test(out msg : shortstring) : shortstring;stdcall
begin
.......
msg := 'message';
result := 'ok';
formatShortSTring(msg);
formatShortString(result)
end;
var
a: Widestring;
CurrPos: Integer;
StartPos: Integer;
EndPos: Integer;
Count: Integer;
FieldValue: string;
FieldSize: Integer;
TotalSize: Integer;
I,J: Integer;
FlagChar: WideChar;
begin
TotalSize := length(WebContext);
CurrPos := pos(FieldName,WebContext);
if CurrPos < 1 then
begin
Result := '';
Exit;
end
else
CurrPos := CurrPos + 1;
Count := 0;
while Count <> 4 do
begin
if WebContext[CurrPos] = '>' then Count := Count + 1;
CurrPos := CurrPos + 1;
end;
StartPos := CurrPos;
FlagChar := ' ';
CurrPos := CurrPos - 1;
while True do
begin
CurrPos := CurrPos + 1;
if CurrPos > TotalSize then
begin
Result := '';
Exit;
end;
if WebContext[CurrPos] = '<' then
begin
FlagChar := '<';
Continue;
end;
if (WebContext[CurrPos] = 'F') and (FlagChar = '<') then
begin
FlagChar := 'F';
Continue;
end;
if (WebContext[CurrPos] = 'O') and (FlagChar = 'F') then
begin
FlagChar := 'O';
Continue;
end;
if (WebContext[CurrPos] = 'N') and (FlagChar = 'O') then
begin
FlagChar := 'N';
Continue;
end;
if (WebContext[CurrPos] = 'T') and (FlagChar = 'N') then
begin
FlagChar := 'T';
Continue;
end;
if (WebContext[CurrPos] = '>') and (FlagChar = 'T') then Break;
end;//end while
EndPos := CurrPos - 7;
FieldSize := EndPos - StartPos + 1;
SetLength(FieldValue,FieldSize);
J := 1;
for I := StartPos to EndPos do
begin
FieldValue[J] := WebContext[I];
J := J + 1;
end;
Result := FieldValue;
end;function ReplaceString(ReplacedChar,Replace: string;WebContext: string): string;
var
CurrPos: Integer;
ReplacedSize: Integer;
TotalSize: Integer;
begin
Result := WebContext;
TotalSize := length(WebContext);
ReplacedSize := length(ReplacedChar);
while True do
begin
CurrPos := Pos(ReplacedChar,WebContext);
if CurrPos < 1 then Break;
WebContext := copy(WebContext,1,CurrPos - 1) + Replace
+ copy(WebContext,CurrPos + ReplacedSize,TotalSize - CurrPos - ReplacedSize + 1);
end;
Result := WebContext;
end;function GetEmail(email: string): string;
var
CurrPos: Integer;
TotalSize: Integer;
begin
TotalSize := length(email);
CurrPos := pos('>',email);
if CurrPos >= 1 then
email := copy(email,Currpos + 1,TotalSize - CurrPos);
CurrPos := pos('<',email); if CurrPos >= 1 then
email := copy(email,1,CurrPos - 1);
Result := email;end;
function GetWeb(WebContext: PChar): PChar;stdcall;
var
FieldName: string;
WebString: string;
MiddleString: string;
ResultString: string;
TotalSize: Integer;
//sabc : Integer;
begin
WebString := WideCharToString(WebContext);
FieldName := '>姓 '+ SwapLine + ' 名<';
ResultString := ReplaceString(Space,' ',GetFieldValue(FieldName,WebString)); FieldName := '>性 '+ SwapLine + ' 别<';
MiddleString := ReplaceString(Space,' ',GetFieldValue(FieldName,WebString));
ResultString := ResultString + SwapLine + MiddleString; FieldName := '>年 '+ SwapLine + ' 龄<';
MiddleString := ReplaceString(Space,' ',GetFieldValue(FieldName,WebString));
ResultString := ResultString + SwapLine + MiddleString; FieldName := '>联系地址<';
MiddleString := ReplaceString(Space,' ',GetFieldValue(FieldName,WebString));
ResultString := ResultString + SwapLine + MiddleString; FieldName := '>邮政编码<';
MiddleString := ReplaceString(Space,' ',GetFieldValue(FieldName,WebString));
ResultString := ResultString + SwapLine + MiddleString; FieldName := '>电 '+ SwapLine + ' 话<';
MiddleString := ReplaceString(Space,' ',GetFieldValue(FieldName,WebString));
ResultString := ResultString + SwapLine + MiddleString; FieldName := '>电子邮件<';
MiddleString := GetEmail(ReplaceString(Space,' ',GetFieldValue(FieldName,WebString)));
ResultString := ResultString + SwapLine + MiddleString; FieldName := '>工作单位<';
MiddleString := ReplaceString(Space,' ',GetFieldValue(FieldName,WebString));
ResultString := ResultString + SwapLine + MiddleString; FieldName := '>信件编号<';
MiddleString := ReplaceString(Space,' ',GetFieldValue(FieldName,WebString));
ResultString := ResultString + SwapLine + MiddleString; FieldName := '>发信时间<';
MiddleString := ReplaceString(Space,' ',GetFieldValue(FieldName,WebString));
ResultString := ResultString + SwapLine + MiddleString; FieldName := '>来信主题<';
MiddleString := ReplaceString(Space,' ',GetFieldValue(FieldName,WebString));
ResultString := ResultString + SwapLine + MiddleString;//} FieldName := '>具体内容<';
MiddleString := ReplaceString('<BR>',' ',ReplaceString (Space,' ',GetFieldValue(FieldName,WebString)));
ResultString := ResultString + SwapLine + MiddleString;
FieldName := '>信件状态<';
MiddleString := ReplaceString(Space,' ',GetFieldValue(FieldName,WebString));
ResultString := ResultString + SwapLine + MiddleString; FieldName := '>处理意见<';
MiddleString := ReplaceString('<BR>',SwapLine,ReplaceString(Space,' ',GetFieldValue(FieldName,WebString)));
ResultString := ResultString + SwapLine + MiddleString; //}
Result := PChar(ResultString);
end;