Hi, I have been looking through the forums but I could not find the answer to my question.
For my directinput joystick routine I need the HWND handle for the panda window, and am confused on how to get it.
Any help would be appreciated !
Here you go:
(HWND)window->get_graphics_window()->get_window_handle()->get_int_handle();
EDIT: Fixed and 100% sure now.
Thanks a million !!
Notice the edit, I thought it was get_os_handle() but it actually was get_int_handle().
Lol, thanks. I was already browsing all functions to find out what it should be.
Hm… Sorry to bother you again, but get_window_handle() does not seem to be member a of get_graphics_window() ?
It works for me, I even tested it by using the HWND to close the window:
SendMessage((HWND)(window->get_graphics_window()->get_window_handle()->get_int_handle()), WM_SYSCOMMAND, SC_CLOSE, 0);
Maybe you are using 1.6.2 and it wasn’t like this back then? I’m using 1.7.0.
Are you sure you have the necessary includes? Maybe you don’t see the members cause you are missing the headers.
Try for example:
#include "graphicsWindow.h"
In panda/c++ you need to include every class you are gonna use individually (in practice this is only necessary sometimes because some includes include others, etc), it’s a little troublesome at first but it’s better on the long term because it makes compilation faster.
EDIT: To find out what header you need for a class you can go here, among other possibilities: panda3d.org/dox/cxx/html/annotated.html
It is true, this interface is new as of 1.7.0.
David
Thanks for the help.
If there is no other way to get the handle, I’ll try to figure out how to download the latest cvs version. Never used cvs before…
Also, thanks for the annotated link, very usefull !
I just sent you a link to a dev snapshot of 1.7.0 for windows via pm.
That is extremely helpfull, thanks for all the help !
Hmm… I just came across another solution, just in case somebody needs the HWND as well:
You can get the handle with the text of the title bar of the console window.
For example, if you have used this:
framework.set_window_title(“MyWindow”);
you can get the handle like this:
HWND hwndConsole = FindWindowA( NULL, “MyWindow” );
Sometimes life is so easy…