diff --git a/packages/generator/data/win32_functions.json b/packages/generator/data/win32_functions.json index 0c2725bd7..8eda829ab 100644 --- a/packages/generator/data/win32_functions.json +++ b/packages/generator/data/win32_functions.json @@ -5795,6 +5795,10 @@ "prototype": "BOOL UnregisterClassW(\n LPCWSTR lpClassName,\n HINSTANCE hInstance\n);", "comment": "Unregisters a window class, freeing the memory required for the class." }, + "UnregisterDeviceNotification": { + "prototype": "BOOL UnregisterDeviceNotification(\n [in] HDEVNOTIFY Handle\n);", + "comment": "Closes the specified device notification handle." + }, "UnregisterHotKey": { "prototype": "BOOL UnregisterHotKey(\n HWND hWnd,\n int id\n);", "comment": "Frees a hot key previously registered by the calling thread." diff --git a/packages/win32/CHANGELOG.md b/packages/win32/CHANGELOG.md index d93ec1d54..536399325 100644 --- a/packages/win32/CHANGELOG.md +++ b/packages/win32/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to this project will be documented in this file. +## 5.6.2-wip + +- Add `UnregisterDeviceNotification` API (#916) + ## [5.6.1] - 2024-10-18 - Add `RegisterDeviceNotification`, `WTSRegisterSessionNotification`, and diff --git a/packages/win32/lib/src/win32/user32.g.dart b/packages/win32/lib/src/win32/user32.g.dart index c8726003b..0387dcf30 100644 --- a/packages/win32/lib/src/win32/user32.g.dart +++ b/packages/win32/lib/src/win32/user32.g.dart @@ -8184,6 +8184,21 @@ final _UnregisterClass = _user32.lookupFunction< int Function( Pointer lpClassName, int hInstance)>('UnregisterClassW'); +/// Closes the specified device notification handle. +/// +/// ```c +/// BOOL UnregisterDeviceNotification( +/// [in] HDEVNOTIFY Handle +/// ); +/// ``` +/// {@category user32} +int UnregisterDeviceNotification(Pointer Handle) => + _UnregisterDeviceNotification(Handle); + +final _UnregisterDeviceNotification = _user32.lookupFunction< + Int32 Function(Pointer Handle), + int Function(Pointer Handle)>('UnregisterDeviceNotification'); + /// Frees a hot key previously registered by the calling thread. /// /// ```c diff --git a/packages/win32/pubspec.yaml b/packages/win32/pubspec.yaml index 73b147660..0643ce085 100644 --- a/packages/win32/pubspec.yaml +++ b/packages/win32/pubspec.yaml @@ -1,7 +1,7 @@ name: win32 description: > Access common Win32 APIs directly from Dart using FFI — no C required! -version: 5.6.1 +version: 5.6.2-wip homepage: https://win32.pub repository: https://github.com/halildurmus/win32 issue_tracker: https://github.com/halildurmus/win32/issues diff --git a/packages/win32/test/api_test.dart b/packages/win32/test/api_test.dart index 1db94f868..c420b41ab 100644 --- a/packages/win32/test/api_test.dart +++ b/packages/win32/test/api_test.dart @@ -8871,6 +8871,13 @@ void main() { Pointer lpClassName, int hInstance)>('UnregisterClassW'); expect(UnregisterClass, isA()); }); + test('Can instantiate UnregisterDeviceNotification', () { + final user32 = DynamicLibrary.open('user32.dll'); + final UnregisterDeviceNotification = user32.lookupFunction< + Int32 Function(Pointer Handle), + int Function(Pointer Handle)>('UnregisterDeviceNotification'); + expect(UnregisterDeviceNotification, isA()); + }); test('Can instantiate UnregisterHotKey', () { final user32 = DynamicLibrary.open('user32.dll'); final UnregisterHotKey = user32.lookupFunction<