How to write a running program in C ++ or C # for Windows Vista

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?

+3
source share
8 answers

In c #

Process.Start("c:\whatever\somefile.exe", <commandline args>);

gotta do it

+7
source
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);
    }
  }
}
+4
source

: Process.Start.

exe, .

exe , , .

, SetForegroundWindow(int hWnd), FindWindow(string lpClassName, string lpWindowName), :

http://www.dotnetspider.com/resources/5772-Bring-e-window-Front-set-It-Active-window.aspx

, .

+4

, , - , . EnumWindows() , . , -, , .

+3

, .

ShellExecute(NULL,_T(""), _T("C:\\windows\\notepad.exe"), _T(""), NULL, SW_SHOWMAXIMIZED);

notepad.exe runas.
runas . .

+3

C/++ .

system("c:\whatever\somefile.exe");

, .

+2

++ #, , AutoIt, , , DW4, ( ):

AutoItSetOption("WinTitleMatchMode", 2)
Run("C:\Program Files\Adobe\Adobe Dreamweaver CS4\Dreamweaver.exe", "", @SW_MAXIMIZE)
WinSetOnTop("Dreamweaver", "", 1)

, script , exe (Aut2Exe). , :)

+2
0
source

Source: https://habr.com/ru/post/1718457/


All Articles