Quantcast
Channel: AutoHotkey Community
Viewing all articles
Browse latest Browse all 579

Ask for Help (v2) • Re: What is the correct way to pass NULL to a DllCall parameter that accepts a pointer to a string ?

$
0
0
 If I could add a bit more to what @just me mentioned,
when you read the Types of Arguments and Return Values section in the DllCall documentation regarding Ptr,
you'll find the following explanation:
Note: To pass a NULL handle or pointer, pass the integer 0.


Hope that helps.

By the way, using the Str type to pass an empty string is indeed used when you need to represent an actual empty string.
For example, when searching for a window and wanting to indicate the case where the title value is realy empty.
Here's a snippet from my actual script.

CODE:

DllCall("FindWindowEx", "Ptr",hTrayNotifyWnd, "Ptr",0, "Str","TrayInputIndicatorWClass", "Str","Tray Input Indicator", "Ptr") ;  When searching for a window with the title 'Tray Input Indicator.'
DllCall("FindWindowEx", "Ptr",hTrayNotifyWnd, "Ptr",0, "Str","TrayInputIndicatorWClass", "Str","", "Ptr") ; When searching for a window with an empty title.
DllCall("FindWindowEx", "Ptr",hTrayNotifyWnd, "Ptr",0, "Str","TrayInputIndicatorWClass", "Ptr",0, "Ptr") ; When not specifying a window title (since NULL was passed).

FindWindowExW function (winuser.h)

Statistics: Posted by Seven0528 — Today, 07:27



Viewing all articles
Browse latest Browse all 579

Trending Articles