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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - hadesfury

Pages: [1]
1
Window / Get win32 window handle (HWND) *SOLVED*
« on: September 15, 2010, 04:09:47 pm »
Quote from: "iiingo"


Well.. now it's possible to access the window handle from a sf::Window, but probably you'll want to be able to do sf::RenderWindow->GetWindowHandle() so lets do our last hack:
( sf::RenderWindow uses private inheritance from sf::Window so it will not be possible to just call GetWindowHandle() from the base class ).

FILE: src\SFML\Graphics\RenderWindow.hpp
Code: [Select]

public:
WindowHandle GetWindowHandle(void);


FILE: \src\SFML\Graphics\RenderWindow.cpp
Code: [Select]

WindowHandle RenderWindow::GetWindowHandle( void ) const {
return Window::GetWindowHandle();
}


That's it! now recompile sfml, if you're on Linux or Mac you must add the GetWindowHandle() method to the other window creation methods to get this code to work.

/ iiingo


Just because this code help me a lot to make the port to SFML ... I think it's quite obvious but you need to add the const keyword to the function in RenderWindow.hpp


FILE: src\SFML\Graphics\RenderWindow.hpp
Code: [Select]

public:
WindowHandle GetWindowHandle(void) const;

Pages: [1]