Getting windows handle of main window

BlitzMax Forums/BlitzMax Programming/Getting windows handle of main window

ozak(Posted 2006) [#1]
How do I do this in Max2D when initialized with the Graphics command?


ozak(Posted 2006) [#2]
I got an almost working video capture module :)


assari(Posted 2006) [#3]
http://www.blitzbasic.com/codearcs/codearcs.php?code=1318


Eikon(Posted 2006) [#4]
Method 1 (Can sometimes fail if other window is active):
Graphics 640, 480, 0, 60
Local hWnd:Int = GetActiveWindow()
Method 2 (Direct3D Only)
Graphics 640, 480, 0, 60
Local hWnd:Int = Primarydevice.hwnd
Method 3 (Error proof)
Graphics 640, 480, 0, 60
If cfgRenderer = 1 Then ' OpenGL
     tmpClass$ = "BBGLContext Window Class"
ElseIf cfgRenderer = 2 Then ' Direct3D
     tmpClass$ = "BBDX7Device Window Class"
EndIf

Local hWnd% = FindWindow(tmpClass$, "BlitzMax Application")