1

So I'm working on an application that pastes things into RTF boxes or any text box really utilizing the clipboard.

I need to be able to tell what window users have selected so that my application can determine if it should paste the data there or not.

Is there a way to read the name of the currently selected window, so that I can determine if they should be able to past in it?

Thanks

Alex K.
  • 171,639
  • 30
  • 264
  • 288
HellKnight Hicks
  • 125
  • 2
  • 11
  • Once the data is on the clipboard you have no control over where the user will paste it, even if you are able to determine the window they selected. Perhaps you are talking about Drag/Drop. – Wagner DosAnjos Feb 18 '14 at 16:27
  • You want to identify *external* EDIT/RICHEDIT windows? GetClassName/RealGetWindowClass – Alex K. Feb 18 '14 at 16:31
  • 1
    Child controls don't have names. They have a class name, the value is unpredictable. Some GUIs don't use windows at all, WPF and browser edit boxes are just pixels. Use a UI Automation library to have a shot at this, like .NET's System.Windows.Automation namespace or Project White. – Hans Passant Feb 18 '14 at 16:45
  • well this app globally watches for f6 to be pressed... i figured i could grab the active window after the wake up call and then prevent some data from going into the wrong window here at the hospital... they arent as tech savy as they thing they are.... – HellKnight Hicks Feb 18 '14 at 19:00
  • Thanks for the link... i really wasnt sure how to phrase the question and couldnt find anything on it. – HellKnight Hicks Feb 18 '14 at 19:00

1 Answers1

-1

If you want to get the name of a form you can do this

this.Name // Returns the current forms name

//or if you want the title of the form if you initialise multiple forms

this.Title // Gets the text at the top of the form
Inept Adept
  • 414
  • 4
  • 11