Sign in to follow this  
Followers 0
Szhlopp

Ingame Redraw

2 posts in this topic

I've been trying to get a GUI to show inside a game. I've gotten far enough to make it show, but it flickers like hell.

Here's my example code:

#include <GUIConstants.au3>
#include <WinAPI.au3>
#include <Constants.au3>
#include <WindowsConstants.au3>

;
$handle = WinGetHandle("SwgClient")
$GUI = GUICreate("Form1", 195, 106, 193, 125)
$Label1 = GUICtrlCreateLabel("Tester", 76, 40, 34, 17)
GUISetState(@SW_SHOW)
;_WinAPI_SetWindowLong($handle, $GWL_STYLE, $WS_CLIPCHILDREN)
_WinAPI_SetParent($GUI, $handle)
_WinAPI_SetWindowLong($handle, $GWL_STYLE, $WS_CLIPCHILDREN)

;WinSetOnTop($GUI,"",1)
;_WinAPI_SetWindowPos($handle, $HWND_BOTTOM , 195, 106, 193, 125, $SWP_NOZORDER)
_WinAPI_SetWindowPos($GUI, $HWND_TOPMOST, 195, 106, 193, 125, $SWP_NOZORDER)

AdlibEnable("UpdateWindow", 20)
While 1
    Sleep(20)
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

Func UpdateWindow()
    ;WinSetOnTop($GUI,"",1)
    ;GUISetState(@SW_SHOW)
    ;WinSetOnTop($GUI,"",1)
    ;_WinAPI_RedrawWindow ($handle, 0, 0, $RDW_NOINTERNALPAINT)
    _WinAPI_RedrawWindow ($GUI)
    ;_WinAPI_UpdateWindow($GUI)
    ;_WinAPI_ShowWindow($GUI, @SW_SHOW)
    
EndFunc

I've tried everything I can possibly imagine. Has anyone else been able to make something like this work?

Thanks!

Share this post


Link to post
Share on other sites

Try updating your GUI at your screen refresh rate ie. 60 hz (16.66 ms)

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0