Page 1 of 1

Script plein écran pour windows 10

Posted: 30 Apr 2020, 11:27
by Trymado
Salut o tous,
j'utilise un script pour mettre en plein écran n'importe quel fenêtre et dans mon cas c'est un jeu video.
Il fonctionne parfaitement sur Win 7 mais pas sur Windows 10
Quelqu'un pourrait m'aider pour le rendre compatible Win 10
merci d'avance

Code: Select all

#SingleInstance force

;;; Known issues:
;;;
;;; - Weird results for windows with custom decorations such as
;;; Chrome, or programs with a Ribbon interface.
;;; - Emacs will be maximized behind instead of in front of
;;; the taskbar. Workaround: WinHide ahk_class Shell_TrayWnd
ToggleFakeFullscreen()
{
CoordMode Screen, Window
static WINDOW_STYLE_UNDECORATED := -0xC40000
static savedInfo := Object() ;; Associative array!
WinGet, id, ID, A
if (savedInfo[id])
{
inf := savedInfo[id]
WinSet, Style, % inf["style"], ahk_id %id%
WinMove, ahk_id %id%,, % inf["x"], % inf["y"], % inf["width"], % inf["height"]
savedInfo[id] := ""
}
else
{
savedInfo[id] := inf := Object()
WinGet, ltmp, Style, A
inf["style"] := ltmp
WinGetPos, ltmpX, ltmpY, ltmpWidth, ltmpHeight, ahk_id %id%
inf["x"] := ltmpX
inf["y"] := ltmpY
inf["width"] := ltmpWidth
inf["height"] := ltmpHeight
WinSet, Style, %WINDOW_STYLE_UNDECORATED%, ahk_id %id%
mon := GetMonitorActiveWindow()
SysGet, mon, Monitor, %mon%
WinMove, A,, %monLeft%, %monTop%, % monRight-monLeft, % monBottom-monTop
}
}

GetMonitorAtPos(x,y)
{
;; Monitor number at position x,y or -1 if x,y outside monitors.
SysGet monitorCount, MonitorCount
i := 0
while(i < monitorCount)
{
SysGet area, Monitor, %i%
if ( areaLeft <= x && x <= areaRight && areaTop <= y && y <= areaBottom )
{
return i
}
i := i+1
}
return -1
}

GetMonitorActiveWindow(){
;; Get Monitor number at the center position of the Active window.
WinGetPos x,y,width,height, A
return GetMonitorAtPos(x+width/2, y+height/2)
}

F8::ToggleFakeFullscreen()
Escape::ExitApp

Re: Script plein écran pour windows 10

Posted: 30 Apr 2020, 22:15
by joedf
Voici un example de script qui essaye de grandir la fenetre le plus possible. WIndows limite la grosseur, mais pt ya une façon de changer les limites?

Code: Select all

; joedf (2020.04.30): code based on parts from
; https://autohotkey.com/board/topic/88510-ufcpp-the-unofficial-fullscreen-command-prompt-patcher/
; made for https://www.autohotkey.com/boards/viewtopic.php?f=55&t=75344

#B::
run, notepad.exe,,,ePID
;WinGet,ePID,PID,ahk_class ConsoleWindowClass

WinWaitActive, ahk_pid %ePID%
hwnd:=WinExist("ahk_pid " ePID)
WinGetPos,wcx,wcy,wcw,wch, ahk_id %hwnd%


;Calculate Size
getClientOffset(ty,bx,by,sby)

;Add Final FullScreen Settings
fullx := -(bx+bx+2)
fully := -(ty+by+by+2)
fullw := A_ScreenWidth + (2*bx) + sby - 6
fullh := A_ScreenHeight + (2*by) + ty + 12
WinMove, ahk_id %hwnd%,,%fullx%,%fully%,%fullw%,%fullh%
WinSet, AlwaysOnTop, on, ahk_id %hwnd%
return

#Esc::
ExitApp

;GetSystemMetrics() http://msdn.microsoft.com/library/ms724385
getClientOffset(ByRef TitleBarY, ByRef BorderX, ByRef BorderY, ByRef ScrollBarY:="") {
	TitleBarY := DllCall("GetSystemMetrics","Int",4,"Cdecl Int") ;SM_CYCAPTION
	BorderX := DllCall("GetSystemMetrics","Int",7,"Cdecl Int") ;SM_CXFIXEDFRAME
	BorderY := DllCall("GetSystemMetrics","Int",8,"Cdecl Int") ;SM_CYFIXEDFRAME
	ScrollBarY := DllCall("GetSystemMetrics","Int",2,"Cdecl Int") ;SM_CXVSCROLL
}

Re: Script plein écran pour windows 10

Posted: 02 May 2020, 10:09
by Trymado
merci beaucoup