Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 03-24-2005, 12:40 PM
Lisa_holy Lisa_holy is offline
Member
 
Join Date: Sep 2002
Posts: 40
Default drag file media player

hey i got a media player on a form, how can i drag-drop a file on the form and with mediaplayer plays the songs,

only accept
mp3
wav
mid

your friend.

Lisa Holy
Reply With Quote
  #2  
Old 03-24-2005, 02:48 PM
gLes gLes is offline
Senior Member
 
Join Date: Jan 2001
Posts: 2,273
Default RE: drag file media player

Try this:

http://www.scalabium.com/faq/dct0058.htm

gLes
Reply With Quote
  #3  
Old 03-24-2005, 02:59 PM
MrDiaz MrDiaz is offline
Junior Member
 
Join Date: Mar 2005
Posts: 11
Default RE: drag file media player

Hi again Lisa:

Here is your help. See very carefully, is a little complicated.

First Add "ShellApi" on the top, in the uses.

Second: Put this in "public"
procedure WMDropFiles(var Msg: TWMDropFiles); message WM_DROPFILES;

Then this below "Implementation". (Copy exact has in here)

procedure TForm1.WMDropFiles ( var Msg : TWMDropFiles ) ;
var
fName : array [0..Max_Path] of char;
FileCount ,i: integer;
begin
FileCount := DragQueryFile( Msg.Drop,$FFFFFFFF,fName,MAX_PATH );
for i := 0 to FileCount-1 do begin
DragQueryFile( Msg.Drop,i,fName,MAX_PATH );
Mediaplayer1.FileName:=(fName);
Mediaplayer1.Open;
Mediaplayer1.Play;
end;
DragFinish ( msg.Drop );
end;


AND THE LAST THING, PASTE THIS CODE IN THE ONCREATE EVENT ON THE FORM.

DragAcceptFiles(Handle,TRUE);


That's all, I already tested, if there is a problem let me know.
If this help you please click "Accept as a answer".

Bye.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 05:28 AM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.