Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Register sf::RenderWindow to listen for WM_DEVICECHANGE Windows event  (Read 1366 times)

0 Members and 1 Guest are viewing this topic.

Martin379

  • Newbie
  • *
  • Posts: 4
    • View Profile
    • Email
Is there a way to do that?

I know how to do it in a win32 application.

Any help will be appreciated.

thanks!

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10988
    • View Profile
    • development blog
    • Email
Not directly (if at all). SFML abstracts the event handling and doesn't (yet) allow for custom interaction with it.
In the latest version the event you mentioned is used to track whrn a joystick is plugged in or unplugged.
There maybe a way to hook yourself into the event queue, by like using some WinAPI calls and using the native window handle, but you're basically on your own in that territory. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

I_HATE_FIDGET_SPINNERS

  • Newbie
  • *
  • Posts: 4
    • View Profile
It might be possible to intercept the message before it gets to the window proc function by using the SetWindowsHookEx function. Be prepared to spend a bit of time digging through MSDN to figure out how to get it working though.

 

anything