المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : COM Interop GUID Help



C# Programming
04-05-2009, 08:06 AM
I think i have wrong GUID, how do i find out what GUID i should be using?

Im getting exception

Retrieving the COM class factory for component with CLSID {56A868B1-0AD4-11CE-B03A-0020AF0BA770} failed due to the following error: 80040154.

from following code


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;

namespace Imapi2
{
// Declare IRawCDImageTrackInfo as a COM interface which
[Guid("56A868B1-0AD4-11CE-B03A-0020AF0BA770"),
InterfaceType(ComInterfaceType.InterfaceIsDual)]
interface IRawCDImageTrackInfo
{

void get_ISRC(
[Out,MarshalAs(UnmanagedType.BStr)] string value);

void get_StartingLba();
void get_SectorCount();
void get_TrackNumber();
void get_SectorType();
void put_ISRC();
void get_DigitalAudioCopySetting();
void put_DigitalAudioCopySetting();
void get_AudioHasPreemphasis();
void put_AudioHasPreemphasis();
void get_TrackIndexes();
}

// Declare ccIRawCDImageTrackInfo as a COM coclass:
[ComImport, Guid("56A868B1-0AD4-11CE-B03A-0020AF0BA770")]
class ccIRawCDImageTrackInfo
{
}
}

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
try
{
Imapi2.ccIRawCDImageTrackInfo ccTest1 =
new Imapi2.ccIRawCDImageTrackInfo();
Imapi2.IRawCDImageTrackInfo test1 =
(Imapi2.IRawCDImageTrackInfo)ccTest1;
}
catch (Exception ex)
{
Console.WriteLine("Unexpected COM exception: " + ex.Message);
}
Wait for completion.
Console.WriteLine("Press Enter to continue.");
Console.ReadLine();
}
}
}



http://msdn.microsoft.com/en-us/library/cc512151(VS.85).aspx[^ (http://msdn.microsoft.com/en-us/library/cc512151(VS.85).aspx)]
That is link to interface i am trying to use