you can use GetWindowRect for the whole window size, and GetClientRect if you want the area inside the borders only (active area or client area), for the HWND parameter, you need to #include "globstruct.h" and pass g_pGlob->hWnd for it:
#include "globstruct.h"
..
..
...
RECT rc;
GetClientRect ( g_pGlob->hWnd, &rc );
int newWidth = rc.right - rc.left;
int newHeight = rc.bottom - rc.top;
note that whenever you use dbSetDisplayMode, you will have to reload all your media
also, a more efficient way to do this, is to intercept the window procedure of GDK window, here is an example:
#include "DarkGDK.h"
#include "globstruct.h"
WNDPROC OldProc; //could be a global variable
HRESULT CALLBACK NewProc(HWND Hw,UINT Msg,WPARAM wParam,LPARAM lParam)
{
switch(Msg)
{
// intercept any messages you want here
//in your case, you want the WM_SIZE
case WM_SIZE:
{
//this will be called everytime the window size changes, including maximizing and minimizig
break;
}
}
return CallWindowProc(OldProc,Hw,Msg,wParam,lParam);
}
void DarkGDK ( void )
{
OldProc=(WNDPROC)SetWindowLongPtr(g_pGlob->hWnd,GWLP_WNDPROC,(LONG_PTR)NewProc);
...
...
...
}
if you want to know what's going on there, you are replacing the window procedure of the DarkGDK window, and storing the old one, so that, all windows messages are sent to your new procedure, and then your new procedure does whatever it wants, and then (optionally) calls the original DarkGDK procedure
basically put your code inside the WM_SIZE case, for example, you can use LOWORD ( lParam ) for the width and HIWORD ( lParam ) as the height for the new display mode:
int newWidth = LOWORD ( lParam );
int newHeight = HIWORD ( lParam );
dbSetDisplayMode ( newWidth, newHeight, 32 );
also, you can have this code, inside the WM_SIZE:
switch ( wParam )
{
case SIZE_MAXIMIZED:
//window maximized
break;
case SIZE_MINIMIZED:
//window minimized
break;
case SIZE_RESTORED:
//window restored
break;
}
more info on the WM_SIZE:
http://msdn.microsoft.com/en-us/library/ms632646%28v=vs.85%29.aspx
also note that you can intercept any windows message sent, for example, you can intercept WM_GETMINMAXINFO to adjust the window so that it can't be re-sized, or WM_PAINT to do something right before presenting the swap chain, or WM_CLOSE/WM_DESTROY/WM_QUIT if you want to make sure that the user wants to quit, by sending a MessageBox(...) and maybe saving the game if you want, you can do lots of things, you can see the windows messages that could be sent here:
http://msdn.microsoft.com/en-us/library/ff468922%28v=VS.85%29.aspx