当前位置: 首页>>代码示例>>C#>>正文


C# IMediaEventEx.SetNotifyWindow方法代码示例

本文整理汇总了C#中IMediaEventEx.SetNotifyWindow方法的典型用法代码示例。如果您正苦于以下问题:C# IMediaEventEx.SetNotifyWindow方法的具体用法?C# IMediaEventEx.SetNotifyWindow怎么用?C# IMediaEventEx.SetNotifyWindow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IMediaEventEx的用法示例。


在下文中一共展示了IMediaEventEx.SetNotifyWindow方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ShowMedia

        /// <summary>
        /// Plays the given mediafile in the internal mediaplayer
        /// </summary>
        /// <param name="FilePath">File to play</param>
        public void ShowMedia(string FilePath)
        {
            StopMedia();
            Lbl_CurrentMedia.Text = Path.GetFileName(FilePath);
            m_objFilterGraph = new FilgraphManager();
            m_objFilterGraph.RenderFile(FilePath);

            m_objBasicAudio = m_objFilterGraph as IBasicAudio;

            try
            {
                m_objVideoWindow = m_objFilterGraph as IVideoWindow;
                m_objVideoWindow.Owner = (int)panel2.Handle;
                //m_objVideoWindow.Owner = (int)panel1.Handle;

                m_objVideoWindow.WindowStyle = WS_CHILD | WS_CLIPCHILDREN;
                m_objVideoWindow.SetWindowPosition(panel2.ClientRectangle.Left,
                   panel2.ClientRectangle.Top,
                    panel2.ClientRectangle.Width,
                    panel2.ClientRectangle.Height);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                m_objVideoWindow = null;
            }

            m_objMediaEvent = m_objFilterGraph as IMediaEvent;

            m_objMediaEventEx = m_objFilterGraph as IMediaEventEx;
            m_objMediaEventEx.SetNotifyWindow((int)this.Handle, WM_GRAPHNOTIFY, 0);

            m_objMediaPosition = m_objFilterGraph as IMediaPosition;

            m_objMediaControl = m_objFilterGraph as IMediaControl;

            m_objMediaControl.Run();
            m_CurrentStatus = MediaStatus.Running;
            UpdateMediaButtons();

            //UpdateStatusBar();
            //UpdateToolBar();
        }
开发者ID:szopenfx,项目名称:code,代码行数:47,代码来源:GraphicalInterface2.cs

示例2: FindCaptureDevice

        /*
            // Uncomment this version of FindCaptureDevice to use the DsDevice helper class
            // (and comment the first version of course)
            public IBaseFilter FindCaptureDevice()
            {
              System.Collections.ArrayList devices;
              object source;

              // Get all video input devices
              devices = DsDevice.GetDevicesOfCat(FilterCategory.VideoInputDevice);

              // Take the first device
              DsDevice device = (DsDevice)devices[0];

              // Bind Moniker to a filter object
              Guid iid = typeof(IBaseFilter).GUID;
              device.Mon.BindToObject(null, null, ref iid, out source);

              // An exception is thrown if cast fail
              return (IBaseFilter) source;
            }
        */
        public void GetInterfaces()
        {
            int hr = 0;

            // An exception is thrown if cast fail
            graphBuilder = (IGraphBuilder)new FilterGraph();
            captureGraphBuilder = (ICaptureGraphBuilder2)new CaptureGraphBuilder2();
            mediaControl = (IMediaControl)graphBuilder;
            videoWindow = (IVideoWindow)graphBuilder;
            mediaEventEx = (IMediaEventEx)graphBuilder;

            hr = mediaEventEx.SetNotifyWindow(Handle, WM_GRAPHNOTIFY, IntPtr.Zero);
            DsError.ThrowExceptionForHR(hr);
        }
开发者ID:BackupTheBerlios,项目名称:tap-svn,代码行数:36,代码来源:Video.cs

示例3: AddFileSource

    /// <summary>
    /// Adds the file source filter to the graph.
    /// </summary>
    protected override void AddFileSource()
    {
      ServiceRegistration.Get<ILogger>().Debug("DvdPlayer.AddFileSource");
      _pendingCmd = true;

      _dvdbasefilter = (IBaseFilter) new DVDNavigator();
      _graphBuilder.AddFilter(_dvdbasefilter, DVD_NAVIGATOR);

      if (_dvdbasefilter == null)
        throw new Exception("Failed to add DVD Navigator!");

      _dvdInfo = _dvdbasefilter as IDvdInfo2;
      _dvdCtrl = _dvdbasefilter as IDvdControl2;

      if (_dvdCtrl == null)
        throw new Exception("Failed to access DVD Control!");

      string path = SourcePathOrUrl;

      // check if path is a drive root (like D:), otherwise append VIDEO_TS 
      // MediaItem always contains the parent folder. Add the required VIDEO_TS subfolder.
      if (!String.IsNullOrEmpty(path) && !path.EndsWith(Path.VolumeSeparatorChar.ToString()))
        path = Path.Combine(path, "VIDEO_TS");

      int hr = _dvdCtrl.SetDVDDirectory(path);
      if (hr != 0)
        throw new Exception("Failed to set DVD directory!");

      _dvdCtrl.SetOption(DvdOptionFlag.HMSFTimeCodeEvents, true); // use new HMSF timecode format
      _dvdCtrl.SetOption(DvdOptionFlag.ResetOnStop, false);

      _mediaEvt = _graphBuilder as IMediaEventEx;
      if (_mediaEvt != null)
      {
        IScreenControl screenControl = ServiceRegistration.Get<IScreenControl>();
        _mediaEvt.SetNotifyWindow(screenControl.MainWindowHandle, WM_DVD_EVENT, _instancePtr);
      }

      SetDefaultLanguages();
    }
开发者ID:HeinA,项目名称:MediaPortal-2,代码行数:43,代码来源:DvdPlayer.cs

示例4: Open_Call

        protected override void Open_Call(string filename)
        {
            int hr = 0;

            graphBuilder = (IGraphBuilder) new FilterGraph();

            // Have the graph builder construct its the appropriate graph automatically
            hr = graphBuilder.RenderFile(filename, null);
            DsError.ThrowExceptionForHR(hr);
            /*
            try
            {
                hr = graphBuilder.RenderFile(filename, null);
                DsError.ThrowExceptionForHR(hr);
            }
            catch(Exception ex)
            {
                SystemMessage.Show(
                    Loc.T("Player.Message.CantOpenVideoFile") + Environment.NewLine+ Environment.NewLine +
                    "Exeption details :" + Environment.NewLine +
                     ex.Message + Environment.NewLine +
                     ex.Source
                    );
                return;
            }
            */
            // QueryInterface for DirectShow interfaces
            mediaControl = (IMediaControl) graphBuilder;
            mediaEventEx = (IMediaEventEx) graphBuilder;
            //mediaSeeking = (IMediaSeeking) graphBuilder;
            mediaPosition = (IMediaPosition) graphBuilder;

            // Query for video interfaces, which may not be relevant for audio files
            videoWindow = graphBuilder as IVideoWindow;
            basicVideo = graphBuilder as IBasicVideo;

            // Query for audio interfaces, which may not be relevant for video-only files
            basicAudio = graphBuilder as IBasicAudio;


            // Have the graph signal event via window callbacks for performance
            hr = mediaEventEx.SetNotifyWindow(Handle, WMGraphNotify, IntPtr.Zero);
            DsError.ThrowExceptionForHR(hr);

            // Setup the video window
            hr = this.videoWindow.put_Owner(Handle);
            DsError.ThrowExceptionForHR(hr);

            hr = this.videoWindow.put_WindowStyle(DirectShowLib.WindowStyle.Child | DirectShowLib.WindowStyle.ClipSiblings | DirectShowLib.WindowStyle.ClipChildren);
            DsError.ThrowExceptionForHR(hr);

            try
            {
                Host_SizeChanged(null, null);
            }
            catch { }
            

            #if DEBUG
                rot = new DsROTEntry(this.graphBuilder);
            #endif

            //this.Focus();

            // Run the graph to play the media file
            hr = this.mediaControl.Run();
            DsError.ThrowExceptionForHR(hr);

        }
开发者ID:vlkam,项目名称:OpenLearningPlayer,代码行数:69,代码来源:DirectShowPlayer.cs

