How to write a program in C ++ or C # that runs applications in Windows Vista?
For example, starting Dreamweaver CS 4 ("C: \ Program Files \ Adobe \ Adobe Dreamweaver CS4 \ Dreamweaver.exe) and placing it on top of the BringWindowToTop function?
In c #
Process.Start("c:\whatever\somefile.exe", <commandline args>);
gotta do it
using System; using System.Diagnostics; namespace Launcher { public static class Program { public static void Main(string[] args) { ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.FileName = args[0]; startInfo.WindowStyle = ProcessWindowStyle.Normal; Process.Start(startInfo); } } }
: Process.Start.
Process.Start
exe, .
exe , , .
, SetForegroundWindow(int hWnd), FindWindow(string lpClassName, string lpWindowName), :
SetForegroundWindow(int hWnd)
FindWindow(string lpClassName, string lpWindowName)
http://www.dotnetspider.com/resources/5772-Bring-e-window-Front-set-It-Active-window.aspx
, .
, , - , . EnumWindows() , . , -, , .
EnumWindows()
ShellExecute(NULL,_T(""), _T("C:\\windows\\notepad.exe"), _T(""), NULL, SW_SHOWMAXIMIZED);
notepad.exe runas.runas . .
C/++ .
system("c:\whatever\somefile.exe");
++ #, , AutoIt, , , DW4, ( ):
AutoItSetOption("WinTitleMatchMode", 2) Run("C:\Program Files\Adobe\Adobe Dreamweaver CS4\Dreamweaver.exe", "", @SW_MAXIMIZE) WinSetOnTop("Dreamweaver", "", 1)
, script , exe (Aut2Exe). , :)
Use CreateProcess . Or look at an example here .
Source: https://habr.com/ru/post/1718457/More articles:Blocking Strategy with PropertyChangeListener - javaКаковы наилучшие методы разработки для поддержки нескольких версий JRE? - javaHow to remove non-unique lines from a large file using Perl? - perlIs malloc / new return memory blocking cache or RAM? - c ++Table overflow handling - htmlHow to implement right click option in ASP.NET Treeview - asp.netЗапрос спящего режима на примере (от Spring 3) - javaJavaScript image popup - javascriptGWT Change URL after processing request parameters - urlHow to change the DataContext button of the parent parent DataContext? - buttonAll Articles