I am trying to determine when my keyboard is connected or disconnected. I have tried the following strategies:
RegisterDeviceNotification
U
Have you considered GetRawInputDeviceList() and GetRawInputDeviceInfo(), using RID_DEVICE_INFO for pData and checking it's dwType?
That will get you the initial state, then if your wndProc handles WM_INPUT_DEVICE_CHANGE you can use the params to detect add/remove, and the lParam can be sent straigth to GetRawInputDeviceInfo().
Per comments: The WM_INPUT_DEVICE_CHANGE will only arrive for apps that have called RegisterRawInputDevices() and specifically asked for this notification.