Skip to content

Commit

Permalink
feat: add UnregisterDeviceNotification API (#916)
Browse files Browse the repository at this point in the history
  • Loading branch information
halildurmus authored Oct 18, 2024
1 parent b33af48 commit d7bbc2c
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 1 deletion.
4 changes: 4 additions & 0 deletions packages/generator/data/win32_functions.json
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
4 changes: 4 additions & 0 deletions packages/win32/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 15 additions & 0 deletions packages/win32/lib/src/win32/user32.g.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8184,6 +8184,21 @@ final _UnregisterClass = _user32.lookupFunction<
int Function(
Pointer<Utf16> 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
Expand Down
2 changes: 1 addition & 1 deletion packages/win32/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
7 changes: 7 additions & 0 deletions packages/win32/test/api_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8871,6 +8871,13 @@ void main() {
Pointer<Utf16> lpClassName, int hInstance)>('UnregisterClassW');
expect(UnregisterClass, isA<Function>());
});
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<Function>());
});
test('Can instantiate UnregisterHotKey', () {
final user32 = DynamicLibrary.open('user32.dll');
final UnregisterHotKey = user32.lookupFunction<
Expand Down

0 comments on commit d7bbc2c

Please sign in to comment.