示例5: AddSourceFilter

    /// <summary>
    /// Adds the DVDNavigator filter to the graph and sets the input path.
    /// </summary>
    protected override void AddSourceFilter()
    {
      ServiceRegistration.Get<ILogger>().Debug("DvdPlayer.AddSourceFilter");
      _pendingCmd = true;

      _dvdbasefilter = (IBaseFilter) new DVDNavigator();
      _graphBuilder.AddFilter(_dvdbasefilter, DVD_NAVIGATOR);

      if (_dvdbasefilter == null)
        throw new Exception("Failed to add DVD Navigator!");

      _dvdInfo = _dvdbasefilter as IDvdInfo2;
      _dvdCtrl = _dvdbasefilter as IDvdControl2;

      if (_dvdCtrl == null)
        throw new Exception("Failed to access DVD Control!");

      // get a local file system path - will mount via DOKAN when resource is not on the local system
      ILocalFsResourceAccessor lfsr;
      if (!_resourceLocator.TryCreateLocalFsAccessor(out lfsr))
        throw new IllegalCallException("The DvDPlayer can only play file system resources");
      string path = lfsr.LocalFileSystemPath;

      // check if path is a drive root (like D:), otherwise append VIDEO_TS 
      // MediaItem always contains the parent folder. Add the required VIDEO_TS subfolder.
      if (!String.IsNullOrEmpty(path) && !path.EndsWith(Path.VolumeSeparatorChar.ToString()))
        path = Path.Combine(path, "VIDEO_TS");

      int hr = _dvdCtrl.SetDVDDirectory(path);
      if (hr != 0)
        throw new Exception("Failed to set DVD directory!");

      _dvdCtrl.SetOption(DvdOptionFlag.HMSFTimeCodeEvents, true); // use new HMSF timecode format
      _dvdCtrl.SetOption(DvdOptionFlag.ResetOnStop, false);

      _mediaEvt = _graphBuilder as IMediaEventEx;
      if (_mediaEvt != null)
      {
        IScreenControl screenControl = ServiceRegistration.Get<IScreenControl>();
        _mediaEvt.SetNotifyWindow(screenControl.MainWindowHandle, WM_DVD_EVENT, _instancePtr);
      }

      SetDefaultLanguages();
    }
开发者ID:chekiI,项目名称:MediaPortal-2,代码行数:47,代码来源:DvdPlayer.cs

示例6: BuildDvdGraph

        public bool BuildDvdGraph(string fileName)
        {
            dvdGraphBuilder = (IDvdGraphBuilder)new DvdGraphBuilder();
            currentSpeed = NormalSpeed;
            int hr = 0;
            try
            {
                IGraphBuilder g;
                dvdGraphBuilder.GetFiltergraph(out g);
                graphBuilder = (IFilterGraph2)g;
                mediaControl = (IMediaControl)graphBuilder;
                mediaEvent = (IMediaEventEx)graphBuilder;
                mediaEvent.SetNotifyWindow(winHandle, VideoForm.WM_DSEvent, winHandle);
                ConfigureVMR();

                AMDvdRenderStatus status;
                hr = dvdGraphBuilder.RenderDvdVideoVolume(fileName, AMDvdGraphFlags.HWDecPrefer, out status);
                if (hr < 0)
                {
                    CloseInterfaces();
                    return false;
                }
            }
            catch
            {
                CloseInterfaces();
                return false;
            }
            return true;
        }
开发者ID:MizutaniEri,项目名称:firstdnet,代码行数:30,代码来源:FormLib.cs

示例7: button1_Click

        private void button1_Click(object sender, System.EventArgs e)
        {
            if (System.IO.File.Exists(textBox1.Text))
            {
                Cursor.Current = Cursors.WaitCursor;
                button1.Enabled = false;

                if (cam != null)
                {
                    cam.Dispose();
                    cam = null;
                }

                if (cam == null)
                {
                    cam = new Capture(textBox1.Text, textBox2.Text, panel1);

                    mediaEvent = cam.MediaEventEx;
                    int hr = mediaEvent.SetNotifyWindow(this.Handle, WM_GRAPHNOTIFY, IntPtr.Zero);

                    cam.Start();
                }
            }
        }
开发者ID:coolsula,项目名称:vidplaycorder,代码行数:24,代码来源:DxText.cs

示例8: Init

        public override void Init()
        {
            if (!isPlaying)
            {
                string Filename = "";
                float size = 0;
                double Max = 0;
                int volume = 0;

                graph = new FilterGraph() as IFilterGraph;
                media = graph as IMediaControl;
                eventEx = media as IMediaEventEx;
                igb = media as IGraphBuilder;
                imp = igb as IMediaPosition;
                master.form.Invoke((MethodInvoker)delegate()
                {
                    Filename = master.form.M_Filename.Text;
                    media.RenderFile(Filename);
                    size = (float)master.form.M_PrevSize.Value;
                    master.form.M_PrevSize.Enabled = false;
                    imp.get_Duration(out Max);
                    master.form.M_Seek.Maximum = (int)(Max);
                    master.form.M_Seek.Value = 0;
                    volume = master.form.M_Volume.Value;
                    span = (uint)(1000000.0f / master.form.M_CollectFPS);
                });
                graph.FindFilterByName("Video Renderer", out render);
                if (render != null)
                {
                    window = render as IVideoWindow;
                    window.put_WindowStyle(
                        WindowStyle.Caption | WindowStyle.Child
                        );
                    window.put_WindowStyleEx(
                        WindowStyleEx.ToolWindow
                        );
                    window.put_Caption("ElectronicBoard - VideoPrev -");

                    int Width, Height, Left, Top;
                    window.get_Width(out Width);
                    window.get_Height(out Height);
                    window.get_Left(out Left);
                    window.get_Top(out Top);
                    renderSize.Width = (int)(Width * size);
                    renderSize.Height = (int)(Height * size);
                    Aspect = (float)renderSize.Height / (float)renderSize.Width;
                    window.SetWindowPosition(Left, Top, renderSize.Width, renderSize.Height);

                    eventEx = media as IMediaEventEx;
                    eventEx.SetNotifyWindow(master.form.Handle, WM_DirectShow, IntPtr.Zero);
                    media.Run();
                    foreach (Process p in Process.GetProcesses())
                    {
                        if (p.MainWindowTitle == "ElectronicBoard - VideoPrev -")
                        {
                            renderwindow = p.MainWindowHandle;
                            break;
                        }
                    }
                    isPlaying = true;
                    iba = media as IBasicAudio;
                    iba.put_Volume(volume);

                    //master.form.checkBox3_CheckedChanged(null, null);
                    master.Start();
                }
            }
        }
开发者ID:Surigoma,项目名称:Electronicboard,代码行数:68,代码来源:Movie.cs

示例9: openFile

        public void openFile(string filename)
        {
            CleanUp();

            m_objFilterGraph = new FilgraphManager();
            m_objFilterGraph.RenderFile(filename);

           
            try
            {
                m_objVideoWindow = m_objFilterGraph as IVideoWindow;
                m_objVideoWindow.Owner = (int)panel1.Handle;
                m_objVideoWindow.WindowStyle = WS_CHILD | WS_CLIPCHILDREN;
                m_objVideoWindow.SetWindowPosition(panel1.ClientRectangle.Left,
                    panel1.ClientRectangle.Top,
                    panel1.ClientRectangle.Width,
                    panel1.ClientRectangle.Height);
            }
            catch (Exception)
            {
                m_objVideoWindow = null;
            }
            
        
            m_objMediaEvent = m_objFilterGraph as IMediaEvent;

            m_objMediaEventEx = m_objFilterGraph as IMediaEventEx;
            m_objMediaEventEx.SetNotifyWindow((int)this.Handle, WM_GRAPHNOTIFY, 0);

            m_objMediaPosition = m_objFilterGraph as IMediaPosition;

            m_objMediaControl = m_objFilterGraph as IMediaControl;

            this.Text = "Preview - [" + filename + "]";
            m_objMediaControl.Run();
            m_objMediaControl.Pause();
            

            UpdateStatusBar();
            UpdateToolBar();
        }
开发者ID:NeoBoy,项目名称:MiniCoder,代码行数:41,代码来源:Preview.cs

