Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace FEWindowSelectionFrameTest
- {
- public partial class MainWindow : System.Windows.Window
- {
- [System.Runtime.InteropServices.DllImport("user32.dll", SetLastError = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
- static extern int GetWindowTextLength(System.IntPtr hWnd);
- [System.Runtime.InteropServices.DllImport("user32.dll", CharSet = System.Runtime.InteropServices.CharSet.Auto, SetLastError = true)]
- static extern int GetWindowText(System.IntPtr hWnd, System.Text.StringBuilder lpString, int nMaxCount);
- FreeEcho.FEWindowSelectionFrame.WindowSelectionFrame f_window_selection_frame = null;
- public MainWindow()
- {
- try
- {
- InitializeComponent();
- button_window_selection.PreviewMouseDown += Button_window_selection_PreviewMouseDown;
- button_window_selection.PreviewMouseUp += Button_window_selection_PreviewMouseUp;
- }
- catch
- {
- }
- }
- private void Button_window_selection_PreviewMouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
- {
- try
- {
- f_window_selection_frame = new FreeEcho.FEWindowSelectionFrame.WindowSelectionFrame();
- f_window_selection_frame.StartWindowSelection();
- }
- catch
- {
- }
- }
- private void Button_window_selection_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
- {
- try
- {
- f_window_selection_frame.StopWindowSelection();
- System.Text.StringBuilder string_data = new System.Text.StringBuilder(GetWindowTextLength(f_window_selection_frame.SelectionHwnd) + 1);
- GetWindowText(f_window_selection_frame.SelectionHwnd, string_data, string_data.Capacity);
- System.Diagnostics.Debug.WriteLine(string_data.ToString());
- }
- catch
- {
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment