Hi!
I wanted to do a flasher for crt lightguns using ahk.
A method to do this would be creating a white gui that shows for some ms. This works in windowed or false fullscreen, but not in real fullscreen games.
So I found another way that seems to work in fullscreen games:
#Include lib/Gdip_All.ahk ; https://autohotkey.com/board/topic/29449-gdi-standard-library-145-by-tic/
;OnExit, Exit
x := 0, y := 0, w := A_ScreenWidth, h := A_ScreenHeight ; Dimensions of rectangle
color := 0x55ffffff ; Transparency (FF = solid) + RGB (black in this case = 000000)
Gui, Flashing: -Caption +E0x80000 +E0x20 +LastFound +AlwaysOnTop +ToolWindow ; Layered window
Gui, Flashing: Show, NA
hwnd1 := WinExist() ; The created window's handle
Gui, Flashing: Hide
pToken := Gdip_Startup()
hbm := CreateDIBSection(w, h) ; The GDI bitmap
hdc := CreateCompatibleDC() ; Device context compatible with screen
obm := SelectObject(hdc, hbm) ; Select bitmap into device context
G := Gdip_GraphicsFromHDC(hdc) ; Get pointer to graphics of bitmap
hBrush := Gdip_BrushCreateSolid(color) ; For the fill
Gdip_FillRectangle(G, hBrush, x, y, w, h)
UpdateLayeredWindow(hwnd1, hdc, 0, 0, w, h)
; Clean up the paint
Gdip_DeleteBrush(hBrush)
SelectObject(hdc, obm), DeleteObject(hbm), DeleteDC(hdc), Gdip_DeleteGraphics(G)
Return
~LButton::
Gui, Flashing: Show, NA
Sleep, 60
Gui, Flashing: Hide
return
F12::
ExitApp
And this works for the fullscreen games I tried but groovymame:
In a pc with a Flat screen without crt emudriver, if I launch a game fullscreen with normal mame, the flashing is shown over the game. No mathers if opengl or d3d, it works.
In my arcade pc with crt and groovymame, I launch a game, switchres works and set it to its resolution, but the flashing won't show over the game.
Any idea why? do anyone know how to achieve it?