Write program in another’s textbox

Asked

Viewed 169 times

2

Hello! I used the program "Exe Lock" to block some files of mine, everything works perfectly, the problem is that I was trying to open the locked file with a program in C# and the program itself write in the textbox that asks the password for the other to be opened, I don’t know how to explain it but here’s an image: I already tried to pass the password as argument kind of like this:

Process.Start("Arquivo bloqueado.exe", "-password 0909288");

But it didn’t work out at all, I also tried to put in a redirectoutput and enter the password and still nothing... Does anyone have any ideas?

  • To work the way you tested, the application should have been implemented with feature to receive parameters. If it didn’t work, it’s because it’s not the case. I don’t know C#, but I know that Windows makes it possible to simulate keystrokes. Only for this, your application should be in the background, and the application that should receive the content in focus.

  • I sent an email to the developers, I hope they enable this :D

  • Is there any way to know which parameters a program receives? It may be that there is a parameter called passw for example

  • Not that I know of. I only sell the documentation.

2 answers

4


We can try something like this:

    Process processo = Process.Start("SICON.EXE");
    IntPtr h = processo.MainWindowHandle;
    SetForegroundWindow(h);
    processo.WaitForInputIdle(); // Isso aqui foi de extrema importância :D.
    SendKeys.SendWait("senhaaqui");
    SendKeys.SendWait("{ENTER}");
  • I’ll try right now, thanks for the suggestion :)

  • Man you’re a god!!!!!!!!!!!!!!!!!!!!

  • I’ll post the way I made it to be perfect ok?

  • Ball show! I added your code as correct!

1

I managed to solve with the idea of Felipe M. Martins, but I will post here the way I left to be very clean:

Process processo = Process.Start("SICON.EXE");
IntPtr h = processo.MainWindowHandle;
SetForegroundWindow(h);
processo.WaitForInputIdle(); // Isso aqui foi de extrema importância :D.
SendKeys.SendWait("senhaaqui");
SendKeys.SendWait("{ENTER}");

Browser other questions tagged

You are not signed in. Login or sign up in order to post.