Jump to content
Sign in to follow this  
JoGa

ScreenCapture - tooltip not captured

Recommended Posts

JoGa

Greetings,

with the below code the Tooltip does not show in the captured image.

Any hints?

Thanks.

#include <ScreenCapture.au3>

ToolTip("BlaBla Tooltip", 500, 300)
Sleep(1000)

_ScreenCapture_Capture(@MyDocumentsDir &"\Image1.jpg", 0, 0, 1600, 1000, True)

MsgBox(0, "TTT", "ScreenCapture done")
ShellExecute(@MyDocumentsDir &"\Image1.jpg")

 

Share this post


Link to post
Share on other sites
UEZ

Your code works for me - I can see the ToolTip in the bitmap.

Br,

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
UEZ

Seem to be, as JohnOne said, a problem with non Aero desktops.

Br,

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
UEZ

But you can use a workaround:

#include <Clipboard.au3>
#include <GDIPlus.au3>

ToolTip("BlaBla Tooltip", 500, 300)
Sleep(1000)

_GDIPlus_Startup()
_ScreenCapture_CaptureAlternative(@ScriptDir &"\Image1.jpg", 0, 0, 1600, 1000)

MsgBox(0, "TTT", "ScreenCapture done")
ShellExecute(@ScriptDir &"\Image1.jpg")
_GDIPlus_Shutdown()

Func _ScreenCapture_CaptureAlternative($sFile, $iX, $iY, $iW, $iH, $bCursor = True) ;coded by UEZ 2014
    If Not $giGDIPRef Then Return SetError(1, 0, 0) ;check whether _GDIPlus_Startup() was called
    Send("{PRINTSCREEN}")
    Sleep(100) ;wait some ms otherwise clipboard will fail to open
    If Not _ClipBoard_Open(0) Then Return SetError(2, 0, 0)
    Local $hMemoryBMP = _ClipBoard_GetDataEx($CF_BITMAP) ;get bitmap from clipboard
    If @error Then
        _ClipBoard_Close()
        Return SetError(3, 0, 0)
    EndIf
    Local $hBmp_tmp = _GDIPlus_BitmapCreateFromHBITMAP($hMemoryBMP) ;convert GDI bitmap to GDI+ bitmap
    If @error Then
        _WinAPI_DeleteObject($hMemoryBMP)
        _ClipBoard_Close()
        Return SetError(4, 0, 0)
    EndIf
    _WinAPI_DeleteObject($hMemoryBMP)
    _ClipBoard_Close()
    Local $hBitmap = _GDIPlus_BitmapCreateFromScan0($iW, $iH) ;create empty bitmap
    Local $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    _GDIPlus_GraphicsDrawImageRectRect($hCtxt, $hBmp_tmp, $iX, $iY, $iW, $iH, 0, 0, $iW, $iH) ;copy selection to empty bitmap
    If $bCursor Then
        Local $aCursor = _WinAPI_GetCursorInfo()
        If $aCursor[1] Then
            Local $hBmp_Icon = _GDIPlus_BitmapCreateFromHICON32($aCursor[2])
            _GDIPlus_GraphicsDrawImage($hCtxt, $hBmp_Icon, $aCursor[3], $aCursor[4])
            _GDIPlus_BitmapDispose($hBmp_Icon)
        EndIf
    EndIf
    _GDIPlus_GraphicsDispose($hCtxt)
    _GDIPlus_BitmapDispose($hBmp_tmp)
    If $sFile = "" Then Return $hBitmap ;don't forget to dispose image later when not used anymore
    _GDIPlus_ImageSaveToFile($hBitmap, $sFile)
    _GDIPlus_BitmapDispose($hBitmap)
    Return 1
EndFunc
Edit: added cursor capture

Br,

UEZ

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
JoGa

Thanks for your comments.

It's the Aero thing which prevents the tooltip being captured.

However, enabling Aero slows down BilBlt used in another app by the factot of 15-20!

