MitchSchaft:Ask the Vista forum. This is MCE2005.
The Guide database is essentially the same in Vista as it is in MCE2005. And since there isn't a "Hacks & Mods" section for Vista this is as good a forum as any to ask the question. Actually, I've yet to find a forum anywhere (on TGB or elsewhere) that gives good coverage to this sort of system level development with MCE/VMC. Yes, there are plenty of discussion forums on Media Center application development but they all focus on using the supplied Media Center SDK and not on doing things like accessing the Guide data or other system level stuff.
Anyway, back to the original question....
You are on the right track trying ehepg.dll/ehepgdat.dll/ehiProxy.dll. It is possible to access the Guide using these assemblies. The app doesn't need to be an MCE plugin, just a .NET application.
Here's a fragment of code (that can be used in a console app) that will access the Guide and print out the end time of valid data. You can access other properties in a similar way.
Microsoft.Ehome.Epg.Ehepgdat ehepgdat = new Microsoft.Ehome.Epg.Ehepgdat();
Microsoft.Ehome.Epg.Guide currentEpgGuide = (Microsoft.Ehome.Epg.Guide) Microsoft.Ehome.Epg.Guide.CurrentEPG;
Console.WriteLine( "End time: " + currentEpgGuide.EndTime.ToShortDateString() + " " + currentEpgGuide.EndTime.ToLongTimeString() );
As you have probably found, the Guide is stored in a SQLLite database. Assuming that you know the name of the current database file (which can be found from the "currentEpg" setting in the registry) then querying this database is easy. Here's an example that will access the services (i.e. channels) data and output it in the form of CSV data (which could then be read into Excel, for example).
// set up variable currentEpgFile with full path to Guide database file
SqlLiteConnection sqlConnection = new SqlLiteConnection();
sqlConnection.Init( currentEpgFile, true );
sqlConnection.Open();
SqlLiteCommand sqlCommand = (SqlLiteCommand) sqlConnection.CreateCommand();
sqlCommand.CommandText = "select * from services";
sqlCommand.CommandType = CommandType.Text;
SqlLiteDataAdapter sqlAdapter = new SqlLiteDataAdapter();
sqlAdapter.SelectCommand = sqlCommand;
DataSet ds = new DataSet();
sqlAdapter.Fill( ds );
sqlConnection.Close();
for ( int i = 0; i < ds.Tables[ 0 ].Columns.Count; ++i )
{
if ( i != 0 )
{
Console.Write( ", " );
}
Console.Write( ds.Tables[ 0 ].Columns[ i ].ColumnName );
}
Console.WriteLine();
foreach ( DataRow row in ds.Tables[ 0 ].Rows )
{
for ( int i = 0; i < ds.Tables[ 0 ].Columns.Count; ++i )
{
if ( i != 0 )
{
Console.Write( ", " );
}
if ( row[ i ].GetType() == typeof( string ) )
{
Console.Write( "\"" + row[ i ] + "\"" );
}
else
{
Console.Write( row[ i ].ToString() );
}
}
Console.WriteLine();
}
Hope that helps,
Pete