ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] WindowsMediaPlayer¼½©ñ­µÀÉ°ÝÃD

mciSendString¨ç¼Æ¬O¥Î¨Ó¼½©ñ¦h´CÅé¤å¥óªºAPI«ü¥O¡A¥i¥H¼½©ñMPEG,AVI,WAV,MP3,µ¥µ¥¡A¨Ï¥Î¦¹API¨ç¼Æ¥i¥H³Ð«Ø¤@­Ó²©öªº¼½©ñ¾¹¡A¤U­±¤¶²Ð¥¦ªº¨Ï¥Î¤èªk¡G
¡@¡@¸Ó¨ç¼Æ¦³¥|­Ó°Ñ¼Æ¡G
²Ä¤@­Ó°Ñ¼Æ¡G­nµo°eªº©R¥O¦r²Å¦ê¡C¦r²Å¦êµ²ºc¬O:[©R¥O][³]³Æ§O¦W][©R¥O°Ñ¼Æ].
²Ä¤G­Ó°Ñ¼Æ¡Gªð¦^«H®§ªº½w½Ä°Ï,¬°¤@«ü©w¤F¤j¤pªº¦r²Å¦êÅܶq.
²Ä¤T­Ó°Ñ¼Æ¡G½w½Ä°Ïªº¤j¤p,´N¬O¦r²ÅÅܶqªºªø«×.
²Ä¥|­Ó°Ñ¼Æ¡G¦^½Õ¤è¦¡¡A¤@¯ë³]¬°¹s
ªð¦^­È¡G¨ç¼Æ°õ¦æ¦¨¥\ªð¦^¹s¡A§_«hªð¦^¿ù»~¥N½X

