By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,955 Members | 1,477 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,955 IT Pros & Developers. It's quick & easy.

Adding Drag and Drop Functionality to AxMicrosoft.MediaPlayer.Interop.AxWindowsMediaPlay er

P: n/a
I am wringing a small and lite Media Player to fit my custom needs for
usage while programming.

I had written some drag and drop functionality like i do with other
programs, but hey, the ActiveX doesn't support Drag and Drop. I've been
checking loads of search results, but no dice, no info on how to add
drag and drop to an activex that doesn't has it by default, or a hack
to get it to use the drag and drop of the form itself, or something
similar.

The drag&drop stuff i wrote (Get an unsupported error):
this.axWMP.DragDrop += new
System.Windows.Forms.DragEventHandler(axWMP_DragDr op);
this.axWMP.DragEnter += new
System.Windows.Forms.DragEventHandler(axWMP_DragEn ter);

void axWMP_DragEnter(object sender,
System.Windows.Forms.DragEventArgs e)
{
if
(e.Data.GetDataPresent(System.Windows.Forms.DataFo rmats.FileDrop))
{
string[] files =
(string[])e.Data.GetData(System.Windows.Forms.DataFormats.F ileDrop);
foreach (string s in files)
{
if (s.EndsWith(".avi") || s.EndsWith(".mpg") ||
s.EndsWith(".wmv"))
{
e.Effect =
System.Windows.Forms.DragDropEffects.Copy;
return;
}
}
}
else
{
e.Effect = System.Windows.Forms.DragDropEffects.None;
}
}

void axWMP_DragDrop(object sender,
System.Windows.Forms.DragEventArgs e)
{
//System.Windows.Forms.DataFormats.FileDrop
if
(e.Data.GetDataPresent(System.Windows.Forms.DataFo rmats.FileDrop))
{
string[] files =
(string[])e.Data.GetData(System.Windows.Forms.DataFormats.F ileDrop);
try
{
foreach (string s in files)
{
if (s.EndsWith(".avi") || s.EndsWith(".mpg") ||
s.EndsWith(".wmv"))
{

axWMP.currentPlaylist.appendItem(axWMP.mediaCollec tion.getByName(s).get_Item(0));
}
}
}
catch (System.Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message);
return;
}
if (axWMP.playState !=
Microsoft.MediaPlayer.Interop.WMPPlayState.wmppsPl aying)
{
axWMP.Ctlcontrols.play();
}
}
}
On a different note: i also have a small question about the Alt-Enter
behaviour of this ActiveX, when in full screen modus, and you hit
alt-enter, it goes out of fullscreen modus, it does not respont to
other hotkey's, because of this matter, i cannot write support for the
alt-enter hotkey combo, because it will allow me to toggle into full
screen the first time, but after that, it will go out of, and directly
back into fullscreen again, other combo's work without a problem.
Thanks in advance,

Nick.

Dec 4 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Anyone?

ViRi wrote:
I am wringing a small and lite Media Player to fit my custom needs for
usage while programming.

I had written some drag and drop functionality like i do with other
programs, but hey, the ActiveX doesn't support Drag and Drop. I've been
checking loads of search results, but no dice, no info on how to add
drag and drop to an activex that doesn't has it by default, or a hack
to get it to use the drag and drop of the form itself, or something
similar.

The drag&drop stuff i wrote (Get an unsupported error):
this.axWMP.DragDrop += new
System.Windows.Forms.DragEventHandler(axWMP_DragDr op);
this.axWMP.DragEnter += new
System.Windows.Forms.DragEventHandler(axWMP_DragEn ter);

void axWMP_DragEnter(object sender,
System.Windows.Forms.DragEventArgs e)
{
if
(e.Data.GetDataPresent(System.Windows.Forms.DataFo rmats.FileDrop))
{
string[] files =
(string[])e.Data.GetData(System.Windows.Forms.DataFormats.F ileDrop);
foreach (string s in files)
{
if (s.EndsWith(".avi") || s.EndsWith(".mpg") ||
s.EndsWith(".wmv"))
{
e.Effect =
System.Windows.Forms.DragDropEffects.Copy;
return;
}
}
}
else
{
e.Effect = System.Windows.Forms.DragDropEffects.None;
}
}

void axWMP_DragDrop(object sender,
System.Windows.Forms.DragEventArgs e)
{
//System.Windows.Forms.DataFormats.FileDrop
if
(e.Data.GetDataPresent(System.Windows.Forms.DataFo rmats.FileDrop))
{
string[] files =
(string[])e.Data.GetData(System.Windows.Forms.DataFormats.F ileDrop);
try
{
foreach (string s in files)
{
if (s.EndsWith(".avi") || s.EndsWith(".mpg") ||
s.EndsWith(".wmv"))
{

axWMP.currentPlaylist.appendItem(axWMP.mediaCollec tion.getByName(s).get_Item(0));
}
}
}
catch (System.Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message);
return;
}
if (axWMP.playState !=
Microsoft.MediaPlayer.Interop.WMPPlayState.wmppsPl aying)
{
axWMP.Ctlcontrols.play();
}
}
}
On a different note: i also have a small question about the Alt-Enter
behaviour of this ActiveX, when in full screen modus, and you hit
alt-enter, it goes out of fullscreen modus, it does not respont to
other hotkey's, because of this matter, i cannot write support for the
alt-enter hotkey combo, because it will allow me to toggle into full
screen the first time, but after that, it will go out of, and directly
back into fullscreen again, other combo's work without a problem.
Thanks in advance,

Nick.


Dec 4 '05 #2

P: n/a
Please guys, i would really appreciate it...

Dec 6 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.