invoke ReleaseDC for bbSystemDesktop commands
authorSimon Armstrong <Simon Armstrong>
Thu, 2 Feb 2017 23:46:32 +0000 (12:46 +1300)
committerSimon Armstrong <Simon Armstrong>
Thu, 2 Feb 2017 23:46:32 +0000 (12:46 +1300)
mod/brl.mod/system.mod/system.win32.c
mod/pub.mod/win32.mod/user32.bmx

index 4b5cb645270d2f82708f8e8fded520c7f9e2d969..17ea3d4d97726797fe7d7dc7e1803e1c58b828e8 100644 (file)
@@ -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);
 }
index 2f610b84e4d4b3ff3cb5419f8f143eb86e847ac2..3c615ccbfbfe1166300257ea80a48911b469c1d6 100644 (file)
@@ -723,6 +723,7 @@ Function SendMessageW( hWnd,MSG,wParam,lParam )
 Function PostThreadMessageA( idThread,Msg,wParam,lParam )\r
 Function PostThreadMessageW( idThread,Msg,wParam,lParam )\r
 Function GetDC( hWnd )\r
+Function ReleaseDC( hwnd, hdc )\r
 Function PostQuitMessage( nExitCode )\r
 Function TranslateMessage( lpMsg:Byte Ptr )\r
 Function DestroyWindow( hWnd )\r