16,748
社区成员
发帖
与我相关
我的任务
分享
unit Client;
interface
uses
Classes, windows, SysUtils, Forms, HPTypeDef, HPSocketSDKUnit;
type
Bootstrap = class
Input: TMemoryStream;
private
public
end;
implementation
function OnReceive(pSender: HP_Client; dwConnID: HP_CONNID;
const pData: Pointer; iLength: Integer): En_HP_HandleResult; stdcall;
begin
// Input.Write(pData^, iLength); 这里如何才能调用到Bootstrap类中的Input属性呢?
Result := HR_OK;
end;
unit Client;
interface
uses
Classes, windows, SysUtils, Forms, HPTypeDef, HPSocketSDKUnit;
type
TBootstrap = class
private
Input: TMemoryStream; //调整到这里。如果是在不同的单元使用Input, 要放到Public下面
public
end;
var
Bootstrap: TBootstrap;
implementation
function OnReceive(pSender: HP_Client; dwConnID: HP_CONNID;
const pData: Pointer; iLength: Integer): En_HP_HandleResult; stdcall;
begin
Bootstrap.Input.Write(pData^, iLength);
Result := HR_OK;
end;
initialization
Bootstrap := TBootstrap.Create(nil);
finalization
Bootstrap.Free;
end.
unit Client;
interface
uses
Classes, windows, SysUtils, Forms, HPTypeDef, HPSocketSDKUnit;
type
TBootstrap = class
Input: TMemoryStream;
private
public
end;
var
Bootstrap: TBootstrap;
implementation
function OnReceive(pSender: HP_Client; dwConnID: HP_CONNID;
const pData: Pointer; iLength: Integer): En_HP_HandleResult; stdcall;
begin
Bootstrap.Input.Write(pData^, iLength);
Result := HR_OK;
end;
initialization
Bootstrap := TBootstrap.Create(nil);
finalization
Bootstrap.Free;
end.