zoukankan      html  css  js  c++  java
  • FormatBUFF

    function FormatEx(const AFormatStr: string; AParams: array of const): PChar;
    var
    MssageBuf: PChar;
    MssageParam: PDWORDArray;
    i, Len: Integer;
    begin
    try
    Result := nil;
    MssageParam := nil;
    if AFormatStr = '' then Exit;
    Len := Length(AParams);
    if Len > 0 then
    begin
    MssageBuf := Windows.HeapAlloc(Windows.GetProcessHeap, Const_HEAP_PTR, 1024);
    if MssageBuf = nil then Exit;
    MssageParam := Windows.HeapAlloc(Windows.GetProcessHeap, Const_HEAP_PTR, (Len * Sizeof(DWORD)));
    try
    if MssageParam = nil then Exit;
    for i := Low(AParams) to High(AParams) do
    if AParams[i].VType = vtString then
    MssageParam^[i] := DWORD(PChar(DWORD(AParams[i].VString) + 1))
    else
    MssageParam^[i] := DWORD(AParams[i].VInteger);
    Len := Windows.wvsprintf(MssageBuf, PChar(AFormatStr), PChar(MssageParam));
    MssageBuf[Len] := Char($0);
    finally
    if MssageParam <> nil then
    Windows.HeapFree(Windows.GetProcessHeap, 0, MssageParam);
    end;
    Result := PChar(MssageBuf);
    end
    else
    Result := PChar(AFormatStr);
    except
    on E: Exception do
    begin
      showmessage( E.Message);
    end;
    end;
    end;

  • 相关阅读:
    maven常用命令
    项目管理需要做的事情
    jinkins 部署过程
    怎么操作会导致MySQL锁表
    高性能Java代码的规范
    java8新特性(2)--接口的默认方法
    java8新特性1--Lambda表达式
    eclipse web项目
    js 0 "" null undefined
    Android分页加载
  • 原文地址:https://www.cnblogs.com/moonwind/p/4450387.html
Copyright © 2011-2022 走看看