Forum

windows service'de ...
 
Bildirimler
Hepsini Temizle

windows service'de mp3 çalmak

2 Yazılar
2 Üyeler
0 Reactions
727 Görüntüleme
(@fatihyorulmaz)
Gönderiler: 3
Active Member
Konu başlatıcı
 
[#321106]

arkadaşlar ben windows servicede mp3 çalar yapmaya çalışıyorum. kodları windows forma aktardığım zaman çalışyor ama servicede çalmıyor hata da alamıyorum kodları veriyorum sizce nerde hata yapıyorum

 

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Diagnostics;

using System.ServiceProcess;

using System.Text;

using System.IO;

using System.Runtime.InteropServices;

using System.Media;

using System.Net;

using System.Runtime;

using System.Windows;

namespace WindowsService1

{

    public partial class Service1 : ServiceBase

    {

        [DllImport("winmm.dll")]

        private static extern long mciSendString(string strCommand, StringBuilder strReturn, int iReturnLength, IntPtr hwndCallback);

        public string Pcommand;

        public bool isOpen;

        public Service1()

        {

            InitializeComponent();

        }

        protected override void OnStart(string[] args)

        {

            Pcommand = "open \"" + "C:\\Users\\FATİH\\Music\\20-Ömer Karaoğlu -  İbrahim olur adı onun.mp3" + "\" type mpegvideo alias MediaFile";

            mciSendString(Pcommand, null, 0, IntPtr.Zero);

            isOpen = true;

            Play(true);

        }

        public void Play(bool loop)

        {

            if (isOpen)

            {

                Pcommand = "play MediaFile";

                if (loop)

                    Pcommand += " REPEAT";

                mciSendString(Pcommand, null, 0, IntPtr.Zero);

            }

        }

        protected override void OnStop()

        {

        }

    }

} 


 
Gönderildi : 03/04/2012 03:01
(@rahmidilli)
Gönderiler: 2452
Famed Member
Paylaş: