在Inno Setup中定义宽字符指针字段的结构Unicode
问题描述:
某些外部库(特别是Windows API)使用结构类型,其中某些字段是指向字符数组的指针。在Inno Setup中定义宽字符指针字段的结构Unicode
Inno Setup Unicode没有PChar
(PWideChar
)类型。如何定义一个使用宽字符数组指针类型的结构?
例如,我该如何定义SHFILEOPSTRUCT
structure?
type
TSHFileOpStruct = record
hwnd: HWND;
wFunc: UINT;
pFrom: { what type? }
pTo: { what type? }
fFlags: Word;
fAnyOperationsAborted: BOOL;
hNameMappings: HWND;
lpszProgressTitle: { what type? }
end;
答
使用string
型。在Inno Setup的统一Pascal脚本的string
型自动封送到PWideChar
样类型在某些情况下:
- 在
record
定义(问题是关于什么的)。 - 在参数和返回类型声明
external
functions。
所以SHFILEOPSTRUCT
结构的定义是:
type
TSHFileOpStruct = record
hwnd: HWND;
wFunc: UINT;
pFrom: string;
pTo: string;
fFlags: Word;
fAnyOperationsAborted: BOOL;
hNameMappings: HWND;
lpszProgressTitle: string;
end;
对于使用,请参阅Inno Setup invoke or replicate native Windows file copy operation。
在所有(?)其他环境中,string
保持其独特的内在功能从Pascal语言。