Article

From:
To:
All
Subject:
Importing functions with PWideChar params in v5.4.0
Newsgroup:
jrsoftware.innosetup

Importing functions with PWideChar params in v5.4.0

I've moved to v5.4.0 (u) recently and found it very good.
I've managed to port an old, complex script with tons of include files and 
preprocessing. I usually use a self-made library (compiled with Delphi 
2010) to serve the scripted code, and haven't faced any problems till 
today.

Today I tried to move some code excerpts from my Delphi library to Pascal script and came across a limitation introduced with v5.4.0: no PChar or PWideChar.
Some Windows API prototypes require PWideChar params to be passed; such param types cannot be just replaced by String.
Examples:      function SHGetFileInfo (        pszPath: PWideChar <<<<------        dwFileAttributes: DWORD;        var psfi: TSHFileInfo;        cbFileInfo,        uFlags: UINT): DWORD;
     procedure SHChangeNotify (        wEventId: Integer;        uFlags: UINT;        dwItem1, dwItem2: Pointer); <<<<------

In SHChangeNotify() when the 2nd param is shcnf_path, dwItem1 must be a PWideChar(some_path). For instance:
    SHChangeNotify (       shcne_attributes,       shcnf_path or shcnf_flush,       pszPath, // PWideChar(some_path)       nil);

How declare it as import those function? How to pass the "pszPath" param?
Thanks in advance.
FYI: Phrase searches are enclosed in either single or double quotes
 
 
Originally created by
Tamarack Associates
Thu, 28 Mar 2024 12:44:10 UTC
Copyright © 2009-2024
HREF Tools Corp.