title: InvalidCastException when running in Windows 7 64-bit but not in XP 32-bit
body: <p>I hope you all can help me. I have a dll that was written in Delphi quite some time ago, so as such it is compatible with XP 32-bit. I have code written in VS2010 in C# with the target as .NET 4.0. I added the dll to the references in VS2010. It works properly in XP but when I try the same exact code in Windows 7 64-bit I get the following error</p>
  
  <blockquote>
    <p>Unable to cast COM object of type 'FASTBeamCOM.GPFASTBeamClass' to interface type 'FASTBeamCOM.IGPFASTBeam'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{B7D3D8C1-6919-11D4-8616-9E780E5EC276}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).</p>
  </blockquote>
  
  <p>The FASTBeamCOM dll contains the GPFASTBeamClass and the IGPFASTBeam interface. I was able to find out how to register the FASTBeamCOM.dll for 64-bit using the sysWOW64\regsvr32 in administrator mode. However, I don't know what else to do to get this dll to work.</p>
  
  <p>Here is a sample of some code that I used to test the dll in both XP and Windows 7</p>
  
  <blockquote>
  <pre><code>  private static FASTBeamCOM.GPFASTBeamClass f = new FASTBeamCOM.GPFASTBeamClass();
     public FASTBeamCOM.IGPFASTBeam FB
     {
         get { return f as FASTBeamCOM.IGPFASTBeam; }
     }
  </code></pre>
  </blockquote>
  
  <pre><code>   public MainWindow()
      {
          InitializeComponent();
      }
  
      private void button1_Click(object sender, RoutedEventArgs e)
      {
          int iCopyProtection = 0;
          FB.VerifyCopyProtection(ref iCopyProtection);
          FB.setApplicationName("Wholehouse.dll");
          FB.initializeFB();
          FB.SetProductAvailability();
      }
  </code></pre>
  
  <p>I've tried declaring the FB property as both GPFASTBeamClass and IGPFASTBeam and I get the same error message. The error occurs at the FB.VerifyCopyProtection command. Like I said, it works great in XP 32-bit but not Windows 7 64-bit. I don't know if it's a 32-bit vs 64-bit problem or an XP vs Windows 7 problem.</p>