title: Use QT 4.7.4 Window to show a video with libvlc 2.1.0
body: <p>i tried the whole day to show a video with VLC in my QT Project.</p>
  
  <p>The video works if i dont use the line <code>libvlc_media_player_set_hwnd</code>. Without this line VLC generates a window automatically. It is very important then i can choose my own window or subwindow area to show the video.</p>
  
  <p>The error is:
  <code>main vout display error: Failed to set on top</code></p>
  
  <p>I used different QT classes to show the video. QVideoWidget, QWidget, QFrame and QMainWindow. It didnt change anything. (OS is windows)</p>
  
  <p>There are a lot of different solutions in the internet. I guess it should work with the code below.</p>
  
  <p>I also tried different versions of libvlc, but the error was always the same.</p>
  
  <p>play() method:</p>
  
  <pre><code>void MainWindow::play()
  {
  
      libvlc_instance_t * inst;
      libvlc_media_player_t *mp;
      libvlc_media_t *m;
  
      /* Load the VLC engine */
      inst = libvlc_new (0, NULL);
  
      if(!inst)
          std::cout &lt;&lt; "Can't load video player plugins" &lt;&lt; std::endl;
  
  
      m = libvlc_media_new_path (inst, "content.avi");
  
      /* Create a media player playing environment */
      mp = libvlc_media_player_new_from_media (m);
  
      HWND windowID = reinterpret_cast&lt;HWND&gt;(this-&gt;winId());
  
      /* It works without this line */
      libvlc_media_player_set_hwnd(mp, windowID);
  
  
      /* play the media_player */
      libvlc_media_player_play (mp);
  
      Sleep(uint(10000)); /* Let it play a bit */
  
      /* Stop playing */
      libvlc_media_player_stop (mp);
  
      /* Free the media_player */
      libvlc_media_player_release (mp);
  
      libvlc_release (inst);
  
  }
  </code></pre>
  
  <p>main.cpp:</p>
  
  <pre><code>QApplication a(argc, argv);
  MainWindow w;
  w.show();
  
  w.play();
  
  return a.exec();
  </code></pre>
  
  <p>Thanks in advance for helpful informations.</p>
  
  <p>Darian</p>