我一直在尝试两天以上,在我的Pascal脚本中使用MediaInfo.DLL
获取JPEG图像和MP4视频文件信息。在Inno Setup中使用MediaInfo库获取图像文件信息Pascal脚本
但我不断收到错误
运行时错误(6:366) - 访问冲突在地址0042FD23。阅读地址8065241E'。
错误主要指向(在6:366)。
我想不出什么问题导致尝试使用MediaInfo.DLL.
我加入到我的脚本代码即可获得媒体信息时,此异常:
[Files]
Source: Lamborghini_Aventador.jpg; DestDir: {tmp}; Flags: dontcopy
Source: MediaInfo.dll; DestDir: {tmp}; Flags: dontcopy
[Code]
#ifdef UNICODE
type
PWideChar = WideString;
#endif
const
StreamKind_Image = 5;
InfoKind_Text = 1;
function MediaInfo_New: Cardinal;
external '[email protected]{tmp}\MediaInfo.dll stdcall delayload';
function MediaInfo_Open(Handle: Cardinal; File__: PWideChar): Boolean;
external '[email protected]{tmp}\MediaInfo.dll stdcall delayload';
function MediaInfo_Get(Handle: Cardinal; StreamKind: Integer; StreamNumber: Integer; Parameter: PWideChar; KindOfInfo: Integer; KindOfSearch: Integer): PWideChar;
external '[email protected]{tmp}\MediaInfo.dll stdcall delayload';
procedure RetrieveImageInformation;
var
IHandle: Cardinal;
Width: PWideChar;
begin
ExtractTemporaryFile('Lamborghini_Aventador.jpg');
ExtractTemporaryFile('MediaInfo.dll');
IHandle := MediaInfo_New();
MediaInfo_Open(IHandle, PWideChar(ExpandConstant('{tmp}\Lamborghini_Aventador.jpg')));
Width := MediaInfo_Get(IHandle, StreamKind_Image, 0, 'Width', InfoKind_Text, 0);
Log('Width of the JPEG Image: ' + PWideChar(Width) + '.');
end;
其中的例外是线制作是:
Width := MediaInfo_Get(IHandle, StreamKind_Image, 0, 'Width', InfoKind_Text, 0);
我预计该编译器的输出将是Width of the JPEG Image: 1920.
我使用最新版本的Unicode Inno Setup Compiler(5.5.9 - U)
在此先感谢您的重要帮助。
你从哪里获得这些针对'MediaInfo.DLL'的DLL调用?他们是从Delphi实例中获得的吗? – GTAVLover
是@GTAVLover .........我认为他们很好.......你的建议也很好.......正是我想要的是通过'LoadStringFromFile '。:-) – Blueeyes789