function StreamToVariant(Stream: TStream): OleVariant;
var
p: Pointer;
begin
Result := VarArrayCreate([0, Stream.Size - 1], varByte);
p := VarArrayLock(Result);
try
Stream.Position := 0;
Stream.Read(p^, Stream.Size);
finally
VarArrayUnlock(Result);
end;
end;
function StringlistToVariant(aStrlist: TStrings): OleVariant;
var
hStream: TStream;
begin
hStream := TMemoryStream.Create;
try
aStrlist.SaveToStream(hStream);
hStream.Seek(0, soFromBeginning);
Result := StreamToVariant(hStream);
finally
hStream.Free;
end;
end;
var
PostList: TStringList;
Post: OleVariant;
begin
PostList := TStringList.Create;
PostList.Add('url=' + EncodeURL(url));
PostList.Add('&body=' + HTTPEncode(UTF8Encode(Html)));
Post := StringlistToVariant(PostList);
end;
'삽질 > Delphi' 카테고리의 다른 글
[Delphi] ComPort 오류 수정 (0) | 2020.08.03 |
---|---|
[Delphi] 기본 프린터 설정 및 정보 가져오기 (0) | 2020.05.28 |
[Delphi] Webbrowser html 가져오기 (0) | 2019.06.14 |
[Delphi] 중국어 번체<->간체 (0) | 2019.06.14 |
[Delphi] 듀얼모니터에 폼 띄우기 (0) | 2018.01.09 |
댓글