You can hook into the Windows event queue yourself if really necessary.
Of course that will make your code platform specific.
Here's some (untested) example code:
#include <SFML/Graphics.hpp>
#include <Windows.h>
LONG_PTR SfmlEventCallback = 0x0;
LRESULT CALLBACK CustomEventCallback(HWND handle, UINT message, WPARAM wParam, LPARAM lParam)
{
if (message == WM_MENU...)
{
// Your event handling
}
return CallWindowProcW(reinterpret_cast<WNDPROC>(SfmlEventCallback), handle, message, wParam, lParam);
}
int main()
{
auto app = sf::RenderWindow{ { 640u, 480u }, "Custom Event Handling" };
HWND handle = app.getSystemHandle();
SfmlEventCallback = SetWindowLongPtrW(handle, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(CustomEventCallback));
while (app.isOpen())
{
for (auto event = sf::Event{}; app.pollEvent(event);)
{
if (event.type == sf::Event::Closed)
{
app.close();
}
}
app.clear();
app.display();
}
}