为什么这段代码声明 DISTINCT 类型?
ShlObj.pas 第 9922 行(如 Delphi XE 中):
type
BFFCALLBACK = function(Wnd: HWND; uMsg: UINT; lParam, lpData: LPARAM): Integer stdcall;
TFNBFFCallBack = type BFFCALLBACK;
{$EXTERNALSYM BFFCALLBACK}
在这里回答 David Heffernan 的评论,因为我认为这概述了可能的你为什么问这个?问题的相关背景。 Windows API 回调例程的过程类型被声明为类型别名(您知道,规范 API 名称 +“Pascalized”别名,有时反之亦然)。示例有 Windows.PIMAGE_TLS_CALLBACK
、ShlObj.LPFNDFMCALLBACK
等。上面显示的类型声明是一个例外。这就是我问的原因:-)
ShlObj.pas line 9922 (as in Delphi XE):
type
BFFCALLBACK = function(Wnd: HWND; uMsg: UINT; lParam, lpData: LPARAM): Integer stdcall;
TFNBFFCallBack = type BFFCALLBACK;
{$EXTERNALSYM BFFCALLBACK}
Answering to David Heffernan's comment here because i think this outlines a relevant background for possible why do you ask this? question.
Procedural types for callback routines of Windows API origin are declared as type aliases (you know, canonical API name + "Pascalised" alias, or vice versa sometimes). Examples are Windows.PIMAGE_TLS_CALLBACK
, ShlObj.LPFNDFMCALLBACK
et cetera. Type declaration shown above is an exception. Thats why i'm asking :-)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它只是强迫我们程序员使用TFNBFFCallBack而不是BFFCALLBACK的一种方法。如果它是别名,我们可以将其用于浏览信息结构。在不同的平台上,TFNBFFCallBack 可能指向与 BFFCALLBACK 不同的内容。
It is just a way to force us programmers to use TFNBFFCallBack instead of BFFCALLBACK. If it was an alias we could use either for the browse info structure. On a different platform TFNBFFCallBack could point to something different than BFFCALLBACK.