SetWindowText function Null safety user32

int SetWindowText(
  1. int hWnd,
  2. Pointer<Utf16> lpString
)

Changes the text of the specified window's title bar (if it has one). If the specified window is a control, the text of the control is changed. However, SetWindowText cannot change the text of a control in another application.

BOOL SetWindowTextW(
  HWND    hWnd,
  LPCWSTR lpString
);

Implementation

int SetWindowText(int hWnd, Pointer<Utf16> lpString) {
  final _SetWindowText = _user32.lookupFunction<
      Int32 Function(IntPtr hWnd, Pointer<Utf16> lpString),
      int Function(int hWnd, Pointer<Utf16> lpString)>('SetWindowTextW');
  return _SetWindowText(hWnd, lpString);
}