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;
     
  • 相关阅读:
    实例、数据库和表空间(转载)
    异步邮件阻塞MVC请求
    发布Asp.Net MVC 注意事项
    CWebBrowser2 图片缩放,点击小图看大图
    Web服务器与客户端时差问题
    一些好用的eclipse插件
    ASP.NET Deployment and Configuration Problems
    第二届游戏开发者大会
    MVC 请求参数中带有HTML会引发Validation异常 ("A potentially dangerous Request.Form value was detected from the client")
    网络语言标准实施规范 ISO2009
  • 原文地址:https://www.cnblogs.com/marklove/p/9704484.html
Copyright © 2011-2022 走看看