我创建了以下代码:
Function AnsiStringToStream(Const AString: AnsiString): TStream;
Begin
Result := TStringStream.Create(AString, TEncoding.ANSI);
End;
Run Code Online (Sandbox Code Playgroud)
但我是"W1057从'AnsiString'到'string'的隐式字符串转换"
他有什么问题吗?
谢谢.
我有一个小问题.API FindNextFile不会列出目录的全部内容C:\Windows\System32(仅限Windows 7).有人有任何解决方案?
代码[Delphi]:
Var
sAtr: String;
sPathName: String;
I: Integer;
iCont: Integer;
tHnd: THandle;
tArrAtr: TStringList;
tWDF: WIN32_FIND_DATA;
Begin
iCont := 0;
sAtr := '';
Result := TStringList.Create;
tArrAtr := TStringList.Create;
tHnd := FindFirstFile(PChar(sPath + '*.*'), tWDF);
If RightStr(sPath, 1) <> '\' Then
sPath := sPath + '\';
If tHnd = INVALID_HANDLE_VALUE Then
Exit;
Repeat
If (tWDF.dwFileAttributes And FILE_ATTRIBUTE_ARCHIVE) > 0 Then
If (String(tWDF.cFileName[0]) <> '.') Then
Begin
sPathName := sPath + String(tWDF.cFileName);
Result.Add(String(tWDF.cFileName) + sDel …Run Code Online (Sandbox Code Playgroud) 我正在创建一个多线程应用程序,它创建了一个TThread类的动态数组,但对我而言,这是一个谜,它导致错误'访问冲突'到'创建'
代码表格:
Unit UNT_Main;
Interface
Uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, UNT_Socks;
Type
TFRM_Main = Class(TForm)
Procedure FormCreate(Sender: TObject);
Private
Procedure OnUpload(Success: Boolean; SockAction: TSockAction);
Public
{ Public declarations }
End;
Var
FRM_Main: TFRM_Main;
Socks: Array Of TSocks;
SA: Array Of TSockAction;
Implementation
{$R *.dfm}
Procedure TFRM_Main.OnUpload(Success: Boolean; SockAction: TSockAction);
Begin
ShowMessage(SockAction.Response);
End;
Procedure TFRM_Main.FormCreate(Sender: TObject);
Var
I: Integer;
Begin
SetLength(Socks, 5);
SetLength(SA, 5);
For I := 0 To High(Socks)-1 Do
Begin
SA[I].SUrl := 'http://google.com.co';
Socks[I].Create(SA[I]); …Run Code Online (Sandbox Code Playgroud)