Borland delphi7的几个错误

星期六编程发现了Borland delphi7的几个错误。

1 win32 api中有如下一个函数:

The ExtractIconEx function retrieves the handle of an icon from the specified executable file, dynamic-link library (DLL), or icon file.

 

HICON ExtractIconEx(

 

    LPCSTR lpszFile,  

    int nIconIndex,   

    HICON FAR * phiconLarge,  

    HICON FAR * phiconSmall,  

    UINT nIcons   

   );      

 

 

Parameters

 

lpszFile

 

Pointer to a null-terminated string specifying the name of an executable file, DLL, or icon file.

 

nIconIndex

 

Specifies the index of the icon to retrieve. If this value is 0, the function returns the handle of the first icon in the specified file. If this value is -1 and phIconLargeand phiconSmall are both NULL, the function returns the total number of icons in the specified file.

 

phiconLarge

 

Pointer to an array of handles of large icons returned. This parameter can be NULL.

 

phiconSmall

 

Pointer to an array of handles of small icons returned. This parameter can be NULL.

 

nIcons

 

Specifies the count of the number of icons to extract.

 

 

 

Return Values

 

If the function succeeds, the return value is the handle to an icon. If the file specified was not an executable file, DLL, or icon file, the return value is 1. If no icons were found in the file, the return value is NULL.

 

Borland delphi7shellapi.Pas文件中却声明成这样:

{$EXTERNALSYM ExtractIconEx}

function ExtractIconEx(lpszFile: PChar; nIconIndex: Integer;

  var phiconLarge, phiconSmall: HICON; nIcons: UINT): UINT; stdcall;

原型是HICON指针,Borland直接声明成HICON

如要使用这个函数只好重新声明。

给大家一个声明的例子:

type ThIconArray = array[0..0] of hIcon;
type PhIconArray = ^ThIconArray;

function ExtractIconEx(lpszFile: PAnsiChar;
                       nIconIndex: Integer;
                       phiconLarge : PhIconArray;
                       phiconSmall: PhIconArray;
                       nIcons: UINT): UINT; stdcall;
  external 'shell32.dll' name 'ExtractIconEx';

2Delphi7 sdk帮助里的这个函数也有问题:

The ExtractIcon function retrieves the handle of an icon from the specified executable file, dynamic-link library (DLL), or icon file.

HICON ExtractIcon(

 

    HINSTANCE hInst,    // instance handle

    LPCTSTR lpszExeFileName,     // filename of file with icon

    UINT nIconIndex        // index of icon to extract

   );     

Parameters

hInst

Identifies the instance of the application calling the function.

lpszExeFileName

Points to a null-terminated string specifying the name of an executable file, DLL, or icon file.

nIconIndex

Specifies the index of the icon to retrieve. If this value is 0, the function returns the handle of the first icon in the specified file. If this value is -1, the function returns the total number of icons in the specified file.

Return Values

If the function succeeds, the return value is the handle to an icon. If the file specified was not an executable file, DLL, or icon file, the return is 1. If no icons were found in the file, the return value is NULL.

NIconIndex为UNIT型不能取负,注释却说“If this value is -1, the function returns the total number of icons in the specified file.”但返回值却没有提到可以返回 “the total number of icons in the specified file”。实际使用中确实也不能取-1,不过好想delphi5中可以这样用。Borland的文档真是叫人受不了。

 

3 Delphi7 中公布了 alphablend 这个属性,可以在 2000 以上中实现窗体透明,但在 98 中不行。如果在 98 中用 alphablend 这个 win32 api 函数自己实现窗体透明,编译器又会报错(和属性同名肯定会啦)。
1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。 1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。 1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值