zoukankan      html  css  js  c++  java
  • 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;
     
  • 相关阅读:
    oracle报ORA-00911:invalid character
    转: ㊣华哥日记㊣ 12.14-如何去了解更多的东西
    App竞品技术分析 (3)减小安装包的体积(转)
    ***apache做301重定向的方法
    .htaccess是什么?.htaccess几个简单应用
    一个网页如何决定是当前页打开还是新窗口打开?
    响应式web设计之CSS3 Media Queries
    ***CSS魔法堂:选择器及其优先级
    Bootstrap3 为何无法显示Glyphicons 图标
    MySQL中tinytext、text、mediumtext和longtext详解
  • 原文地址:https://www.cnblogs.com/marklove/p/9704484.html
Copyright © 2011-2022 走看看