- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在我的 32 位应用程序中,我使用 FindRegisteredPictureFileFormats unit provided by Cosmin Prund =>(How to get all of the supported file formats from Graphics unit?)。
我需要相同的但64位的。 David Heffernan 回答说已经有 64 位版本了。这段代码可以公开吗?
非常感谢!!
最佳答案
我相信这个单元可以满足您的需求。我已经在 32 位和 64 位 Windows 上测试了它,无论是否带有运行时包。我没有用自上而下的内存分配来测试它,但我不相信存在指针截断错误。
unit FindRegisteredPictureFileFormats;
{$POINTERMATH ON}
interface
uses Classes, Contnrs;
// Extracts the file extension + the description; Returns True if the hack was successful,
// False if unsuccesful.
function GetListOfRegisteredPictureFileFormats(List: TStrings): Boolean;
// This returns the list of TGraphicClass registered; True for successful hack, false
// for unsuccesful hach
function GetListOfRegisteredPictureTypes(List: TClassList): Boolean;
implementation
uses Graphics;
type
TRelativeCallOpcode = packed record
OpCode: Byte;
Offset: Integer;
end;
PRelativeCallOpcode = ^TRelativeCallOpcode;
TLongAbsoluteJumpOpcode = packed record
OpCode: array [0 .. 1] of Byte;
Destination: Cardinal;
end;
PLongAbsoluteJumpOpcode = ^TLongAbsoluteJumpOpcode;
TReturnTList = function: TList;
// Structure copied from Graphics unit.
PFileFormat = ^TFileFormat;
TFileFormat = record
GraphicClass: TGraphicClass;
Extension: string;
Description: string;
DescResID: Integer;
end;
function FindFirstRelativeCallOpcode(StartOffset: NativeUInt): NativeUInt;
var
Ram: ^Byte;
i: Integer;
PLongJump: PLongAbsoluteJumpOpcode;
begin
Ram := nil;
PLongJump := PLongAbsoluteJumpOpcode(@Ram[StartOffset]);
if (PLongJump^.OpCode[0] = $FF) and (PLongJump^.OpCode[1] = $25) then
{$IF Defined(WIN32)}
Result := FindFirstRelativeCallOpcode(PNativeUInt(PLongJump^.Destination)^)
{$ELSEIF Defined(Win64)}
Result := FindFirstRelativeCallOpcode(PNativeUInt(PLongJump^.Destination + StartOffset + SizeOf(PLongJump^))^)
{$ELSE}
{$MESSAGE Fatal 'Architecture not supported'}
{$ENDIF}
else
begin
for i := 0 to 64 do
if PRelativeCallOpcode(@Ram[StartOffset + i])^.OpCode = $E8 then
Exit(StartOffset + i + PRelativeCallOpcode(@Ram[StartOffset + i])
^.Offset + 5);
Result := 0;
end;
end;
procedure FindGetFileFormatsFunc(out ProcAddr: TReturnTList);
var
Offset_from_RegisterFileFormat: NativeUInt;
Offset_from_RegisterFileFormatRes: NativeUInt;
begin
Offset_from_RegisterFileFormat := FindFirstRelativeCallOpcode(NativeUInt(@TPicture.RegisterFileFormat));
Offset_from_RegisterFileFormatRes := FindFirstRelativeCallOpcode(NativeUInt(@TPicture.RegisterFileFormatRes));
if (Offset_from_RegisterFileFormat = Offset_from_RegisterFileFormatRes) then
ProcAddr := TReturnTList(Pointer(Offset_from_RegisterFileFormat))
else
ProcAddr := nil;
end;
function GetListOfRegisteredPictureFileFormats(List: TStrings): Boolean;
var
GetListProc: TReturnTList;
L: TList;
i: Integer;
begin
FindGetFileFormatsFunc(GetListProc);
if Assigned(GetListProc) then
begin
Result := True;
L := GetListProc;
for i := 0 to L.Count - 1 do
List.Add(PFileFormat(L[i])^.Extension + '=' + PFileFormat(L[i])
^.Description);
end
else
Result := False;
end;
function GetListOfRegisteredPictureTypes(List: TClassList): Boolean;
var
GetListProc: TReturnTList;
L: TList;
i: Integer;
begin
FindGetFileFormatsFunc(GetListProc);
if Assigned(GetListProc) then
begin
Result := True;
L := GetListProc;
for i := 0 to L.Count - 1 do
List.Add(PFileFormat(L[i])^.GraphicClass);
end
else
Result := False;
end;
end.
关于delphi - 如何从 VCL.Graphics 获取所有已注册的文件格式...但 64 位,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35802270/
一些背景(是 TLabel and TGroupbox Captions Flicker on Resize 的延续): 所以,我有一个应用程序可以加载不同的插件并创建一个TPageControl 上
我正在从 this handy template 复制一些 VCL 规则并在最新稳定的 Varnish4 上运行。但是 VCL 的这一部分: vcl 4.0; sub vcl_init { #
无论如何,这就是我的分析。今天早上,我将我的应用程序“分发”给了我们的组织,结果发现,在 XE8 中对这个旧的 win32 应用程序进行了一个月的新工作后,不使用 Windows 7“Basic”主题
在执行命令时 sudo service varnish reload 我收到以下错误: nish@styx:~$ sudo service varnish reload * Reloading HT
所以我第一次使用 Varnish 。我花了很多时间阅读它是如何工作的,但我无法弄清楚如何有选择地清除缓存。 就像说我有一个这样的网址 /?account=123&url=google.com 另一个喜
首先,维基百科将控制面板小程序定义为: graphical user interface which allows users to view and manipulate basic system
我的主窗体(我的图像中的 form1)中央有一个页面控件,我想打开停靠在该页面控件中的其他表单。因为我的子窗体上有很多控件,所以我需要垂直和水平滚动条(在子窗体上我有事件滚动条选项处于事件状态),但这
在Varnish中,std.log子例程是否会对性能产生影响,我应该关注该影响?例如,如果我将它称为请求的3-4次,那么在处理大量请求时会产生累积效果吗? 据我所知,std.log通过请求锁定,写入消
VCL中有几个内置子例程; vcl_recv,vcl_pipe,vcl_pass,vcl_hit,vcl_miss等; 引用https://varnish-cache.org/docs/4.1/use
我有以下形式的 URL: http://some-site.com/api/v2/portal-name/some/webservice/call 我要获取的数据需要 http://portal-na
我现在遇到了一个相当罕见的情况。我有一个直接与 Windows 消息队列交互的应用程序。该应用程序还使用 LuaJIT 运行外部 Lua 脚本。我想要为这些脚本提供调试工具,因此我创建了一个普通的 V
使用 Delphi 7 IDE 进行调试时,如何单步执行程序文件/borland/delphi7/source 文件夹中的代码? 听起来是个愚蠢的问题,但好奇的人想要调试。 (并不是说我认为源有什么问
在我的编程团队中,我们都使用 Delphi XE2 Professional。我们刚刚发现,在不同的计算机上,可用的 VCL 样式数量不同。 VCL 样式从何而来?我是否需要小心地将样式从一个 Del
我注意到,当启用 VCL-Styles 时,即使没有按下 Alt 键,也会使用热键选择菜单中的项目。 这会干扰我的用户界面的其余部分,并且我发现样式库改变热键的行为非常奇怪。 我可以以某种方式消除这种
我有一个源自 TMemo 的控件。它工作得很好,直到我第一次使用 Delphi XE7 VCL Styles。在Delphi XE7下,样式不应用于控件的滚动条。如果使用深色主题/风格,看起来很糟糕,
我一直在尝试将我拥有的单位从 VCL 转换为 FMX。我使用的库之一是用于 TpenStyle 的 VCL.Graphics: wallstyle,pathstyle,solvedpathstyle:
我正在设置主菜单字体(通过 Screen.MenuFont)以匹配程序中其他地方使用的字体的名称/大小。但主菜单不会随表单的其余部分一起刷新 - 我必须将鼠标移到每个菜单项上才能让它以新字体重新绘制该
我正在设置主菜单字体(通过 Screen.MenuFont)以匹配程序中其他地方使用的字体的名称/大小。但主菜单不会随表单的其余部分一起刷新 - 我必须将鼠标移到每个菜单项上才能让它以新字体重新绘制该
我为其编写软件的产品之一是会计类应用程序。它用 C++ 编写,使用 C++ Builder 和 VCL 控件,连接到运行在 Linux 上的 PostgreSQL 数据库。 PostgreSQL 数据
我正在创建一个包含多个表单的 VCL 表单应用程序。我创建了一个名为 formCreateAppointment 的新表单。 我正在尝试通过 menuItem 中的这段代码加载表单: formCrea
我是一名优秀的程序员,十分优秀!