Author Topic: Media Player in CAD inside vba  (Read 2965 times)

0 Members and 1 Guest are viewing this topic.

Matersammichman

  • Guest
Media Player in CAD inside vba
« on: October 26, 2006, 05:39:04 PM »
It's available in the vba tools, so has anyone ever tried to code this to make it function?
In ADT2005 there is very little info.

mohnston

  • Bull Frog
  • Posts: 305
  • CAD Programmer
Re: Media Player in CAD inside vba
« Reply #1 on: October 26, 2006, 08:21:28 PM »
What do you mean by "available"?

Keep in mind that because a tool (reference, control etc.) CAN be added to a project doesn't mean that it's a good idea.
Some things are not supposed to be added to VBA projects and will break things.
Also, if you were to distribute your dvb projects and they had references to tools that the target machine did not have installed and registered you would have problems.
It's amazing what you can do when you don't know what you can't do.
CAD Programming Solutions

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: Media Player in CAD inside vba
« Reply #2 on: October 26, 2006, 09:52:56 PM »
I have successfully developed a program that plays mp3, wav, and midi files through an AutoCAD interface. The program is called CadAMP and can be found elsewhere on this forum. It has not been updated for the newer versions of AutoCAD so it may come with some issues.

In A2k and A2k2,  it will successfully play multiple files in succession, in A2k4 it will only work for single files (unless someone has updated it)
Playlists were attempted, but since there were so many different formats for them, I abandoned it. As you might know, there is no market for a player such as this, which is why I have not embellished it further.

Incidently, since it uses API calls and VBA calls independent of AutoCAD it should also be able to be played in Microstation with a limited amount of tweaking.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

Matersammichman

  • Guest
Re: Media Player in CAD inside vba
« Reply #3 on: October 30, 2006, 03:21:11 PM »
Actually, this is what I came up with- It's simple, easy, and it works.

Private Sub commandbutton1_Click()
Me.Hide
Dim RetVal
RetVal = Shell("C:\Program Files\Windows Media Player\wmplayer.exe", 1) 'shell to path
'''this loads WM at full size. take off the ",1" to load minimized.

End Sub

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: Media Player in CAD inside vba
« Reply #4 on: October 30, 2006, 03:37:07 PM »
The use of CadAMP requires no use of any media player. Instead a new thread is created in the AutoCAD process and as such AutoCAD is playing the mp3 files. I was sparked by your interest in a media player for AutoCAD to revisit it. I have now corrected the issue with multiple files in A2k2+.

I will upload the latest, including the toolbars and menu as soon as I get time.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

Guest

  • Guest
Re: Media Player in CAD inside vba
« Reply #5 on: October 30, 2006, 03:44:06 PM »
Why not just use a shortcut on the desktop or toolbar links??  Why should you have to start AutoCAD to launch Media Player?

Just curious...

As a side note... does anyone know how to automatically load a playlist from a shortcut??

Matersammichman

  • Guest
Re: Media Player in CAD inside vba
« Reply #6 on: October 30, 2006, 03:44:47 PM »
Fantastic!!!
Now if it could only play M4a files...

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: Media Player in CAD inside vba
« Reply #7 on: October 30, 2006, 06:25:58 PM »
Why not just use a shortcut on the desktop or toolbar links??  Why should you have to start AutoCAD to launch Media Player?

Just curious...

As a side note... does anyone know how to automatically load a playlist from a shortcut??

To answer your first question. You should not have to start AutoCAD to listen to an mp3 (i.e. launch media player) However, as most everyone here uses AutoCAD or some other form of design software that is VBA capable, it makes more sense to utilize an existing thread (i.e. AutoCAD) to execute the commands needed to play a media file. Do not be confused. CadAMP IS NOT a means to start any media player,  rather it turns AutoCAD (or Microstation,  Excel, Word, etc) into a media player, and it does so using a limited number of resources. Less processor time, less memory requirements etc. thus it makes more efficient use of computer resources AND for those of you who are not allowed to install media players, it completely merges with AutoCAD and becomes part of it. When you close AutoCAD, the player stops.

Now ... I am not sure what you would need to do to load a playlist in a shortcut, I would suspect you would need to edit the shortcut to point to the playlist as an argument.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie