Created
November 23, 2012 18:28
-
-
Save DinisCruz/4136748 to your computer and use it in GitHub Desktop.
O2 Script - Util - Windows Handles - View Handle Screenshot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //var topPanel = panel.add_Panel(true); | |
| var topPanel = "Util - Windows Handles - View Handle Screenshot".popupWindow(450,350); | |
| WindowFinder windowFinder = null; | |
| TextBox textBox_CurrentHandle = null; | |
| PictureBox pictureBox = null; | |
| Bitmap lastScreenShot = null; | |
| Label userMessage = null; | |
| Action<IntPtr> onHandleChange = | |
| (handle)=>{ | |
| textBox_CurrentHandle.set_Text(handle.str()); | |
| lastScreenShot = handle.window_ScreenShot(); | |
| if (lastScreenShot.notNull()) | |
| { | |
| pictureBox.show(lastScreenShot); | |
| userMessage.set_Text("Created screenshot of handle: {0}".format(handle)).foreColor(Color.Green); | |
| } | |
| else | |
| userMessage.set_Text("Failed to create screenshot of handle: {0}".format(handle)).foreColor(Color.Red); | |
| }; | |
| Action copyToClipboard = | |
| ()=>{ | |
| topPanel.putBitmapOnClipboard(lastScreenShot); | |
| userMessage.set_Text("Image is in your Clipboard").foreColor(Color.DarkOrange); | |
| }; | |
| Action saveToDisk = | |
| ()=>{ | |
| lastScreenShot.save().clipboardText_Set(); | |
| userMessage.set_Text("File saved Path is on your clipboard").foreColor(Color.DarkOrange); | |
| }; | |
| topPanel.insert_Above(30).white() | |
| .add_WindowFinder(onHandleChange, ref windowFinder).width(30).fill(false) | |
| .append_Label ("Handle").top(10) | |
| .append_TextBox (ref textBox_CurrentHandle).width(75) | |
| .append_Label ("ready when you are....", ref userMessage).font_bold().topAdd(2) | |
| .splitContainer().splitterWidth(1) | |
| .backTo(topPanel) | |
| .insert_Below_ToolStrip() | |
| .add_Copy(copyToClipboard) | |
| .add_Save("Save as temp file)",saveToDisk) | |
| .add("Text Editor", "font_x_generic".formImage(), ()=> "Simple Text Editor".popupWindow().add_RichTextBox()) | |
| .add_DropDown("Layout") | |
| .add("None", ()=> pictureBox.layout_None()) | |
| .add("Center", ()=> pictureBox.layout_Center()) | |
| .add("Stretch", ()=> pictureBox.layout_Stretch()) | |
| .add("Zoom", ()=> pictureBox.layout_Zoom()); | |
| topPanel.white().add_Label("Drag the target (top-left) into another Window or Control to see its screenshot").fill().text_Center().font_bold().size(20); | |
| lastScreenShot = topPanel.handle().window_ScreenShot(); | |
| topPanel.clear().add_PictureBox(ref pictureBox).white().layout_Zoom() | |
| .show(lastScreenShot); | |
| pictureBox.DoubleClick += (sender,e)=> copyToClipboard(); | |
| return "done"; | |
| //O2File:WindowFinder.cs | |
| //O2Embed:target.ico |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment