Delphi

本类阅读TOP10

·分布式网络考试系统原型分析及实现
·游戏外挂设计技术探讨①
·使用HOOK随心监视Windows
·Delphi 水晶报表打包解决
·试题库开发中非文本数据的处理
·如何将几个DBGRID里的内容导入同一个EXCEL表中....的问题
·如何使用Delphi设计强大的服务器程序
·工人线程中关闭窗体的实现
·用DLL方式封装MDI子窗体。
·支持XP下托盘栏气球提示的托盘单元

分类导航
VC语言Delphi
VB语言ASP
PerlJava
Script数据库
其他语言游戏开发
文件格式网站制作
软件工程.NET开发
Borland delphi7的几个错误

作者:未知 来源:月光软件站 加入时间:2005-2-28 月光软件站

星期六编程发现了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的文档真是叫人受不了。

 

3Delphi7中公布了alphablend这个属性,可以在2000以上中实现窗体透明,但在98中不行。如果在98中用alphablend这个win32 api函数自己实现窗体透明,编译器又会报错(和属性同名肯定会啦)。



相关文章

相关软件