What is the mostly correct way to pass NULL into DllCall string parameters (e.g. for ShellExecuteW function): as a ('Str', ''), or as a ('Str', 0) ?
PS. The Autohotkey Reference explains passing NULL for numeric parameters, but does not cover this point for string parameters.
Correct passing NULL into DllCall string parameters Topic is solved
Correct passing NULL into DllCall string parameters
Please post your script code inside [code] ... [/code] block. Thank you.
Re: Correct passing NULL into DllCall string parameters Topic is solved
For your example ShellExecuteW
LPCWSTR is a 32-bit pointer to a constant string of 16-bit Unicode characters, which MAY be null-terminated. So you could use "Ptr", 0
Maybe you find this useful: viewtopic.php?t=99817
And look at the explanation by lexikos: viewtopic.php?p=25611#p25611
LPCWSTR is a 32-bit pointer to a constant string of 16-bit Unicode characters, which MAY be null-terminated. So you could use "Ptr", 0
Maybe you find this useful: viewtopic.php?t=99817
And look at the explanation by lexikos: viewtopic.php?p=25611#p25611
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile
Re: Correct passing NULL into DllCall string parameters
I use this tool all the time, TY
Please post your script code inside [code] ... [/code] block. Thank you.
Re: Correct passing NULL into DllCall string parameters
e.g. with "Ptr"
or or or... all (many) roads lead to Rome
Use whatever is most understandable or clear to you
Code: Select all
ShellExecute(handle, File, Operation, ...)
{
DllCall("shell32\ShellExecuteW", "Ptr", handle ; HWND hwnd
, "Ptr", (Operation ? StrPtr(Operation) : 0) ; LPCWSTR lpOperation
, "Str", File ; LPCWSTR lpFile
, ...
}
Use whatever is most understandable or clear to you
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile