Jump to content
steff

How to get Snipping Tool combobox item names?

Recommended Posts

Dear  Autoit  enthusiasts

for security reasons, I want to disable the use of Snipping tool to send images in attachment.

I'm able to trigger a function when the user clicks on the mail button in the toolbar.

I need to do the same when a user clicks on the Mail combobox (please, see attached image).

I run Autoit Window Info but it reports nothing about the combobox.

I report here the summary output of WIndow Info:

>>>> Window <<<<
Title:  Strumento di cattura
Class:  Microsoft-Windows-Tablet-SnipperEditor
Position:   1061, 0
Size:   859, 885
Style:  0x14CF0000
ExStyle:    0x00000100
Handle: 0x000D0CA8

>>>> Control <<<<
Class:  ToolbarWindow32
Instance:   1
ClassnameNN:    ToolbarWindow321
Name:   
Advanced (Class):   [CLASS:ToolbarWindow32; INSTANCE:1]
ID: 
Text:   
Position:   0, 0
Size:   843, 42
ControlClick Coords:    283, 21
Style:  0x50009941
ExStyle:    0x00000000
Handle: 0x00090D0E

>>>> Mouse <<<<
Position:   283, 21
Cursor ID:  0
Color:  0xEEEEEE

>>>> StatusBar <<<<

>>>> ToolsBar <<<<
1:  40011   &Nuovo
2:  40012   
3:  40017   
4:  40014   
5:  0   
6:  40020   
7:  40025   
8:  40026   

>>>> Visible Text <<<<


>>>> Hidden Text <<<<

I also used Winspy++ but it gave the same output.

Just to show you how I trigger functions when Toolbar buttons are pressed, here are some pieces of code (apologize for the lack of elegance):

;
; trying to manage the various flavours of SNippingTool classes
;
Global $SnippingTool1= "[CLASS:Microsoft-Windows-Tablet-SnipperEditor]" ; windows 7
Global $SnippingTool2= "[CLASS:Microsoft-Windows-SnipperToolbar]"       ; windows 7
Global $SnippingTool3= "[CLASS:Microsoft-Windows-SnipperEditor]"        ; windows 10

if (WinActive ( $SnippingTool1  ) OR  WinActive ( $SnippingTool2  ) OR  WinActive ( $SnippingTool3 )) Then

            if WinActive ( $SnippingTool1  ) Then $SnipActive=$SnippingTool1
            if WinActive ( $SnippingTool2  ) Then $SnipActive=$SnippingTool2
            if WinActive ( $SnippingTool3  ) Then $SnipActive=$SnippingTool3

            $hWndTarget = WinGetHandle($SnipActive)

            $hdlToolBar  = ControlGetHandle($SnipActive, "", "[CLASS:ToolbarWindow32; INSTANCE:1]")

            While WinActive( $SnipActive  )
               $button=""

               if $safeFlag=0 Then

                  while $button = ""
                        ;copy button pressed
                        if BitAND(_GUICtrlToolbar_GetButtonState($hdlToolBar, "40017"), $TBSTATE_PRESSED)  Then
                           $button="Copy"
                           ExitLoop
                        EndIf
                        
                        ;mail button pressed
                        if BitAND(_GUICtrlToolbar_GetButtonState($hdlToolBar, "40014"), $TBSTATE_PRESSED) Then
                           $button="Mail"
                           ExitLoop
                        EndIf

                        ;save button pressed
                        if BitAND(_GUICtrlToolbar_GetButtonState($hdlToolBar, "40012"), $TBSTATE_PRESSED) Then
                           $button="Save"
                           ExitLoop
                        EndIf

                  Wend

                  If $button <> "" Then
                  ; do something

By the way, until some months ago, I used to hook to the toolbar with the old hook.dll.

From October last year, the hooking stopped working, (on WIndows 7) maybe for some Windows update or some antimalware new settings. So i switched to this new approach.

Any help will be appreciated.

Thank you

steff

snippingtool.png

Share this post


Link to post
Share on other sites

I'm not sure if you're aware or not, but as soon as you use the snipping tool to get an image of the screen, it's placed into the clipboard. Disabling the email button doesn't do anything, as a person can just open email themselves and paste the image into an email. All you're doing is making it a tiny bit more cumbersome to do the same thing.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

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

×
×
  • Create New...