There is a Handle window of a running program, I need to embed a Label in a certain part of it and enter data into Label in a separate stream (render my text on top of another application).

  • And what are your goals? Describe in more detail - Kir_Antipov 5:48 pm
  • The text in the window of someone else's application, or rather, it will be the subtitles in the player (it seems that adding text and transferring text generated by the speech determiner to it is the easiest way to do this) - Unrest Raint
  • one
    add this to the question, please) And now everything looks like you for some reason want to add a TextBox with the ability to type in it manually, while you just need to render your text on top of another application) - Kir_Antipov
  • Possible duplicate question: Track the change in the size and position of the window - Andrew
  • Most players can download subtitles from external .ass, .srt files. But you seem to need to create subs on the fly. - Alexander Petrov

1 answer 1

As far as I know, sticking your controls into other programs in runtime will not work out (especially considering that many of them are Native applications, and not .NET - there is some significant possibility here .... And that’s not fact).

So the problem is in the following algorithm:

  1. Through WinAPI learn Rectangle window (i.e. size and position)
  2. create a form with a label of the desired size / font
  3. Change BorderStyle to None;
  4. make the form transparent (so that only the label would be visible)
  5. update the form position if the position or size of the original has changed

If 2-5 tasks are trivial, then the first one is a duplicate of an already existing question that has the answer: Track window size and position changes