using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices; //dodane

namespace WinampControl
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string sciezka="c:\\Program Files\\Winamp\\winamp.exe";
            System.Diagnostics.Process.Start(sciezka);
        }

        [DllImport("user32.dll")]
        private static extern IntPtr SendMessage(int hwnd, uint Msg, int wParam, int lParam);

        [DllImport("user32.dll")]
        private static extern int FindWindow(string nazwaKlasy, string nazwaOkna);

        private const int WM_COMMAND = 0x0111;

        private void button2_Click(object sender, EventArgs e)
        {
            int uchwyt = FindWindow("Winamp v1.x", null);
            SendMessage(uchwyt, WM_COMMAND, 40045, 0);
        }

        private void button3_Click(object sender, EventArgs e)
        {
            int uchwyt = FindWindow("Winamp v1.x", null);
            SendMessage(uchwyt, WM_COMMAND, 40046, 0);
        }
    }
}