windows - 如何枚举 RT_VERSION 资源语言?

标签 windows delphi

我目前正在尝试从 RT_VERSION 资源类型中枚举所有资源语言。 到目前为止,这就是我没有运气的情况,因为我的回调过程根本没有触发。

function TEnumResLangProc (hModule: HMODULE; lpszType, lpszName : PChar; wIDLanguage : Word; lParam : Longint) : Bool; stdcall;
begin
  MessageBox(0, lpszName, '', 0); // For testing
  MessageBox(0, lpszType, '', 0); // For testing
  result := true;
end;

if not EnumResourceLanguages (HINSTANCE, RT_VERSION, PChar('1'), @TEnumResLangProc, 0)
then RaiseLastOSError;

我总是收到错误代码 1813,而且找不到任何相关文档。我也不确定“索引”参数 PChar('1') 我做错了什么以及如何枚举所有 RT_VERSION 语言?

编辑:

需要值 1031

enter image description here

最佳答案

此错误代码为 ERROR_RESOURCE_TYPE_NOT_FOUND。这意味着在指定的模块中没有该类型和名称的资源。

The specified resource type cannot be found in the image file.

请注意错误代码已记录在案:http://msdn.microsoft.com/en-us/library/windows/desktop/ms681381.aspx

很可能这个名字是错误的。您是要传递 MakeIntResource(1) 还是 '#1'

您的回调函数应设置返回值。编译器会警告你这个错误。你真的应该启用并注意警告。此外,类型声明不是 64 位兼容的,但我怀疑这在这里​​很重要。

关于windows - 如何枚举 RT_VERSION 资源语言?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24082477/

相关文章:

windows - 在 ubuntu 服务器上使用 git

windows - 在 Windows Server 2008 上安装 javascript 驱动程序 Mongodb-native

windows - Delphi中如何填写 "waveInGetDevCaps"函数参数?

delphi - 为什么我在使用 TNetHttpRequest 时收到错误 "security error 12175"

node.js - 构建脚本在 Windows 上失败,但在 Linux 或 OSX 上不会

c# - 使用 .NET 的 Windows Shell 集成

java - Windows:从 32 位 Java 运行 reg 命令时取消 WOW6432Node 注册表项映射

Delphi:引用frame中thread的control

delphi - Delphi 中创建自身实例的类函数

image - 无法使用 postgreSQL lo_export 和 delphi 7 创建服务器文件 "c:/myimage.jpg"