GetDlgItemText function Null safety user32

int GetDlgItemText (
  1. int hDlg,
  2. int nIDDlgItem,
  3. Pointer<Utf16> lpString,
  4. int cchMax
)

Retrieves the title or text associated with a control in a dialog box.

UINT GetDlgItemTextW(
  HWND   hDlg,
  int    nIDDlgItem,
  LPWSTR lpString,
  int    cchMax
);

Implementation

int GetDlgItemText(
    int hDlg, int nIDDlgItem, Pointer<Utf16> lpString, int cchMax) {
  final _GetDlgItemText = _user32.lookupFunction<
      Uint32 Function(
          IntPtr hDlg, Int32 nIDDlgItem, Pointer<Utf16> lpString, Int32 cchMax),
      int Function(int hDlg, int nIDDlgItem, Pointer<Utf16> lpString,
          int cchMax)>('GetDlgItemTextW');
  return _GetDlgItemText(hDlg, nIDDlgItem, lpString, cchMax);
}