Jump to content

Need ideas on missing GUI in animation


qwert
 Share

Recommended Posts

I’ve made (attempted to make) an animated GIF by capturing a few seconds of screen motion of one of my GUIs in action.

 

The problem is, my GUI is invisible. (Below is an example where I drag my GUI back and forth in the frame.)

 

I’ve tried several different capture rates and different backgrounds ... always with the same result.  I’ve even tried two different GIF capture programs and got the same result.  One developer (of the GIF capture software) has tried my example and it worked fine on his PC. He sent me a proper example back. So, for the time being, I have to assume it’s something on my end. But what are some possibilities?

 

A )  Some subtle DLL parameter when I create the GUI?

B )  Something related to my Intel HD Graphics maybe being too smart?

C )  Something about layered graphics that rarely comes up.

D )  Other: ________

 

Here are some pertinent facts:

>My GUI is a “TopMost, Layered ToolWindow” ... draggable via WM_NCHITTEST

>My GUI is always recorded properly by a Print Screen operation ... when pasted into MSPaint.

>My GUI has run fine for months in amongst other applications on my desktop. It always maintains its rightful place on top of other applications.

 

I'm really at a loss and any ideas of what to try will be greatly appreciated.

 

 

post-29172-0-70734100-1423448601_thumb.g

Link to comment
Share on other sites

Did you get the details of the developer's PC?

And I take it that the example you provided him, is identical to yours in all respects?

I'm guessing that it is not refresh rate related?

Or your active desktop settings?

Could be a difference between OS or 64 bit?

How customizable is the screen motion capture?

One presumes his settings were the same as yours?

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

Here's a simple script that produces the invisible GUI:

;
;   This is a much-modified script just to demonstrate dragging a Torus.png
;
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Opt("GUIOnEventMode", 1)

Global Const $SC_DRAGMOVE = 0xF012
Global $GUI, $eenmaalexit = True
FileInstall("c:\AutoIt3\Examples\GUI\Torus.png", @ScriptDir & "\Torus.png")

_GDIPlus_Startup()

$GUI = GUICreate("", 198, 210, -1, -1, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOOLWINDOW, $WS_EX_TOPMOST))
GUICtrlSetState(-1, $GUI_DISABLE)
$Label = GUICtrlCreateLabel("", 0, 0, 120, 120, -1, $GUI_WS_EX_PARENTDRAG)
GUICtrlSetTip(-1, "Click and hold to drag" & @CRLF & "... ESC to close")

$iLoad = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Torus.png")
$hGraphic = _GDIPlus_ImageGetGraphicsContext($iLoad)
_SetBitmap($GUI, $iLoad, 255, _GDIPlus_ImageGetWidth($iLoad), _GDIPlus_ImageGetHeight($iLoad))

_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_ImageDispose($iLoad)

GUISetState(@SW_SHOW, $GUI)

GUIRegisterMsg($WM_LBUTTONDOWN, "_WM_LBUTTONDOWN")
GUISetOnEvent($GUI_EVENT_CLOSE, "_Dragwindow")

While 1
    Sleep(50)
WEnd

Func _Exit()
    _GDIPlus_Shutdown()
    Exit
EndFunc

Func _Dragwindow()
    Switch @GUI_CtrlId
        Case $GUI_EVENT_CLOSE
            _Exit()
    EndSwitch
EndFunc

Func _WM_LBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam)
    _SendMessage($GUI, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0)
EndFunc   ;==>_WM_LBUTTONDOWN

Func _SetBitmap($hGUI, $hImage, $iOpacity, $n_width, $n_height)
    Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend
    $hScrDC = _WinAPI_GetDC(0)
    $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC)
    $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
    $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap)
    $tSize = DllStructCreate($tagSIZE)
    $pSize = DllStructGetPtr($tSize)
    DllStructSetData($tSize, "X", $n_width)
    DllStructSetData($tSize, "Y", $n_height)
    $tSource = DllStructCreate($tagPOINT)
    $pSource = DllStructGetPtr($tSource)
    $tBlend = DllStructCreate($tagBLENDFUNCTION)
    $pBlend = DllStructGetPtr($tBlend)
    DllStructSetData($tBlend, "Alpha", $iOpacity)
    DllStructSetData($tBlend, "Format", 1)
    _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA)
    _WinAPI_ReleaseDC(0, $hScrDC)
    _WinAPI_SelectObject($hMemDC, $hOld)
    _WinAPI_DeleteObject($hBitmap)
    _WinAPI_DeleteDC($hMemDC)
EndFunc   ;==>_SetBitmap

The GIF capture software is called ScreenToGif on CodePlex: https://screentogif.codeplex.com/

Aside from the fact that it doesn't work for this GUI, I've been impressed with the utility.  The GIF compression is very good.

I'm running Win7 Pro, but the developer tested on Win8.1.  We both tried different frame rates between 10 and 20.  I've tested with three different scripts (similar to the above; TopMost, Popup, etc.) and get the same result.

Link to comment
Share on other sites

From a little searching this is how I understand it works when recording layered windows

Win 7

  • DWM off, capture program must use CAPTUREBLT flag with BitBlt (ScreenToGif does not seem to use this, look here)
  • DWM on, layered windows always included (?)

Based on this I assume you have DWM (Aero) disabled.

It works for me and the other dev because Win 8 always have DWM on (can't be disabled).

So you need to either enable DWM (enable the Aero theme) or use a recorder that specifically supports layered windows...

I use OBS for game/screen recording and it does have a [Capture Layered Windows] setting which I imagine is exactly for this. But it records to mp4 not gif.

Link to comment
Share on other sites

A brilliant analysis!

I assume you have DWM (Aero) disabled

 

Yes, I turn aero off every time I've configured a new PC ... (it's such a visual mess!) ... so it's nothing I ever think about.

With aero On (and detuned to look halfway reasonable), recording works as expected.

I'll pass your points to the developer to see what he can do.

Thanks very much for solving this.

 

post-29172-0-86988300-1423491515_thumb.g

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...