¤@¡B±`¥Î©R¥O
1.¥´¶}¡]Open¡^¡A®æ¦¡¡GOpen ³]³Æ¦W[type ³]³Æ«¬¦¡][alias §O¦W]
Dim mName as string
mName = "f:\mpeg\mpeg1.avi"
mciSendString "open " & mName & " type MPEGVideo Alias​​ JofornMusic parent %u Style %u notify",0&, 0, 0
¡@¨ä¤¤¡G
open ¾Þ§@©R¥O
mName ¥þ¸ô®|¤å¥ó¦W
type MPEGVideo ¬O«ü¥´¶}MPEG,AVIµ¥Ãþ«¬¡A¦pªG¤£¥[³o¤@¥y¡A´N¬O¥´¶}WAV,MP3µ¥
Alias​​ JofornMusic ©w¸q¤F¸Ó¾Þ§@ªº§O¦W¬°movie¡A«áÄò¾Þ§@¥u­n«ü©ú§O¦W§Y¥i
parent %u ·½
Style %u ¼Ë¦¡
notify ³qª¾
2.¼½©ñ¡]Play¡^¡A®æ¦¡¡GPlay ³]³Æ¦W[from °_ÂI][to ²×ÂI]
mciSendString "play JofornMusic", 0&, 0, 0
mciSendString "play JofornMusic fullscreen", 0&, 0, 0 '¥þ«Ì¼½©ñ
¡@¡@3.¼È°±¡]Pause¡^¡G
mciSendString "pause JofornMusic", 0&, 0, 0
¡@¡@4.Ä~Äò¡]Resume¡^¡G
mciSendString "resume JofornMusic", 0&, 0, 0
¡@¡@5.°±¤î¡]Stop¡^¡G
mciSendString "stop JofornMusic", 0&, 0, 0
¡@¡@6.​​Ãö³¬¡]Colse¡^¡G
mciSendString "close JofornMusic", 0&, 0, 0
¡@¡@7.«e¶i¨ì¤U¤@­Ó¦ì¸m¡G
mciSendString "step JofornMusic", 0&, 0, 0
¡@¡@8.«á°h¨ì¤W¤@­Ó¦ì¸m¡G
mciSendString "step JofornMusic reverse", 0&, 0, 0
9.«e¶i©Î«á°hN ­Ó¦ì¸m(¨ä¤¤N<0 §Yªí¥Ü«á°h)
mciSendString "step JofornMusic by " & str(N), 0&, 0, 0
¡@¡@10.Àò¨ú·í«e¼½©ñ¦ì¸m¡G
Dim ST As String*64
mciSendString "status JofornMusic position", st, len(st), 0
¡@¡@11. ​​Àò¨ú´CÅ骺Á`ªø«×¡G
mciSendString "status JofornMusic length", st, len(st), 0
l=val(st) 'l´N¬O©Ò¼½©ñ¤å¥óªºªø«×
¡@¡@12.Àò¨ú¼½©ñ·í«eª¬ºA¡G
Dim ST As String*64
mciSendString "status JofornMusic mode", ST, Len(ST), 0
If Left(ST, 7) = "stopped" Then (³B²z¥N½X) '¼½©ñ§¹²¦
¡@¡@13.´`Àô¼½©ñ¡G
mciSendString "play JofornMusic repeat", 0&, 0, 0

¤G¡B±±¨îÁn­µ¤j¤p(1-1000)¡G
Dim V As Long
mciSendString "status JofornMusic volume",&V, len(v), 0 'V¬OÀò¨úªº­µ¶q¤j¤p­È¡C
V = 50
mciSendString "setaudio JofornMusic volume to ¼Æ­È", 0, 0, 0 'V¬O³]¸mªº­µ¶q­È

¤T¡B³]¸m¼½©ñ¦ì¸m.(»Ý¨Æ¥ý³]©w®É¶¡®æ¦¡)¡A®æ¦¡¡GSeek ³]³Æ¦W[to ¦ì¸m| to start | to end]
Dim P1 as Long, P2 as Long
P1 = 100: P2 = 3000
mciSendString "seek JofornMusic to ", P1, 0, 0 'P1¬O·í«e°_©l¦ì¸m¡A³æ¦ì¡G²@¬í
mciSendString "seek JofornMusic to start", 0&, 0, 0 '©w¦ì¨ì¶}ÀY¦ì¸m
mciSendString "play JofornMusic", 0&, 0, 0 '©w¦ì«á¦A¼½©ñ
©ÎªÌ¡G
mciSendString "play JofornMusic FROM P1 to P2",0&, 0, 0 'P1¬O°_©l¦ì¸m¡AP2¬O°±¤î¦ì¸m¡C³æ¦ì¡G²@¬í
mciSendString "seek JofornMusic to end", 0&, 0, 0 '©w¦ì¨ì³Ì«á¦ì¸m

¥|¡B¦b«ü©w±±¥ó¤W¼½©ñµøÀW¡G
mciSendString "open AVI ¤å¥ó¦Wparent hWnd style child", 0&, 0, 0
¨ä¤¤¡AhWnd ¬O±±¥óªº¥y¬`
°õ¦æ¤W­z©R¥O¤§«á¡A¼v¤ù·|³Q©ñ¸m¦b±±¥óªº¥ª¤W¨¤¡A¥B¼v¤ùªº¤j¤p¤£¨ü±±¥ó¤j¤pªº¼vÅT¡A¦pªG·Q­n§ïÅÜ
¼v¤ù¼½©ñªº¦ì¸m¤Î¤j¤p¡A¥i¥H¦b°õ¦æplay «ü¥O«e¥ý°õ¦æput «ü¥O¡A®æ¦¡¦p¤U¡G
mcisendString "put AVI ¤å¥ó¦Wwindow at XY [Width Height]", 0&, 0, 0
¨ä¤¤¡GX¡BY¬°¼v¤ù¥ª¤W¨¤§¤¼Ð¡AWidth¡BHeight¬°¼v¤ùªº¼e°ª«×

¤­¡B¦pªG¼½©ñµøÀWÁÙ¥i±±¨î«G«×(1-2000)
Dim B As Long
mciSendString "status JofornMusic brightness", B, 0, 0 'B¬OÀò¨úªº«G«×­È¡C
B = 50
mciSendString "setvideo JofornMusic brightness to " & B, &0, 0, 0 'B¬O³]¸mªº«G«×­È