Anyway, thanks and have a nice day!

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  

  • Similar Content

    • ohaya
      By ohaya
      Hi,
      I am still really new with AutoIT.  We are using it to automate logging into web sites and I have encountered problems with focus.  The target web page is configured to put the cursor into the first text field (username) when the page is loaded, and when I run the AutoIT script, which does the log in seems like it is just not starting where I expect it to be.  
      I have been kind of using ToolTip() to kind of help with debugging, but now I am wondering if the calls to ToolTip() are causing the focus to be messed up.  
      For example, at least visually, when the ToolTip() is called, I can see the cursor disappear from the web page text field and they when I do anything that is supposed to send keystrokes, they are going off somwhere else ("never-neverland").
      But when I remove some of the ToolTip() calls, it works correctly.
      So the questions I have are:
      1) Do the ToolTip() calls interfere with/change where the focus on the target page are?
      2) In general, what are the "rules" for where ToolTip can be used "safely" (== doesn't interfere with focus)?
      Thanks,
      Jim
       
    • UEZ
      By UEZ
      AutoIt Windows Screenshooter
      Key Features:
      takes easily a screenshot from any visible window capture any region of the desktop incl. freehand capturing capture GUI controls and GUI menus separately capture a marked area every x seconds for a duration of y seconds create a GIF animation from saved frames (Vista or higher os required) capture to AVI file (without audio!) takes a screenshot from web sites (available only on Win7+ os and when Aero is enabled) put images to clipboard to paste to other applications easily color picker save image in different formats and also to PDF! add timestamp to saved images simple image editing options: greyscale, b&w, invert, rotate +-90° send image to printer and default email client preview of captured screens incl. zoom option multi monitor support display pixel color under mouse ruler basic image editor (paint, highlight, ellipse, rectangle, text and some graphic FX) watermark captured image no 3rd party tools or DLLs used - pure AutoIt! fully portable - no installation is needed multi language feature (Eng, Ger, Tur, Fra and Rus only) To do:
      capture content of scrollable window/control capture cascaded menus Due to DllCall("User32.dll", "int", "PrintWindow", "hwnd", $hWnd, "handle", $hMemDC, "int", 0) limitation some windows cannot be captured properly (GDI+, ProgDVB, etc.) but can take screenshots of hidden windows. One workaround is to use full screen capturing (F11/F12) or "Grab Screen" function! Or try double click with rmb on listview items (beta).
      Download source code (6295 downloads previously):  AutoIt Windows Screenshooter v1.81 Build 2018-08-12.7z (version 3.3.12.0+ needed!)
      You are not allowed to sell this code or just parts of it in a commercial project or modify it and distribute it with a different name!
      Download compiled Exe only: 4shared / Media Fire / Softpedia (1.54mb)
      Distributing copies of the program in compiled format (exe) must be free of any fee!
      -----> click here to Donate!  
       
      (Current donators: 1. Cuong N.) 
      It is designed for Win7+ operating systems with AERO enabled! E.g. on WinXP machines some functions are not working properly and might crash the application!
      AV scanners may have a negative impact the execution of compiled exe and might report any malware. I guarantee that there is no malicious code in the source code / exe!!! 
      Main GUI:

       
       
      About Intro:

       
       
      Basic Image Editor:

       
       
      Watermark:

       
       
      Click link for an enhanced version of Watermark Image.
      Credits:
      main code by UEZ additional code (alphabetical order) by Authenticity, AutoItObject Team, Eemuli, Eukalyptus, funkey, _Kurt, martin, monoceres, ProgAndy, taietel, trancexx, Ward, wolf9228 and Yashied! mesale0077 for turkish translation wakillon for french translation AZJIO for russian translation Keys:
      Main GUI:
      User your mouse to scroll preview window or
      Numpad 8: Scroll preview window up
      Numpad 2: Scroll preview window down
      Numpad 4: Scroll preview window left
      Numpad 6: Scroll preview window right
      Numpad +: zoom in preview window or mousewheel down
      Numpad -: zoom out preview window or mousewheel up
      F1: capture again on last position
      F5: refresh Windows Name list
      PRINTSCREEN: take screenshot from whole screen
      ALT+PRINTSCR: take a screenshot from active window
      F10: Undo made changes with Image Editing function
      F11: take screenshot from whole screen incl mouse cursor
      F12: take screenshot from whole screen
      Ctrl+Alt+F9 start "Grab Screen" mode
      Ctrl+Alt+F12: take a screenshot from active window using alternative screenshot functionality (beta)!
      Ctrl+r: call ruler
      Ctrl+s: save current displayed image
      Ctrl+x: exit program
      ctrl+w: call web grab input field (availabe only when Aero is enabled)
      Ctrl+i: call image editor
      Ctrl+m: call watermark editor
      Ctrl+z: undo
      Only available on Vista+ os: double click with rmb on list items to use alternative screenshot functionality (beta)!
      When 'Grab Screen' is clicked you can hold down the ctrl key to switch to 'grab controls' mode. Control under mouse will be framed red.
      ctrl + shift will take the screenshot of appropriate control. To capture GUI menues you can press rmb which simulates the lmb. When a menu is opened press shift additionaly to capture it.
      Press and hold only the shift key to capture any region on the desktop using freehand capturing - release it so capture marked regions!
      Or just mark resizeable area which you want to grab. Press CTRL key to grab marked area or right mouse button to capture the marked area every x seconds for a duration of y seconds.
      When saving the image just enter the extension you whish to use (*.jpg;*.png;*.bmp;*.gif;*.tif;*.pdf). Big thanks to taietel for his PDF UDF!
      Image Editor:
      s: save
      c: copy
      n: send
      h: highlighter
      p: pen
      r: rectangle
      e: ellipse
      a: arrow
      o: color
      t: text
      g: text config
      Ctrl+z: undo
      Watermark editor:
      Ctrl+z: undo
       
      To start the app minimized just call it "Windows Screenshooter.exe /min"
      Maybe it is useful for someone...
      Any kind of comment is welcome.
      Br,
      UEZ
      Change log:
       
    • sharkeye
      By sharkeye
      #include <ScreenCapture.au3> Local $hBmp ; Capture full screen $hBmp = _ScreenCapture_Capture("") _ScreenCapture_SaveImage("C:\Software\autoitscripts\scripts\images\prp\ocr\"&"ocr_01.PNG",$hBmp) Sleep(1000) _ScreenCapture_Capture("C:\Software\autoitscripts\scripts\images\prp\ocr\"&"ocr_02.PNG") Sleep(1000) ShellExecute("C:\Software\autoitscripts\scripts\images\prp\ocr\"&"ocr_01.PNG") Sleep(1000) ShellExecute("C:\Software\autoitscripts\scripts\images\prp\ocr\"&"ocr_02.PNG") Hi All,
      This is my first post and I have checked the forum.  If this question has been asked and answered I apologise.
      The code above is intended to save the whole screen to a directory; it doesn't work.
      I have downloaded and copied and renamed the files referenced in https://www.autoitscript.com/forum/topic/192254-33143-fixes/ to my includes directory.
      Clearly there is some step that I am missing; do I need to download and register a dll?
       
      I know that I am using two different methods above but neither works for me.
    • astrionn
      By astrionn
      So I had this Idea of creating a tooltip which shows me my ping.
      That itself was made quickly and I thought too add a couple features.
      I want the tooltip background to be a different color depending on the ping. (good ping is green, medium ping is yellow,...)
      So how do I color in a tooltip? google brought me to this: 
       
      where in the comments I found this:
      $s = "LOW" ToolTip($s, 0, 0, "Battery Information");, $icon) $H_TOOLTIP1 = WinGetHandle($s) DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", $H_TOOLTIP1, "wstr", "", "wstr", "") DllCall("user32.dll", "int", "SendMessage", "hwnd", $H_TOOLTIP1, "int", 1043, "int", 2552550, "int", 0) Sleep(1000) Which I then used in my code with different color codes... Trial and Error brought me these that I wanted to use:
       
      The Problem is if I loop through my code it only sets the color for the 1st loop and then sticks to it.
      The real problem is tho that I don't exactly understand the dllcalls... And I guess that's why it isn't working
      So if someone would be so awesome to explain to me how they work, or at least can give me a list of these parameters then I would really appreciate that and learn something new
      Obviously a solution to my problem is awesome aswell ^^
      I run this under Windows 8.1
      There is my code in a paste.
      https://pastebin.com/q525f7mS
    • timmalos
      By timmalos
      Hello all.
      I'm trying to do something simple, but I can't manage to find where to start since I can have multiple possibilities and not sure what is the best one :
      Taking screen capture (I can do that) On this capture, I'll look for 10 particular regions that will give me 10 images of 40px * 40px (I can do that) Then what I want is for each of these regions, find on my library of ~140 images which one is the closest one to my region (= the match)  
      What do you think is the best approach ? Ican easily do step 1 and 2, however for the third step :
      I can't use memcmp because they won't be exactly the same (original library can differ a very little bit from what I'll get from my screen capture) There is no text, only drawing Should I do a pixelSum of what I get on screen and do the same via GDIPlus for each of my images in the library?  
      Thanks a lot,
      Tim
       
×