示例10: SubscribeEvents

 public int SubscribeEvents(IVideoEventHandler videoEventHandler, IMediaEventEx mediaEvent)
 {
     mediaEvent.SetNotifyWindow(Handle, currentWindowsMessage, IntPtr.Zero);
     subscribersByWindowsMessage[currentWindowsMessage] = videoEventHandler;
     return currentWindowsMessage++;
 }
开发者ID:dgis,项目名称:CodeTV,代码行数:6,代码来源:VideoControl.cs

示例11: PlayDVDInWindow


//.........这里部分代码省略.........
                if (comobj != null)
                {
                    dvdInfo = (IDvdInfo2)comobj;
                    comobj = null;
                }

                hr = dvdGraph.GetDvdInterface(typeof(IDvdControl2).GUID, out comobj);
                //DsError.ThrowExceptionForHR(hr);
                if (comobj != null)
                {
                    dvdCtrl = (IDvdControl2)comobj;
                    comobj = null;
                }

                hr = dvdGraph.GetDvdInterface(typeof(IAMLine21Decoder).GUID, out comobj);
                //DsError.ThrowExceptionForHR(hr);
                if (comobj != null)
                {
                    dvdSubtitle = (IAMLine21Decoder)comobj;
                    comobj = null;
                }

                //IBaseFilter yo = dvdSubtitle as IBaseFilter;
                //IPin mama = dvdSubtitle as IPin;

                menuItemSubtitles.Checked = ToogleSubtitles();

                hr = dvdCtrl.SetOption(DvdOptionFlag.HMSFTimeCodeEvents, true);	// use new HMSF timecode format
                DsError.ThrowExceptionForHR(hr);

                hr = dvdCtrl.SetOption(DvdOptionFlag.ResetOnStop, false);
                DsError.ThrowExceptionForHR(hr);
                


                // QueryInterface for DirectShow interfaces
                this.mediaControl = (IMediaControl)this.graphBuilder;
                this.mediaEventEx = (IMediaEventEx)this.graphBuilder;
                this.mediaSeeking = (IMediaSeeking)this.graphBuilder;
                this.mediaPosition = (IMediaPosition)this.graphBuilder;

                // Query for audio interfaces, which may not be relevant for video-only files
                this.basicAudio = this.graphBuilder as IBasicAudio;

                // Is this an audio-only file (no video component)?
                CheckVisibility();

                // Have the graph signal event via window callbacks for performance
                //hr = this.mediaEventEx.SetNotifyWindow(this.Handle, WMGraphNotify, IntPtr.Zero);
                //DsError.ThrowExceptionForHR(hr);
                hr = mediaEventEx.SetNotifyWindow(this.Handle, WM.DVD_EVENT, IntPtr.Zero);
                DsError.ThrowExceptionForHR(hr);

                if (!this.isAudioOnly)
                {
                    // Setup the video window
                    //hr = this.videoWindow.put_Owner(this.Handle);
                    //DsError.ThrowExceptionForHR(hr);
                    //this.evrDisplay.SetVideoWindow(this.Handle);

                    //hr = this.videoWindow.put_WindowStyle(WindowStyle.Child | WindowStyle.ClipSiblings | WindowStyle.ClipChildren);
                    //DsError.ThrowExceptionForHR(hr);

                    hr = InitVideoWindow();//1, 1);
                    DsError.ThrowExceptionForHR(hr);

                    GetFrameStepInterface();
                }
                else
                {
                    // Initialize the default player size and enable playback menu items
                    hr = InitPlayerWindow();
                    DsError.ThrowExceptionForHR(hr);

                    EnablePlaybackMenu(true, MediaType.Audio);
                }

                // Complete window initialization
                //CheckSizeMenu(menuFileSizeNormal);
                //this.isFullScreen = false;
                this.currentPlaybackRate = 1.0;
                UpdateMainTitle();

                this.Activate();

                //pre-roll the graph
                hr = this.mediaControl.Pause();
                DsError.ThrowExceptionForHR(hr);

                // Run the graph to play the media file
                hr = this.mediaControl.Run();
                DsError.ThrowExceptionForHR(hr);
                
                MoveToBookmark();

                this.currentState = PlayState.Running;
                if (isFullScreen)
                    tmMouseMove.Enabled = true;
            }
        }
开发者ID:babgvant,项目名称:EVRPlay,代码行数:101,代码来源:MainForm.cs

