steff Posted April 28, 2019 Posted April 28, 2019 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: expandcollapse popup>>>> 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): expandcollapse popup; ; 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
BrewManNH Posted April 28, 2019 Posted April 28, 2019 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 GudeHow 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
steff Posted May 14, 2019 Author Posted May 14, 2019 Thanks BrewManNH for your reply. I didn't know that. Better use another approach, then.
Earthshine Posted May 14, 2019 Posted May 14, 2019 just delete the clipboard contents? My resources are limited. You must ask the right questions
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now