¤»¡B¿ý­µ³]¸m¡G
¡@¡@¿ý­µ«e¡A¥Î¥H¤U»y¥yªì©l¤Æ
¡@¡@1.³]¬°8¦ì¡G
mciSendString "set wave bitpersample 8", "", 0, 0
¡@¡@2.³]¬°11025Hz
mciSendString "set wave samplespersec 11025", "", 0, 0
¡@¡@3.³]¬°¥ßÅéÁn¡G
mciSendString "set wave channels 2", "", 0, 0
¡@¡@4.¹ê²{PCM®æ¦¡¡]¤£¤@©w¥¿½T¡^¡G
MCISENDSTRING "set wave format tag pcm","", 0, 0
¡@¡@5.¶}©l¿ý­µ¡G
mciSendString "close JofornMusic",0&,0,0
mciSendString "open new type WAVEAudio alias JofornMusic",0&,0,0
mciSendString "record JofornMusic",0&,0,0
¡@¡@6.​​«O¦s¿ý­µ¨ìc:\123.wav
mciSendString "stop JofornMusic",0&,0,0
mciSendString "save JofornMusic C:\123.wav",0&,0,0
mciSendString "close JofornMusic",0&,0,0

¤C¡B¶}Ãö¥úÅX¡G
mciSendString "set cdaudio door open", "", 0, 0 '¥´¶}
mciSendString "set cdaudio door close", "", 0, 0 'Ãö³¬

¤K¡B¨ä¥¦
¡@¡@1.³]¸m³]³Æªº¦UºØª¬ºA¡]Set¡^
Set alias_name[audio all off][audio all on][time format ms]:
Set©R¥O¥Î¨Ó³]¸m³]³Æªº¦UºØª¬ºA.¦p:ÀR­µ,¦³Án­µ,®É¶¡®æ¦¡¬°²@¬íµ¥.
¡@¡@2.¨ú±o³]³Æªºª¬ºA¡]Status¡^
Status alias_name[length][mode][position]:
Status©R¥O¥Î¨Ó¨ú±o³]³Æªºª¬ºA.¦p:¸Ó´CÅé¤å¥óªºªø«×,¸Ó´CÅé¤å¥ó©Ò³Bª¬ºA,¸Ó´CÅé¤å¥óªº·í«e¦ì¸mµ¥. ªºªø«×,¸Ó´CÅé¤å¥ó©Ò³Bª¬ºA,¸Ó
´CÅé¤å¥óªº·í«e¦ì¸mµ¥.
°Ñ¦Ò¥N½X¡G
TCHAR fileName[]="D:\­Íªº¤åÀÉ\my music\·Ý·Ýªwªº¯ù.mp3";
TCHAR shortName[MAX_PATH];
GetShortPathName(fileName,shortName,sizeof(shortName)/sizeof(TCHAR));
TCHAR cmd[MAX_PATH+10];
wsprintf(cmd,"play %s",shortName);
mciSendString(cmd,"",NULL,NULL);
¡]½Õ¥ÎmciSendString²Ä¤@­Ó°Ñ¼Æ¶Ç¡§play ¤å¥ó¥þ¸ô®|¡¨´N¥i¥H¡A¡§¤å¥ó¥þ¸ô®|¡¨³Ì¦n¶Çµ´¹ï¸ô®|¡A¤£«Øijwanghepeng10¨º¼Ë­È¶Ç»¼¤å¥ó¦W¡C
¥t¥~¦pªG¤å¥ó¥þ¸ô®|¤¤§t¦³ªÅ®æªº¸Ü­n¨Ï¥ÎGetShortPathNameÂà´«¦¨µu¸ô®|¡C ¡^
1

µû¤À¤H¼Æ

¥@¬É¨º»ò¤j¡A¥i§Ú·Q¥h­þ¡H

TOP

¦^´_ 10# Joforn
¦^´_ 9# ML089
Pause  ¥H¤Î Resume ªº³B²z¡A§Ú¼g¤F¤@
¨ç¦¡¡A¦p¤U¡G
  1. Public Sub PauseResume()
  2.     Static Msg As Boolean    '  ¥Î¥H§P©w¬O§_¬°¨C¤é²Ä¤@¦¸°õ¦æ
  3.    
  4.     If Msg = False Then
  5.         mciSendString StrPtr("pause JofornMusic"), 0&, 0, 0
  6.         Msg = True
  7.     Else
  8.         mciSendString StrPtr("resume JofornMusic"), 0&, 0, 0
  9.         Msg = False
  10.     End If
  11. End Sub
