Windows button sample code
This topic contains a code sample that toggles the identified Windows button down and then up.
int __cdecl InjectButtonPress(
__in int argc,
__in_ecount(argc) char **argv)
{
LPWSTR DevicePath;
HANDLE FileHandle;
BOOL b;
BYTE buffer;
HWND hwnd;
MSG msg;
DevicePath = GetDevicePath((LPGUID)&GUID_GPIOBUTTONS_NOTIFY_INTERFACE);
FileHandle = CreateFile(DevicePath,
GENERIC_WRITE,
0,
NULL,
OPEN_EXISTING,
0,
NULL);
buffer = GPIO_BUTTON_WINDOWS; //using GPIOBUTTONS_BUTTON_TYPE enum defined above
WriteFile(FileHandle, &buffer, sizeof(buffer), NULL, NULL); // send button down
buffer = GPIO_BUTTON_WINDOWS;
WriteFile(FileHandle, &buffer, sizeof(buffer), NULL, NULL); // send button up
return 0;
}
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for