Hi, does anyone know how to get the Window Handle of a Graphics window made in BMax in OpenGL using Graphics W,H,0 ?
I can do it in DirectX like this:
And as you can see I don't want to use GetActiveWindow() as it is not always accurate (I can mess it up by clicking away from the MaxIDE as the game is compiling for example).
I recall the person who helped me with this code in the first place saying that the hwnd for OpenGL was not stored in the Blitz modules, so would I need to make a module mod to get it? (Maybe BRL can, fingers crossed!)
Also how can a similar thing be done on Mac? I'm using this Objective C code in a .m file:
Then I'm passing that to another objective C function to get the window origin:
But basically it has the same issues where you can take the focus away from the game as it compiles and then you end up getting the window stats for a different window!
Any help much appreciated thanks! This code will make it into the next framework update for my customers.
I can do it in DirectX like this:
Method GetActiveWindowSafe%() 'For Win32 only. 'GetActiveWindow() 'This old method is sometimes unreliable! (e.g. if another window gets focused when this one is being created.) 'Use new more reliable method. Local my_driver:TD3D7Graphicsdriver=D3D7GraphicsDriver() Local my_graphics:TD3D7Graphics=my_driver.Graphics() Return my_graphics._hwnd End Method
And as you can see I don't want to use GetActiveWindow() as it is not always accurate (I can mess it up by clicking away from the MaxIDE as the game is compiling for example).
I recall the person who helped me with this code in the first place saying that the hwnd for OpenGL was not stored in the Blitz modules, so would I need to make a module mod to get it? (Maybe BRL can, fingers crossed!)
Also how can a similar thing be done on Mac? I'm using this Objective C code in a .m file:
NSWindow* macGetActiveWindow(){ NSAutoreleasePool *pool=[[NSAutoreleasePool alloc] init]; NSApplication *myApp; myApp=[NSApplication sharedApplication]; NSWindow *myWindow = [myApp keyWindow]; [pool release]; return myWindow; }
Then I'm passing that to another objective C function to get the window origin:
void macGetWindowOrigin(NSWindow *myWindow, int *x, int *y){ NSRect myFrame = [myWindow frame]; *x = myFrame.origin.x; *y = myFrame.origin.y; }
But basically it has the same issues where you can take the focus away from the game as it compiles and then you end up getting the window stats for a different window!
Any help much appreciated thanks! This code will make it into the next framework update for my customers.