UEZ

_WinAPI_MarkScreenRegionAndCapture 0.91 build 2016-09-29

22 posts in this topic




Hi UEZ :)

Tested on Win8.1 x64 without problem.

Nice work ;)


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

2 hours ago, wakillon said:

Hi UEZ :)

Tested on Win8.1 x64 without problem.

Nice work ;)

Thanks for testing. :thumbsup:

 

1 hour ago, l3ill said:

UEZ,

Excellent resource !! Awesome as always...:D

Win 7 32 BIT

BTW: whatever happened to your old avatar? the guy rubbing sand in his own face...  that was kewl B)

Keep um coming!

Bill

 

Thanks also to you for testing :thumbsup:. You mean that image probably:

 

Quote

Prep
Photograph by Sucheta Das / AP
A traditional Indian wrestler smears mud on his head during a March practice session in Calcutta, India.

http://img.timeinc.net/time/pictures_of_the_year/pictures_of_the_year_28.jpg

Edited by UEZ
1 person likes this

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯

Share this post


Link to post
Share on other sites
3 minutes ago, jguinch said:

Works perfectly with multiple monitors

 

I know. :D

1 person likes this

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

@junkew: well, the GDI / GDI+ stuff might be outdated meanwhile but it works probably and "fast" enough for basic tasks such as screen capturing and moving some "objects" around -> old school.

I didn't try DirectX neither Windows Media API yet but thanks for the link. Time to explore the DirectX / D2D stuff...

 

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯

Share this post


Link to post
Share on other sites

I have the feeling that within W10 still GDI is the way to work with as DirectX and WMP is not allways directly installed. Anyway I like your example and will check if I can incorporate this somehow in simplespy and iuiautomation stuff.

 

Share this post


Link to post
Share on other sites

Always appreciate your work @UEZ ! Thank you for sharing!

*cough* would be nice to have same concept but with video recording too *cough*  :-D  just throwing that out there...

Share this post


Link to post
Share on other sites
1 minute ago, coffeeturtle said:

Always appreciate your work @UEZ ! Thank you for sharing!

*cough* would be nice to have same concept but with video recording too *cough*  :-D  just throwing that out there...

Well with AutoIt video recording is a tough stuff but I had it implemented already in  AutoIt Windows Screenshooter

Try it out. ;)

 


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯

Share this post


Link to post
Share on other sites
7 hours ago, UEZ said:

Well with AutoIt video recording is a tough stuff but I had it implemented already in  AutoIt Windows Screenshooter

Try it out. ;)

 

Never knew about that. Thanks! You already thought of it and implemented it! Nicely done!

 

Share this post


Link to post
Share on other sites

No need to change anything, but could you comment on why this function doesn't pick up any "always on top" windows or dialogs.

I mention this because the PC's Print Screen button always captures the current view ... but the screen capture utilities I've tried usually don't.

 

Share this post


Link to post
Share on other sites
46 minutes ago, qwert said:

No need to change anything, but could you comment on why this function doesn't pick up any "always on top" windows or dialogs.

I mention this because the PC's Print Screen button always captures the current view ... but the screen capture utilities I've tried usually don't.

 

For me on Win10 b1607 it works properly also for MsgBoxes / GUI with topmost flag.

I need to test it in my Win7 / Vista vm...


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯

Share this post


Link to post
Share on other sites

Now that you mention Win10, I do recall there was some issue related to Win7 running "non-Aero" ... which is how I configure my PCs.

What would be great is a setting in the capture function that could specify Aero mode just for the capture ... or some other method, of course.

Thanks for looking at this.

Share this post


Link to post
Share on other sites

Well, I just tested in my Win7 vm and it works properly with / without Aero. The AutoIt test GUI with topmost attribute is captured.


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯

Share this post


Link to post
Share on other sites

I've traced it to layered windows.  I put together a very simple example.  If I compile the script below, launch it and then run your capture, the torus is not captured.

;
;       Layered GUI for screen capture test
;
#include <GDIPlus.au3>
#include <WindowsConstants.au3>

_GDIPlus_Startup()
$hImage = _GDIPlus_ImageLoadFromFile("C:\AutoIt3\Examples\GUI\Torus.png")