½Æ»s¥N½X
¥t¥~¡A¦A½Ð±Ð Joforn ¤j¤j¡A¦pªG·Q­n°õ¦æ *.rmvb ªº´CÅéÀÉ¡A
ÁÙ­n¥[±¾¨º¨Ç Lib¡A¤~¯à°÷°õ¦æ¡H
ÁÂÁ§A¡I

TOP

¦^´_ 10# Joforn
¦^´_ 12# c_c_lai

·Q¤£¹D EXCEL °£­pºâ¥~¡AÁٯ༷©ñ­µ¼Ö¡A¦U¸ô­^¶¯ªº¿ãÅDµoªíÅýEXCEL¶V¨Ó¶V¦³½ì¡C
{...} ªí¥Ü»Ý­n¥Î CTRL+SHIFT+ENTER ¤TÁä¿é¤J¤½¦¡

TOP

¦^´_ 13# ML089


¥u­n¯à½Õ¥Î std dll ªº»y¨¥
´X¥G³£¯àµL©Ò¤£¯à
©Ò¥H»y¨¥¤£¬OÃöÁä
©³¼h§Þ³N¤~¬OÃöÁä

TOP

¦^´_  Joforn
¦^´_  c_c_lai

·Q¤£¹D EXCEL °£­pºâ¥~¡AÁٯ༷©ñ­µ¼Ö¡A¦U¸ô­^¶¯ªº¿ãÅDµoªíÅýEXCEL¶V¨Ó¶V ...
ML089 µoªí©ó 2016-1-23 15:22

­n¥ý¦w¸Ë¬ÛÃöªº¸Ñ½X¾¹¡A¤£¹L¥»¤H¨S¦³¨ãÅé´ú¸Õ¹L¡A§A¥i¥H¦Û¤v´ú¸Õ¤U¡A¦ý­nª`·Nªº¬O½Õ¥Î®É«ü©w¦n¥Î¨ÓÅã¥Üµe­±ªºµ¡Åé¥y¬`¡C
¥@¬É¨º»ò¤j¡A¥i§Ú·Q¥h­þ¡H

TOP

¥»©«³Ì«á¥Ñ c_c_lai ©ó 2016-1-24 20:42 ½s¿è

¦^´_ 1# lshsien
§Ú¯S¿ï¤F¤E­º­µ¼Ö (¼Ö¦±ªøµu¤£¤@¡A§tMP4ÀÉ)¡A¤ÏÂдú¸Õ
§¡¯à¥¿±`¼·©ñ¡C§A¸Õ¸Õ¬Ý§a¡I
  1. Option Explicit

  2. Dim Xwmp As IWMPMedia                       '  Playlist
  3. Dim MyPlayer As WindowsMediaPlayer
  4. Dim ListIdx As Long

  5. Public Function addList(ByVal fileName As String)
  6.     Set Xwmp = MyPlayer.newMedia(fileName)
  7.     MyPlayer.currentPlaylist.insertItem ListIdx, Xwmp
  8.     ListIdx = ListIdx + 1
  9.     DoEvents
  10.     MyPlayer.Controls.Play
  11. End Function

  12. Public Function rmvList()
  13.     DoEvents
  14.     If MyPlayer.playState = 1 Or MyPlayer.playState = 10 Then      '  "Stopped"  or  "Ready"
  15.         ListIdx = 0
  16.         MyPlayer.currentPlaylist.Clear
  17.     End If
  18. End Function

  19. Sub Ex()
  20.     Set MyPlayer = ¤u§@ªí1.WindowsMediaPlayer1
  21.     rmvList
  22.    
  23.     addList ThisWorkbook.Path & "\\" & "¤j´d©G¤Ñ¨Ïªiù»e.wav"
  24.     addList ThisWorkbook.Path & "\\" & "Ä_æשG.mp3"
  25.     addList ThisWorkbook.Path & "\\" & "µÎ§B¯S ¤p©]¦± ¤j´£µ^ºt«µ .mp4"
  26.     addList ThisWorkbook.Path & "\\" & "¸t½Ï§Ö¼Ö 01.mp4"
  27.     addList ThisWorkbook.Path & "\\" & "01_¤Ú«¢ G©¶¤§ºq Air On the G string.mp3"
  28.     addList ThisWorkbook.Path & "\\" & "ÅK¹F¥§¸¹ - My Heart Will Go On (§Ú¤ß¥Ã«í) ¤¤­^¤å¦r¹õ.mp4"
  29.     addList ThisWorkbook.Path & "\\" & "02_NOCTURNE.mp3"
  30.     addList ThisWorkbook.Path & "\\" & "03_SAULT D' AMOUR.mp3"
  31.     addList ThisWorkbook.Path & "\\" & "- Barcarolle in F sharp, Op.60.mp3"
  32. End Sub
½Æ»s¥N½X

TOP

¦^´_ 1# lshsien
°ò¥»¤W¡AWindows Media Player ¬OµLªk¼·©ñ  *.rmvb ÀÉ¡A
¦pªG§A·Q³z¹L Windows Media Player ªº¼·©ñ¾¹¨Ó¼·©ñ
*.rmvb ªº¼v¤ùÀÉ¡A¨ä¹ê°ÈÀ³¥Î½d¨Ò¦p¤U¡A´£¨Ñ¤j®a°Ñ¦Ò¡G
  1. Option Explicit

  2. Dim MyPlayer As WindowsMediaPlayer

  3. Public Function playRMVB(ByVal fileName As String)
  4.     MyPlayer.URL = fileName        '  »Ý¥H .URL ¤è¦¡«Å§i
  5.     DoEvents
  6.     MyPlayer.Controls.Play
  7. End Function

  8. Public Function InitialList()
  9.     MyPlayer.Controls.stop
  10.    
  11.     DoEvents
  12.     If MyPlayer.playState = 0 Or MyPlayer.playState = 1 Or MyPlayer.playState = 10 Then
  13.         '  0 = "Undefined"  /  1 = "Stopped"  /  10 = "Ready"
  14.         ListIdx = 0
  15.         MyPlayer.currentPlaylist.Clear
  16.     End If
  17. End Function

  18. Sub Ex()
  19.     Set MyPlayer = ¤u§@ªí1.WindowsMediaPlayer1
  20.     InitialList
  21.    
  22.     '  ******************************************************************
  23.     '  ¼·©ñ RMVB ¼v¤ùÀɻݥý¦w¸Ë Real_Alternative ªº¸ÑªR½X«á¡A Windows
  24.     '  Media Player ¤~¯à¶i¦æ¸ÑªR RMVB ¼v¤ùÀÉ¡A¶i¦Ó©l¯àª½±µ¼·©ñ¥¦¡C
  25.     '  http://www.free-codecs.com/real_alternative_download.htm
  26.     '  ¥H¤U¤T¦æ«Y .rmvb ¼v¤ù¤§¼·©ñµ{§Ç  (*** ¦ý¥u¯à©ñ¸m¦b²Ä¤@­º¼·©ñ ***)
  27.     '  1. MyPlayer.URL = ThisWorkbook.Path & "\\" & "xxxxxxxx.rmvb"
  28.     '  2. DoEvents
  29.     '  3. MyPlayer.Controls.Play
  30.     '  ******************************************************************
  31.     playRMVB ThisWorkbook.Path & "\\" & "xxxxxxxx.rmvb"
  32. End Sub
½Æ»s¥N½X

TOP

¥»©«³Ì«á¥Ñ lshsien ©ó 2016-1-26 09:25 ½s¿è

To Joforn ¤j¤j
¸g´ú¸Õ(NB¡B®à¾÷)«á¡A±zªºµ{¦¡½X¬Ò¥i¶¶§Q°õ¦æ¡A
¨Ã¸Ñ»¡¤F¬ÛÃöcode¡A«D±`·PÁ±z¡C

To  c_c_lai ¤j¤j
±z¦b5¼Ó¨Ñªºµ{¦¡½X¡A¸g¤p§Ì´ú¸Õ(NB¤W)¡A
·|ª½±µ¼·³Ì«á¤@­º¡C¥Ø«eÁÙ¦b§V¤O´ú¸Õ¤¤¡C
±z¦b16¼Ó¨Ñªºµ{¦¡½X¡A¸g¤p§Ì´ú¸Õ(NB¤W)¡A
·|¸ò¤p§Ì¤U­±©Ò­z°ÝÃD¦³­«½Æ¼·©ñªºª¬ªp¡C

¥t§i¶D¨â¥~¤j¤j¤@­Ó¦³½ìªº´ú¸Õ°ÝÃD¡A
¥ý»¡©ú´ú¸ÕÀô¹Ò
1¡B¤p§ÌªºNB¡G
ACER 5830T
WIN10
Office 2010
(¨t²Î¤ÎOFICE¬Ò§ó·s¦Ü³Ì·s)
2¡B¤½¥q¹q¸£
ASUS®à¾÷(«¬¸¹¥¼ª¾)
WIN7
OFFICE2010
(¨t²Î¤ÎOFFICE¥i¯à¥¼§ó·s¦Ü³Ì·s)

¦p¥Î¤p§Ìªº­ì©lµ{¦¡½X¶i¦æ´ú¸Õ ¡A
¦bNB¤W¬O¥i¥H«ùÄò¼½§¹¡B¦ý°ß¿W¦³´X­Ó­µÀÉ·|­«½Æ1¦¸(¥Ø«e´ú¸Õ¼Æ¦¸µo²{music_path08¡Bmusic_path09¡Bmusic_path15)¡A
¸gÀˬdcode«á¥¼µo²{¥ô¦ó¿ù»~¡C

¦b¤½¥q¹q¸£¤W¨Ì¬O¥­§¡4­º´N·|°±¤î¼·©ñ¡A¦ý­µÀÉlist¬O¦³¶iWindowsMediaPlayer¡A
»Ý¦A¦¸«ö¤UWindowsMediaPlayer¼·©ñÁä¡A©l¥iÄ~Äò¼·¡C
¬°¦ó¦P¼Ëªºcode¦b¤£¦P¹q¸£¦³µÛ¤£¤@¼Ëµ²ªG¡A¥O¤H­ê¦i©Ò«äªü¡I

¦A¦¸·PÁ¨â¦ì¶O¤ß«ü¾É¡I

TOP

To Joforn ¤j¤j
¤p§Ì·Q­n±±¨î­µ¶q¡A
¦bPublic Sub StartPlay()¤¤´¡¤J¤F­µ¶q±±¨îcode¡A
¦ýµLªk±±¨î­µ¶q¤j¤p¡A¦A½Ð±z¸Ñ´b¡C

Public Sub StartPlay()

Dim V As Long
V = 1
mciSendString StrPtr("setaudio movie volume to " & V), &O0, 0, 0 'V¬O³]¸mªº­µ¶q­È

  Dim I         As Long
  
  If waveOutGetNumDevs > 0 Then
    For I = 1 To ListCount Step 1
      With FileList(I)
        If Len(.ShortName) Then
          Select Case UCase$(ExtractFileExtension(.ShortName))
            Case ".WAV": mciSendString StrPtr("open " & .ShortName & " type waveaudio alias JofornMusic"), 0, 0, 0
            Case ".MDI": mciSendString StrPtr("open " & .ShortName & " type sequencer alias JofornMusic"), 0, 0, 0
            Case Else:   mciSendString StrPtr("open " & .ShortName & " alias JofornMusic"), 0, 0, 0
          End Select
          mciSendString StrPtr("play JofornMusic FROM 0"), 0&, 0, 0
          Do While Not IsEnd
            Sleep 50
            DoEvents
          Loop
          mciSendString StrPtr("close JofornMusic"), 0&, 0, 0
        End If
      End With
    Next I
  End If
End Sub

TOP

        ÀR«ä¦Û¦b : ¦Y­W¤F­W¡B­WºÉ¤Ü¨Ó¡A¨ÉºÖ¤FºÖ¡BºÖºÉ´d¨Ó¡C
ªð¦^¦Cªí ¤W¤@¥DÃD