witam
napisalem sobie taki programik ktory po wcisnieciu buttona uruchamia mi grogram albo z jego forma albo bez tylko w procesach
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace WindowsFormsApplication5
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public enum ShowCommands : int
{
SW_HIDE = 0,
SW_SHOWNORMAL = 1,
SW_NORMAL = 1,
SW_SHOWMINIMIZED = 2,
SW_SHOWMAXIMIZED = 3,
SW_MAXIMIZE = 3,
SW_SHOWNOACTIVATE = 4,
SW_SHOW = 5,
SW_MINIMIZE = 6,
SW_SHOWMINNOACTIVE = 7,
SW_SHOWNA = 8,
SW_RESTORE = 9,
SW_SHOWDEFAULT = 10,
SW_FORCEMINIMIZE = 11,
SW_MAX = 11
}
[DllImport("shell32.dll")]
static extern IntPtr ShellExecute(
IntPtr hwnd,
string lpOperation,
string lpFile,
string lpParameters,
string lpDirectory,
ShowCommands nShowCmd);
[DllImport("kernel32.dll")]
public static extern bool Beep(int Frequency, int Duration);
// show
private void button1_Click(object sender, EventArgs e)
{
IntPtr handle = ShellExecute(IntPtr.Zero, "open", "D:\\Program Files\\MetaTrader 4\\terminal.exe", "", "", ShowCommands.SW_SHOW);
Beep(500,100);
}
// hide
private void button2_Click(object sender, EventArgs e)
{
IntPtr handle = ShellExecute(IntPtr.Zero, "open", "D:\\Program Files\\MetaTrader 4\\terminal.exe", "", "", ShowCommands.SW_HIDE);
Beep(500, 100);
}
}
}
dziala to jednak tylko dla programu ktory nie jest uruchomiony
czy jest jakas funkcja ktora pozwala na pokazywanie/ukrywanie uruchomionego juz programu :) ??
z gory dziekuje za odpowiedz
pzdr Andrzej
EDIT Taki temat moze byc ?? powiem szczerze ze nie wiem jak to zatytuowac :D