DllHwnd

Obtains a window handle for use in DllCall’s when required.

Syntax:

DllHwnd(partial-winname)

Parameters:

(s) partial-winname the initial part of, or an entire, window name.

Returns:

(i) window handle on success or zero on failure.

 

Use this function to return a valid window handle (hWnd) of specified window. Some Dll’s require a window handle. This function will provide - in most cases - a usable window handle.

Note: "Partial-winname" is the initial part of a window name, and may be a complete window name. It is case-sensitive. You should specify enough characters so that "partial-windowname" matches only one existing window. If it matches more than one window, the most recently accessed window which it matches will be used. The windowname "" may be used as a shorthand way of referring to the WIL parent application window.

 

Example:


binbuf=BinaryAlloc(100)
hWnd=DllHwnd("")
DllCall("USER32.DLL",word:"GetClassNameA",word:hWnd,lpbinary:binbuf,word:100)
; Note DllCalls do not set EOD point in buffer.
BinaryEodSet(binbuf, 100)
a=BinaryPeekStr(binbuf, 0, 100)
BinaryFree(binbuf)
Message("Window class name is", a)
See Also:

Binary Operations, DllCall, DllCallbackCreate, DllCallbackDestroy, DllCall Additional information, DllHinst, IntControl 44, IntControl 46