471,599 Members | 1,848 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,599 software developers and data experts.

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

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
2 5179
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
Please guys, i would really appreciate it...

Dec 6 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Grey | last post: by
10 posts views Thread by Michi | last post: by
reply views Thread by ViRi | last post: by
2 posts views Thread by Robert Zahm | last post: by
reply views Thread by Truevision .Net | last post: by
2 posts views Thread by Andreas Mueller | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by Anwar ali | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.