SOL9 Sample: WMPCdromPlaylist

SOL9 2.0 Samples

1 Screenshot


2 Source code

/*
 * WMPCdromPlaylist.cpp 
 * Copyright (c) 2015 Antillia.com TOSHIYUKI ARAI. ALL RIGHTS RESERVED. 
 */


// SOL9
// 2011/12/20

#include <sol/COMInitializer.h>
#include <sol/Locale.h>

#include <sol/wmp/WMPPlayer.h>
#include <sol/wmp/WMPLibrary.h>
#include <sol/wmp/WMPLibraryServices.h>
#include <sol/wmp/WMPCdrom.h>
#include <sol/wmp/WMPCdromCollection.h>
#include <sol/wmp/WMPPlaylist.h>
#include <sol/wmp/WMPStringCollection.h>

#include <sol/wmp/WMPMedia.h>
#include <sol/FileWriter.h>

int _tmain(int argc, _TCHAR* argv[])
{
  if (argc != 2) {
    _tprintf(_T("Usage: %s xmlFileName\n"), argv[0]);
    return 0;
  }

  COMInitializer initializer;  
  const TCHAR* xmlFile = argv[1];

  Locale locale;

  try { 
    FileWriter writer = xmlFile;

    WMPPlayer player;
    WMPCdromCollection collection = player.getCdromCollection();

    long lcount = collection.getCount();
    writer.writeln(L"<?xml version=\"1.0\" encoding=\"UTF-16\"?>");
    writer.writeln(L"<%s>", argv[0]);
    writer.writeln(L"<CdromCollection Count=\"%d\">", lcount);

    for (long n = 0; n<lcount; n++) {

      WMPCdrom cdrom = collection.item(n);
      writer.writeln(L"<Cdrom Index=\"%d\">", n);
      WMPPlaylist playlist = cdrom.getPlaylist();
      playlist.writeProperties(writer);
      writer.writeln(L"</Cdrom>");      
    }
    writer.writeln(L"</CdromCollection>");
    writer.writeln(L"</%s>", argv[0]);

  } catch (...) {
    printf("Exception\n");
  }
}

Last modified: 2 May 2016

Copyright (c) 2016 Antillia.com ALL RIGHTS RESERVED.