DWORD CDDBQuery( HCDROM hCD, LPCDDBQUERY lpq );


Description: Queries the configured CDDB server for the CD in the unit referenced by hCD. The CDDB server is contacted using an HTTP call to a CGI on the CDDB server.

Parameters:
hCD Handle to the CD-ROM unit.
lpq Pointer to a CDDBQUERY structure to receive information from the query.

Return Value:

SS_COMP Success (does not guarantee that entries were returned, just that no error occured)
SS_ERR An error occured. Use GetAspiLibError to retrieve the specific error code.

Notes: There are two main protocols used to communicate with CDDB serers on the Internet -- HTTP and CDDBP. AKRip32 implements only the HTTP method. The CDDB server is contacted via CGI via a query such as this one. The server address, name of the server CGI, server port, user email, client name and proxy settings are configured via CDDBSetOption. The information from the query is then used in a call to CDDBGetDiskInfo to retrieve the information for the CD from the CDDB server, ie. the track titles, etc.
Example: The following code demonstrates how to use the function CDDBQuery():
    void DoCDDBQuery( HCDROM hCD )
    {
      CDDBQUERYITEM qi[5];
      CDDBQUERY query;

      ZeroMemory( &qi, sizeof(qi) );
      query.num = 5;  // set to the length of qi
      query.q   = qi;
      CDDBSetOption( CDDB_OPT_SERVER, "www.freedb.org", 0 );
      CDDBSetOption( CDDB_OPT_CGI, "/~cddb/cddb.cgi", 0 );
      CDDBSetOption( CDDB_OPT_USER, "user@akrip.sourceforge.net", 0 );
      CDDBSetOption( CDDB_OPT_AGENT, "program 1.0", 0 );
      CDDBQuery( hCD, &query );
      if ( query.num > 0 )
      {
        printf( "The following matches were found:\n" );
        for( i = 0; i < query.lnum; i++ )
	  printf( "%d: %s %s %s / %s\n", i, qi[i].categ, qi[i].cddbId,
                  qi[i].artist, qi[i].title );
      }
    }
  


See also: GetAspiLibError, CDDBSetOption, CDDBGetDiskInfo