示例12: Video_Load

        private void Video_Load(object sender, EventArgs e)
        {
            try
            {
                CleanUp();

                m_objFilterGraph = new FilgraphManager();
                m_objFilterGraph.RenderFile(Application.StartupPath + @"\video\" + id +".mp4");

                m_objBasicAudio = m_objFilterGraph as IBasicAudio;

                try
                {
                    m_objVideoWindow = m_objFilterGraph as IVideoWindow;
                    m_objVideoWindow.Owner = (int)panel1.Handle;
                    m_objVideoWindow.WindowStyle = WS_CHILD | WS_CLIPCHILDREN;
                    m_objVideoWindow.SetWindowPosition(panel1.ClientRectangle.Left,
                        panel1.ClientRectangle.Top,
                        panel1.ClientRectangle.Width,
                        panel1.ClientRectangle.Height);

                }
                catch (Exception)
                {
                    m_objVideoWindow = null;
                }

                m_objMediaEvent = m_objFilterGraph as IMediaEvent;

                m_objMediaEventEx = m_objFilterGraph as IMediaEventEx;
                m_objMediaEventEx.SetNotifyWindow((int)this.Handle, WM_GRAPHNOTIFY, 0);

                m_objMediaPosition = m_objFilterGraph as IMediaPosition;

                m_objMediaControl = m_objFilterGraph as IMediaControl;

                m_objMediaControl.Run();
                m_CurrentStatus = MediaStatus.Running;

            }
            catch (Exception)
            {

                this.Close();
            }
        }
开发者ID:tatar1nro,项目名称:KKM_PFR_ScanTerminal,代码行数:46,代码来源:Video.cs

示例13: BuildGraph

        public bool BuildGraph(IntPtr windowHandle, string fileName, bool isVideo)
        {
            currentSpeed = NormalSpeed;
            int hr = 0;
            try
            {
                graphBuilder = (IFilterGraph2)new FilterGraph();
                mediaControl = (IMediaControl)graphBuilder;
                mediaEvent = (IMediaEventEx)graphBuilder;
                winHandle = windowHandle;
                mediaEvent.SetNotifyWindow(winHandle, VideoForm.WM_DSEvent, winHandle);

                if (isVideo)
                {
                    if (IsEvrPlay)
                    {
                        ConfigureEVR();
                    }
                    else
                    {
                        ConfigureVMR();
                    }
                }
                hr = graphBuilder.RenderFile(fileName, null);
                DsError.ThrowExceptionForHR(hr);

            }
            catch (Exception e)
            {
                MessageBox.Show(fileName + "\n" + e.Message);
                return false;
            }
            return true;
        }
开发者ID:MizutaniEri,项目名称:firstdnet,代码行数:34,代码来源:FormLib.cs

示例14: OpenFileFunc

        public void OpenFileFunc(int filedex)
        {
            fileIndex = filedex;
            listoffilenames.SelectedIndex = fileIndex;
            object sender = new object();
            EventArgs er = new EventArgs();
            listoffilenames_SelectedIndexChanged(sender, er);
            ReLoad();
            itemList.Refresh();
            string openedfile = this.listoffilenames.Items[fileIndex].ToString();
            m_obj_FilterGraph = new FilgraphManager();
            try
            {
                m_obj_FilterGraph.RenderFile(openedfile);
            }
            catch (Exception)
            {
                MessageBox.Show("Please choose a valid file.\n Check the file path.\n File path could be changed.");
                return;
            }
            try
            {
                m_obj_BasicAudio = m_obj_FilterGraph as IBasicAudio;
                trackBar1.Value = volumeValue;
                m_obj_BasicAudio.Volume = trackBar1.Value;
                if (mute)
                {
                    volumeValue = -10000;
                    trackBar1.Value = volumeValue;
                    m_obj_BasicAudio.Volume = trackBar1.Value;
                }
            }
            catch { }

            try
            {
                if (!newPlayerIsCreated)
                {
                    playerform = new player(itemList, listoffilenames, fileIndex, filename);
                    newPlayerIsCreated = true;
                    playerform.Location = new Point(playerformLocationX, playerformLocationY);
                }
                m_obj_VideoWindow = m_obj_FilterGraph as IVideoWindow;
                m_obj_VideoWindow.Owner = (int)playerform.Handle;
                m_obj_VideoWindow.WindowStyle = WS_CHILD;
                videoplaying = true;
                m_obj_VideoWindow.SetWindowPosition(playerform.ClientRectangle.Left,
                    playerform.ClientRectangle.Top,
                    playerform.ClientRectangle.Right,
                    playerform.ClientRectangle.Bottom);
            }
            catch (Exception)
            {
                m_obj_VideoWindow = null;
                videoplaying = false;
            }

            if (videoplaying)
            {
                trackBar2.Enabled = true;
                trackBar1.Enabled = true;
                if (fullscreen)
                {
                    if (playerformactivatedonce == 0)
                        playerform.Show();
                    fullscreen = false;
                    fullscreenfunc();
                }
                else
                {
                    if (playerformactivatedonce == 0)
                        playerform.Show();
                }
                playerform.Activate();
            }
            else
            {
                trackBar2.Enabled = true;
                trackBar1.Enabled = true;
                playerformHeight = playerform.Height;
                playerformWidth = playerform.Width;
                playerformLocationX = playerform.Location.X;
                playerformLocationY = playerform.Location.Y;
                playerform.Dispose();
                newPlayerIsCreated = false;
            }
            running = true;
            m_obj_MediaEvent = m_obj_FilterGraph as IMediaEvent;
            m_obj_MediaEventEx = m_obj_FilterGraph as IMediaEventEx;
            m_obj_MediaEventEx.SetNotifyWindow((int)this.Handle, WM_GRAPHNOTIFY, 0);
            m_obj_MediaPosition = m_obj_FilterGraph as IMediaPosition;
            m_obj_MediaControl = m_obj_FilterGraph as IMediaControl;
            trackBar2.Maximum = (int)m_obj_MediaPosition.Duration;
            trackBar2.Minimum = 0;
            trackBar2.Value = (int)m_obj_MediaPosition.CurrentPosition;
            m_obj_MediaControl.Run();
            m_CurrentStatus = MediaStatus.Running;
            try
            {
                if (searchform != null)
//.........这里部分代码省略.........
开发者ID:Cantek,项目名称:CodeSamplesFromDifferentProjects,代码行数:101,代码来源:controlForm.cs

示例15: MediaPreviewer_Load

        private void MediaPreviewer_Load(object sender, EventArgs e)
        {
            statusBarPanel1.Text = "Buffering !! Please  Wait";
                CleanUp();
                Console.WriteLine("download finished");
                m_objFilterGraph = new FilgraphManager();

                try
                {
                        m_objFilterGraph.RenderFile(fileName);
                }
                catch (Exception ex)
                {
                        return;
                }

                m_objBasicAudio = m_objFilterGraph as IBasicAudio;

                try
                {
                    m_objVideoWindow = m_objFilterGraph as IVideoWindow;
                    m_objVideoWindow.Owner = (int) panel1.Handle;
                    m_objVideoWindow.WindowStyle = WS_CHILD | WS_CLIPCHILDREN;
                    m_objVideoWindow.SetWindowPosition(panel1.ClientRectangle.Left,
                        panel1.ClientRectangle.Top,
                        panel1.ClientRectangle.Width,
                        panel1.ClientRectangle.Height);
                }
                catch (Exception)
                {
                    m_objVideoWindow = null;
                }

                m_objMediaEvent = m_objFilterGraph as IMediaEvent;

                m_objMediaEventEx = m_objFilterGraph as IMediaEventEx;
                m_objMediaEventEx.SetNotifyWindow((int) this.Handle,WM_GRAPHNOTIFY, 0);

                m_objMediaPosition = m_objFilterGraph as IMediaPosition;

                m_objMediaControl = m_objFilterGraph as IMediaControl;

                this.Text = "SMART MediaPreviewer";

                m_objMediaControl.Run();
                m_CurrentStatus = MediaStatus.Running;

                UpdateStatusBar();
                UpdateToolBar();
        }
开发者ID:niranjan-nagaraju,项目名称:SMART-Downloader,代码行数:50,代码来源:MediaPreviewer.cs


注:本文中的IMediaEventEx.SetNotifyWindow方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。