mciSendString function Null safety winmm

int mciSendString(
  1. Pointer<Utf16> lpstrCommand,
  2. Pointer<Utf16> lpstrReturnString,
  3. int uReturnLength,
  4. int hwndCallback
)

The mciSendString function sends a command string to an MCI device. The device that the command is sent to is specified in the command string.

MCIERROR mciSendStringW(
  LPCTSTR lpszCommand,
  LPTSTR  lpszReturnString,
  UINT    cchReturn,
  HANDLE  hwndCallback
);

Implementation

int mciSendString(Pointer<Utf16> lpstrCommand, Pointer<Utf16> lpstrReturnString,
    int uReturnLength, int hwndCallback) {
  final _mciSendString = _winmm.lookupFunction<
      Uint32 Function(
          Pointer<Utf16> lpstrCommand,
          Pointer<Utf16> lpstrReturnString,
          Uint32 uReturnLength,
          IntPtr hwndCallback),
      int Function(
          Pointer<Utf16> lpstrCommand,
          Pointer<Utf16> lpstrReturnString,
          int uReturnLength,
          int hwndCallback)>('mciSendStringW');
  return _mciSendString(
      lpstrCommand, lpstrReturnString, uReturnLength, hwndCallback);
}