Dark Bit Factory & Gravity
PROGRAMMING => Purebasic => Topic started by: inc. on July 22, 2014
-
Hi Folks,
i made it, done to 98%, my V2M Windows Media Player.
It plays: V2M version 1.0 and 1.5 songs. (1.0 will be converted in the background to v1.5 ) and play it than.
All in all it is a Player in somehow like Winamp.
here is a Screenshot:
(http://abload.de/img/v2mplayer_x9qzu.jpg)
Used PureBasic V.4.6
MP3D Lib for the v2m Replay Routine
Pure color Lib by Gnozal
okay:
i also included strings for the registry
that allow:
~ double click on a V2M Song will open the player and play the song.
~ remind the Icon for v2m songs
all works good but i have a problem in this case:
when i load another v2m song (double click a v2m song) the player ends, it's closing and open up again and play the new song.
I wanna ask some Pro Mate in here, to help me out with this issue.
i want the Player stay opened. the player must NOT close when pressed on another v2m song.
the player must check:
1. new v2m was pressed (works)
2. stop playing (works)
3. DON'T CLOSE (not working)
4. Stay present and play the new DOUBLE CLICKEd SONG. (working not really)
i know there is a function but i failed to include this in my Source Code :(
for testing: download the beta player here:
-
Nice work with the player, i really like it. :clap:
When you say the player closes do you mean the window disappears when you double click on a new song?
If so then you can use the StickyWindow(#Window, State) function to force it to stay on top when you double click on a new song.
-
Thank you :D
yes. my problem is:
the Player is closing and opens again when double clicked an other v2m sound. i need to keep, FORCE :diablo:, the player Opened.
nice idea with the function.
@KrazyK
sorry wrong Funktion you mentioned.
your function only set a window always on top.
like this:
SetWindowPos_(WindowID(0),#HWND_TOPMOST,0,0,0,0,#SWP_NOMOVE|#SWP_NOSIZE)
but this is not my Problem.
the player itself must check:
~ "okay i am open and play a song"
~ "hu ? the user want to play me another v2m?"
~ "ok... i get noted, i still opened. i have to stop playing and get the new one and play it"
~ selfcheck done
i know there is a Function called: CreateMutex
CreateMutex avoid a 2nd instance ...
but i failed while including this one. no idea how :(
that's why i am asking ???
-
AppName.s="test_mutex"
If Not OpenMutex_(#MUTEX_ALL_ACCESS,0,@AppName)
CreateMutex_(0,0,@AppName)
If OpenWindow(0, 0, 0, 230, 90, "Test", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ButtonGadget (1, 10, 10, 200, 20, "Klick mich")
CheckBoxGadget(2, 10, 40, 200, 20, "Markiere mich")
If CreateMenu(0, WindowID(0))
MenuTitle("Menu")
MenuItem(1, "Eintrag 1")
MenuItem(2, "Eintrag 2")
MenuItem(3, "Eintrag 3")
EndIf
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_Gadget
Select EventGadget()
Case 1 : Debug "Schalter 1 angeklickt!"
Case 2 : Debug "Schalter 2 angeklickt!"
EndSelect
Case #PB_Event_Menu
Select EventMenu()
Case 1 : Debug "Menü-Eintrag 1 angeklickt!"
Case 2 : Debug "Menü-Eintrag 2 angeklickt!"
Case 3 : Debug "Menü-Eintrag 3 angeklickt!"
EndSelect
EndSelect
Until Event = #PB_Event_CloseWindow
EndIf
Else
MessageRequester("TestMutex","2.Instance!!!",#MB_OK)
EndIf
End
PB5.22
-
thanks,
but i guess this won't work in pb 4.6
this is my problem. i don't want to port the whole source into the latest PB version.
i 'll give em a try in PB 4.6
EDIT:
okay. works in PP 4.6
this should solve my problem.
i give reply when it's done
thank you again
-
only this is you friend:
AppName.s="test_mutex"
If Not OpenMutex_(#MUTEX_ALL_ACCESS,0,@AppName)
CreateMutex_(0,0,@AppName)
it works in your version too, it's windows-api...
-
@ energy
thank you for the reply. i solved the problem in other way and tried your solution too. both works fine.
now i encounter another damn Problem:
MuteX now prevents my Function: double click on a v2m song
now it only works once in the first time when the player is not open. if i try to double click another v2m tune while the player is playing , the mutex prevent : open the next double clicked v2m tune >:(
maybe i can bypass this with another registry string?
my current reg string for double click and open:
Procedure AssociateFileExtension(Key$, Ext$, ExtDescription$, Programm$, Icon$, PrgKey$, CmdDescription$, CmdKey$) ; add File Extension to Registry
Protected Cmd$ ; Command
Protected CmdPath$ ; Path
CmdPath$ = Key$+"\shell\"+CmdDescription$+"\command" ; create Path
Cmd$ = Chr('"')+Programm$+Chr('"') + " " + Chr('"')+"%1"+Chr('"') ; create Command
CreateRegistryKeyValue(#HKEY_CLASSES_ROOT, "."+Ext$, "", Key$) ; create Key for Extension
CreateRegistryKeyValue(#HKEY_CLASSES_ROOT, Key$, "", ExtDescription$) ; Description
CreateRegistryKeyValue(#HKEY_CLASSES_ROOT, CmdPath$, "", Cmd$) ; call the Player
If Icon$ ; if program Icon exist ...
CreateRegistryKeyValue(#HKEY_CLASSES_ROOT, Key$+"\DefaultIcon", "", Icon$) ; add Program Icon
EndIf
EndProcedure
AssociateFileExtension("v2mplayer", "v2m", "v2mPlayer", ProgramFilename(), ProgramFilename() + ",-1", "v2mplayer", "open", "")
any solution?
thank you