From: Simon Armstrong Date: Thu, 2 Feb 2017 23:46:32 +0000 (+1300) Subject: invoke ReleaseDC for bbSystemDesktop commands X-Git-Url: https://jcornell.net/gitweb/gitweb.cgi?a=commitdiff_plain;h=e4e35ec40afa74fa85c24247fc7d559bf937b3ad;p=blitzmax.git invoke ReleaseDC for bbSystemDesktop commands --- diff --git a/mod/brl.mod/system.mod/system.win32.c b/mod/brl.mod/system.mod/system.win32.c index 4b5cb64..17ea3d4 100644 --- a/mod/brl.mod/system.mod/system.win32.c +++ b/mod/brl.mod/system.mod/system.win32.c @@ -498,18 +498,27 @@ void bbSystemStartAsyncOp( BBAsyncOp asyncOp,int asyncInfo,BBSyncOp syncOp,BBObj CreateThread( 0,0,asyncOpThread,p,0,&threadId ); } +int DesktopCaps(int index){ + HWND hwnd = GetDesktopWindow(); + HDC dc = GetDC(hwnd); + int caps = GetDeviceCaps(dc,index); + ReleaseDC(hwnd,dc); + return caps; +} + + int bbSystemDesktopWidth(){ - return GetDeviceCaps( GetDC( GetDesktopWindow() ),HORZRES ); + return DesktopCaps(HORZRES); } int bbSystemDesktopHeight(){ - return GetDeviceCaps( GetDC( GetDesktopWindow() ),VERTRES ); + return DesktopCaps(VERTRES); } int bbSystemDesktopDepth(){ - return GetDeviceCaps( GetDC( GetDesktopWindow() ),BITSPIXEL ); + return DesktopCaps(BITSPIXEL); } int bbSystemDesktopHertz(){ - return GetDeviceCaps( GetDC( GetDesktopWindow() ),VREFRESH ); + return DesktopCaps(VREFRESH); } diff --git a/mod/pub.mod/win32.mod/user32.bmx b/mod/pub.mod/win32.mod/user32.bmx index 2f610b8..3c615cc 100644 --- a/mod/pub.mod/win32.mod/user32.bmx +++ b/mod/pub.mod/win32.mod/user32.bmx @@ -723,6 +723,7 @@ Function SendMessageW( hWnd,MSG,wParam,lParam ) Function PostThreadMessageA( idThread,Msg,wParam,lParam ) Function PostThreadMessageW( idThread,Msg,wParam,lParam ) Function GetDC( hWnd ) +Function ReleaseDC( hwnd, hdc ) Function PostQuitMessage( nExitCode ) Function TranslateMessage( lpMsg:Byte Ptr ) Function DestroyWindow( hWnd )