delphi 动态调用API

好处没有这个API 也可以启动程序只是调用会出错.

function __IsNativeVhdBoot: Boolean;
type
  TIsNativeVhdBoot = function(
    NativeVhdBoot: pBOOL
  ): BOOL; stdcall;
var
  bNativeVhdBoot: pBOOL;
  NativeVhdBoot : TIsNativeVhdBoot;
begin
  Result := False;
  NativeVhdBoot := GetProcAddress(GetModuleHandle(kernel32), 'IsNativeVhdBoot');
  if (@NativeVhdBoot <> nil) then
  begin
    if not NativeVhdBoot(bNativeVhdBoot) then
      RaiseLastOSError;
    Result := bNativeVhdBoot^;
  end
  else
    RaiseLastOSError;
end;

  

固态调用 (没有这个API启动会失败)

function IsNativeVhdBoot(NativeVhdBoot:PBOOL):BOOL; external Kernel32 name 'IsNativeVhdBoot';

function _IsNativeVhdBoot:Boolean;
var
  pB:PBOOL;
begin
  Result := False;
  if IsNativeVhdBoot(pB) then
    Result := pB^
  else RaiseLastOSError;
end;

  

 

关于Delphi XE 5 中编译DevExpress VCL中的cxDateUtils单元

编译cxLibrary如下函数出错:

 

  1.  
    function GetEraYearOffset(const Name: string): Integer;
  2.  
    var
  3.  
    I: Integer;
  4.  
    begin
  5.  
    Result := 0;
  6.  
    for I := Low(EraNames) to High(EraNames) do
  7.  
    begin
  8.  
    if EraNames[I] = '' then
  9.  
    Break;
  10.  
    if AnsiStrPos(PChar(EraNames[I]), PChar(Name)) <> nil then
  11.  
    begin
  12.  
    Result := EraYearOffsets[I];
  13.  
    Exit;
  14.  
    end;
  15.  
    end;
  16.  
    end;

 

是因为SysUtils做了修改,对应修改如下:

 

  1.  
    function GetEraYearOffset(const Name: string): Integer;
  2.  
    var
  3.  
    I: Integer;
  4.  
    begin
  5.  
    Result := 0;
  6.  
    for I := Low(FormatSettings.EraInfo) to High(FormatSettings.EraInfo) do
  7.  
    begin
  8.  
    if FormatSettings.EraInfo[I].EraName = '' then
  9.  
    Break;
  10.  
    if AnsiStrPos(PChar(FormatSettings.EraInfo[I].EraName), PChar(Name)) <> nil
  11.  
    then
  12.  
    begin
  13.  
    Result := FormatSettings.EraInfo[I].EraOffset;
  14.  
    Exit;
  15.  
    end;
  16.  
    end;
  17.  
    end;

 

 

还有一处:

 

  1.  
        if AnsiPos('e', AFormat.ShortDateFormat) > 0 then 
  2.  
    AEraYearOffset := EraYearOffsets[ 1];

 

对应修改为:

 

  1.  
    if AnsiPos('e', AFormat.ShortDateFormat) > 0 then
  2.  
    AEraYearOffset := FormatSettings.EraInfo[ 1].EraOffset;

 

 

 

转载于:https://www.cnblogs.com/marklove/p/9704484.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值