| 首页 | 电脑常识 | 程序设计 | 操作系统 | 语法 | 病毒安全 | 软件教程 | 硬件 | 数据库 | 多媒体 | 认证 | 下载 | 
首页>>程序设计 >>综合
Borland delphi7的几个错误

Borland delphi7的几个错误

电脑学习网,xuef.com,最全最新最权威的电脑知识网站.
免费计算机学习教程,电脑入门指南.

星期六编程发现了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 delphi7的shellapi.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函数自己实现窗体透明,编译器又会报错(和属性同名肯定会啦)。
相 关 文 章
  • delphi递归处理树型结构

  • 字符串函数大全

  • InfoPower4000 wwGrid控件的一些应用技巧

  • Windows Sockets错误码

  • SQLServer中按某字段排列名次

  • 转贴:Delphi Office 组件集常见问答

  • OOP程序设计实践

  • DelphiCodeToDoc--像JavaDoc一样的Delphi源码文档生成工具

  • 注册快捷方式

  • 使用Delphi 7控制Word 2000生成文档的方法

  • 学府网电脑学习的乐园
    中国电脑教学网,电脑爱好者的乐园,做最好最全的计算机学习网站.