var
BinBuffer: TResourceStream;
ThrdId: THandle;
ThrdHandle: THandle;
begin
BinBuffer := TResourceStream.Create(HInstance, 'BIN_RES', RT_RCDATA);
// 加载打包进资源中的bin程序段
try
ThrdHandle := CreateThread(nil, 0, BinBuffer.Memory, nil, 0, ThrdId);
// 建立线程执行Bin程序段
// 其中BinBuffer.Memory指向bin程序的入口
WaitForSingleObject(ThrdHandle, INFINITE);
// 等待bin程序段执行完成
finally
CloseHandle(ThrdHandle);
// 释放线程
end;
BinBuffer.Free;
end;