creeping Posted June 2, 2007 Share Posted June 2, 2007 (edited) I play Battlefield 2142, it can run in full screen mode (default) or window mode (set by altering the command line switches) in the game shortcut, this which I have done.The reason for windows mode: If the game crashes it usually freezes the computer which can avoided if its run in a window.Within the game settings I have set the resolution to 1024x768.I wish to make the window appear as if its running in full screen mode so it looks exactly the same as the default mode. So the windows title bar is not visibl and you can not see the edge of the window at the sides or bottom.The game screen should take up the whole desktop to the very edge of each corner and not one pixel should be off the edge of the screen.Here is a screen shot of how it looks in window mode:http://img167.imageshack.us/img167/9327/bf2142fh9.jpgI have tried using WinMove() But how do I take into account the title bar and edges of the window? I'm just being fuzzy as I want the windowed game screen to be a replica of the full screen.Is there another way to do this? Such as a function like: WinSetClientSize(x, y, width, height)Thanks. Edited June 2, 2007 by creeping Link to comment Share on other sites More sharing options...
Xajar Posted June 12, 2007 Share Posted June 12, 2007 I recently made a script like that for another game. It will adjust the game window to hide the title bar, and borders, as well as adjust to the taskbar size and position. expandcollapse popup#include<Array.au3> AutoItSetOption("WinTitleMatchMode", 4) $Title = 'Civilization IV' WinActivate( $Title ) $Taskbar = WinGetPos("classname=Shell_TrayWnd") ;Returns (x,y,w,h) $Taskbar_X = $Taskbar[0] $Taskbar_Y = $Taskbar[1] $Taskbar_W = $Taskbar[2] $Taskbar_H = $Taskbar[3] $Window = WinGetPos( $Title ) ;Returns (x,y,w,h) $Window_X = $Window[0] $Window_Y = $Window[1] $Window_W = $Window[2] $Window_H = $Window[3] $Client = WinGetClientSize( $Title ) ;Returns (w,h) $Client_W = $Client[0] $Client_H = $Client[1] $Border = ( $Window_W - $Client_W ) / 2 $Titlebar = $Window_H - $Client_H If $Taskbar_W = @DesktopWidth And $Taskbar_H <> @DesktopHeight Then ;Horizontal $Adjust_W = 0 $Adjust_H = $Taskbar_H If $Taskbar_Y = 0 Then ;Top $Start_X = 0 $Start_Y = $Taskbar_H Else ;Bottom $Start_X = 0 $Start_Y = 0 EndIf ElseIf $Taskbar_W <> @DesktopWidth And $Taskbar_H = @DesktopHeight Then ;Vertical $Adjust_W = $Taskbar_W $Adjust_H = 0 If $Taskbar_X = 0 Then ;Left $Start_X = $Taskbar_W $Start_Y = 0 Else ;Right $Start_X = 0 $Start_Y = 0 EndIf EndIf $Available_W = @DesktopWidth - $Adjust_W $Available_H = @DesktopHeight - $Adjust_H ;~ ===================================================================================== WinMove( $Title,'',$Start_X - $Border,$Start_Y - $Titlebar,$Available_W + ($Border * 2),$Available_H + $Titlebar + $Border ) ;~ ===================================================================================== ;~ ConsoleWrite( '$Taskbar_X : ' & $Taskbar[0] & @CRLF ) ;~ ConsoleWrite( '$Taskbar_Y : ' & $Taskbar[1] & @CRLF ) ;~ ConsoleWrite( '$Taskbar_W : ' & $Taskbar[2] & @CRLF ) ;~ ConsoleWrite( '$Taskbar_H : ' & $Taskbar[3] & @CRLF ) ;~ ConsoleWrite( @CRLF ) ;~ ConsoleWrite( '$Window_X : ' & $Window[0] & @CRLF ) ;~ ConsoleWrite( '$Window_Y : ' & $Window[1] & @CRLF ) ;~ ConsoleWrite( '$Window_W : ' & $Window[2] & @CRLF ) ;~ ConsoleWrite( '$Window_H : ' & $Window[3] & @CRLF ) ;~ ConsoleWrite( @CRLF ) ;~ ConsoleWrite( '$Client_W : ' & $Client[0] & @CRLF ) ;~ ConsoleWrite( '$Client_H : ' & $Client[1] & @CRLF ) ;~ ConsoleWrite( @CRLF ) ;~ ConsoleWrite( '$Border : ' & $Border & @CRLF ) ;~ ConsoleWrite( '$Titlebar : ' & $Titlebar & @CRLF ) ;~ ConsoleWrite( @CRLF ) ;~ ConsoleWrite( '$Available_W : ' & $Available_W & @CRLF ) ;~ ConsoleWrite( '$Available_H : ' & $Available_H & @CRLF ) ;~ ConsoleWrite( @CRLF ) ;~ ConsoleWrite( '$Start_X : ' & $Start_X & @CRLF ) ;~ ConsoleWrite( '$Start_Y : ' & $Start_Y & @CRLF ) Link to comment Share on other sites More sharing options...
creeping Posted June 26, 2007 Author Share Posted June 26, 2007 Cool, looks great Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now