Here's code for a short application, gbRadio, which plays internet radio stations. Discussion is here.
EXE and BAS are here.
Well, actually it calls up the default player for .pls files, which on my PC is MPC-HC. MPC-HC responds to %WS_ShowMinimized in ShellExecute() and will shut down with SendMessage(hWin,%WM_SysCommand, %SC_Close,0). I get the app hWin by using FindWIndow for the class "MediaPlayerClassicW", If you have a different default player you might have to make some changes to the code, or set your PC to a new default pls player.
Instead of including *.pls files, I hardcode the radio stations to avoid having to distribute pls files. When station is played, I create "temp.pls" to feed to the default pls player.
Press Play or double-click a station to play it.
Stop and closing the app shuts down the external player.
Escape will close the app.
Volume control buttons are provided

EXE and BAS are here.
Well, actually it calls up the default player for .pls files, which on my PC is MPC-HC. MPC-HC responds to %WS_ShowMinimized in ShellExecute() and will shut down with SendMessage(hWin,%WM_SysCommand, %SC_Close,0). I get the app hWin by using FindWIndow for the class "MediaPlayerClassicW", If you have a different default player you might have to make some changes to the code, or set your PC to a new default pls player.
Instead of including *.pls files, I hardcode the radio stations to avoid having to distribute pls files. When station is played, I create "temp.pls" to feed to the default pls player.
Press Play or double-click a station to play it.
Stop and closing the app shuts down the external player.
Escape will close the app.
Volume control buttons are provided
Code:
'Compilable Example: [HASHTAG="t812"]compiler[/HASHTAG] PBWin 10 [HASHTAG="t493"]compile[/HASHTAG] Exe "gbradio.exe" [HASHTAG="t742"]dim[/HASHTAG] All %Unicode = 1 $Ver = "1.0" $AppClass = "MediaPlayerClassicW" [HASHTAG="t985"]include[/HASHTAG] "Win32API.inc" Enum Equates Singular IDC_ListView = 500 IDT_Stop IDT_Play IDT_Louder IDT_Softer End Enum Global hDlg, hIcon As Dword Function PBMain() As Long Dialog Default Font "Arial Black", 16, 1 Dialog New Pixels, 0, "gbRadio v" + $Ver + " Internet Radio Player",300,300,700,400, %WS_OverlappedWindow To hDlg Control Add Button, hDlg, %IDT_Play, "Play", 10,10,75,30 Control Add Button, hDlg, %IDT_Stop, "Stop", 95,10,75,30 Control Add Button, hDlg, %IDT_Louder, "Louder", 180,10,90,30 Control Add Button, hDlg, %IDT_Softer, "Softer", 280,10,90,30 Control Add ListView, hDlg, %IDC_ListView,"", 10,50,350,200 ListView Set StyleXX hDlg, %IDC_ListView, %LVS_Ex_FullRowSelect Or %LVS_Ex_GridLines ListView Insert Column hDlg, %IDC_ListView, 1, "Category", 130,0 ListView Insert Column hDlg, %IDC_ListView, 2, "Radio Station", 250,0 LoadStations Dialog Show Modal hDlg Call DlgProc End Function CallBack Function DlgProc() As Long Local w,h As Long Select Case Cb.Msg Case %WM_InitDialog hIcon = LoadIcon(ByVal %Null, ByVal %IDI_Shield) 'use a system icon for the dialog SendMessage hDlg, %WM_SetIcon, %ICON_BIG, hIcon 'use a system icon for the dialog Case %WM_ContextMenu StopWindowsMediaPlayer Case %WM_Command Select Case Cb.Ctl Case %IdCancel : Dialog End hDlg 'Escape will close the app Case %IDT_Play : StopWindowsMediaPlayer : PlayRadio Case %IDT_Stop : StopWindowsMediaPlayer Case %IDT_Louder : keybd_event %VK_VOLUME_UP, 0, 1, 0 Case %IDT_Softer : keybd_event %VK_VOLUME_DOWN, 0, 1, 0 End Select Case %WM_Notify Select Case Cb.NmId Case %IDC_ListView Select Case Cb.NmCode Case %NM_DblClk StopWindowsMediaPlayer PlayRadio End Select End Select Case %WM_Destroy StopWindowsMediaPlayer Case %WM_Size Dialog Get Client hDlg To w,h Control Set Size hDlg, %IDC_Listview, w-20,h-60 ListView Set Column hDlg, %IDC_Listview, 2, w-120 End Select End Function Sub PlayRadio Local iRow, iResult As Long, RadioURL As WStringZ * %Max_Path ListView Get Select hDlg, %IDC_ListView To iRow ListView Get Text hDlg, %IDC_ListView, iRow, 2 To RadioURL Open "temp.pls" For Output As [NODE="1"]PowerBASIC[/NODE] Print #1, "[playlist]" + $CrLf + "NumberOfEntries=1" + $CrLf + "File1=" + RadioURL Close [NODE="1"]PowerBASIC[/NODE] iResult = ShellExecute(hDlg, "Open", ("temp.pls"), $Nul, $Nul, %SW_ShowMinimized) End Sub Sub StopWindowsMediaPlayer Local hWin As Dword Local wName As WStringZ * %Max_Path hWin = FindWindow($AppClass, ByVal %Null) SendMessage hWin, %WM_SysCommand, %SC_Close, 0 End Sub Sub LoadStations ListView Insert Item hDlg, %IDC_ListView, 1, 0, "Talk" ListView Set Text hDlg, %IDC_Listview, 1, 2, "https://kera-ice.streamguys1.com/keralive" ListView Insert Item hDlg, %IDC_ListView, 2, 0, "Country" ListView Set Text hDlg, %IDC_Listview, 2, 2, "http://198.105.216.204:8194/" End Sub