Login to reply
by aktionline 11 months ago
to paste a text to a notpad window, I need to get it focus.I tried so much but never get it working using SetForegroundWindow which work with user32.dll, but I cannot import this dll. I got crash:System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo();psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;psi.FileName = @"notepad.exe";System.Diagnostics.Process process = new System.Diagnostics.Process();process.StartInfo = psi;process.EnableRaisingEvents = true;process.Start();SetForegroundWindow(process.MainWindowHandle);thank you for helping
by Rebin 11 months ago
Hi,Sorry for the late reply.Here is your solution, two code nodes, first one opens notepad and set focus on it, and the other one takes the process name, if sets focus on it.those two nodes depend on a C# file called "Native Extensions" that you need to put in the SourceLibraries in your project's directory.Here is the project sample.