GetWindowModuleFileName function Null safety user32

int GetWindowModuleFileName(
  1. int hwnd,
  2. Pointer<Utf16> pszFileName,
  3. int cchFileNameMax
)

Retrieves the full path and file name of the module associated with the specified window handle.

UINT GetWindowModuleFileNameW(
  HWND   hwnd,
  LPWSTR pszFileName,
  UINT   cchFileNameMax
);

Implementation

int GetWindowModuleFileName(
    int hwnd, Pointer<Utf16> pszFileName, int cchFileNameMax) {
  final _GetWindowModuleFileName = _user32.lookupFunction<
      Uint32 Function(
          IntPtr hwnd, Pointer<Utf16> pszFileName, Uint32 cchFileNameMax),
      int Function(int hwnd, Pointer<Utf16> pszFileName,
          int cchFileNameMax)>('GetWindowModuleFileNameW');
  return _GetWindowModuleFileName(hwnd, pszFileName, cchFileNameMax);
}