Global $GUI = GUICreate("Layered Test", 200, 200, -1, -1, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_LAYERED)) ; layered is necessary
SetBitmap($GUI, $hImage, 255)
GUISetState()

Sleep(20000)

_GDIPlus_Shutdown()

Func SetBitmap($hGUI, $hImage, $iOpacity)
    Local Const $AC_SRC_ALPHA = 1                   ; don't really understand why these are set
    Local Const $ULW_ALPHA = 2
    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", _GDIPlus_ImageGetWidth($hImage))
    DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage))
    $tSource = DllStructCreate($tagPOINT)
    $pSource = DllStructGetPtr($tSource)
    $tBlend = DllStructCreate($tagBLENDFUNCTION)
    $pBlend = DllStructGetPtr($tBlend)
    DllStructSetData($tBlend, "Alpha", $iOpacity)
    DllStructSetData($tBlend, "Format", $AC_SRC_ALPHA)

    _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

Is there some setting I can adjust on Win7 ... other than enabling Areo?

Share this post


Link to post
Share on other sites

Got it now - torus is not visible only when Aero is enabled.

One quick and dirty solution is to enable Aero within the script using

_WinAPI_DwmEnableComposition(True)

and disable Aero again when finished.

Anyhow, I will try to find a workaround...

1 person likes this

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯

Share this post


Link to post
Share on other sites

@qwert I updated the code. Can you try again?

1 person likes this

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯

Share this post


Link to post
Share on other sites

Excellent!  Thanks!

I’ll will take a close look at the changes you made to try to understand ... but would you mind summarizing what you found in a sentence or two ... and what change was needed?

 

Captured.bmp

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

  • Similar Content

    • TheNorwegianUser
      Screencapture display "error"
      By TheNorwegianUser
      I don't get why the images I take turns up like this, but it seems to me like the screenshot doesn't go from the actual positions specified. It's weird, cause what happends is that when I for example move the mouse over the number 25 on SciTE, the image shows that it's over 19... Anyone knows what I'm doing wrong?
      #include <screencapture.au3> #include <WindowsConstants.au3> Hotkeyset("{ESC}", "Terminate") $gui = GUICreate("", 100, 800, 100, 0, $WS_POPUP, $WS_EX_TOPMOST) _GDIPlus_Startup() $graphics = _GDIPlus_GraphicsCreateFromHWND($gui) GUISetState(@SW_SHOW, $gui) While 1 $scr = _ScreenCapture_Capture("", 0, 0, 100, 800) $bitmap = _GDIPlus_BitmapCreateFromHBITMAP($scr) _WinAPI_DeleteObject($scr) _GDIPlus_GraphicsDrawImage($graphics, $bitmap, 0, 0) WEnd Func Terminate() _GDIPlus_GraphicsDispose($graphics) _GDIPlus_BitmapDispose($bitmap) _GDIPlus_Shutdown() Exit EndFunc  
    • UEZ
      FreeBasic Graphical Examples
      By UEZ
      Here some graphical examples written completely in FreeBasic just for fun.  
      GDI Particle Repulsion Grid v1 + sound build 2016-10-13 (if the FPS is too low call the exe with this parameter: -slowpc . It will reduce the particle size) Animated Pythagoras Tree build build 2016-10-08 Tunnel Flight - WipeOut Style GDI Liquid Pixels I will add new examples from time to time.
       
      FreeBasic source codes are also included.
       
    • wakillon
      Shape2Polygon
      By wakillon
      Create simple forms from polygon is easy but its more difficult with complex forms, so...
      Shape2Polygon permit to get Polygon array Coordinates from a Black and White Shape for be used with _GDIPlus_GraphicsDrawPolygon.

       
      Source, compiled Version and Shape Samples are available in the download section.
      Hope it can help !
       
      If you get an error while scanning, post the shape and i will try to update the script.
    • wakillon
      Shape2Polygon
      By wakillon
      Shape2Polygon permit to get Polygon array Coordinates from a Black and White Shape for be used with _GDIPlus_GraphicsDrawPolygon.
    • wakillon
      Gif2Avi
      By wakillon
      Convert an animated Gif to an Avi file for use with GUICtrlCreateAvi function.