title: C# AddFontResource does not work - returns 2 fonts installed when called on only 1 font
body: <p>I am trying to programmatically install a True-Type font in C# on Win7 64 bit.</p>
  
  <p>For some reason, when I call AddFontResource, the font does not install correctly and I get a return of "2" even though I'm only adding one font.</p>
  
  <p>The font installs correctly if I just double-click it and install it using the regular Windows font installing interface, so I know it's a proper font.  If I call AddFontResource on an invalid path, then I get the correct return of 0 for no fonts installed, so it seems like it's doing "something" and finding the font file, but whatever it's doing, it isn't working.</p>
  
  <p>Here's the code I'm using:</p>
  
  <pre><code>    [DllImport("user32.dll")]
      public static extern int SendMessage(int hWnd,  uint Msg, int wParam,  int lParam);
      [DllImport("gdi32")]
      public static extern int AddFontResource(string lpFileName); 
      public static void InstallFonts()
      {
          const int WM_FONTCHANGE = 0x001D;
          const int HWND_BROADCAST = 0xffff;
          int Ret = AddFontResource(@"C:\FontFile.ttf");
          int Res = SendMessage(HWND_BROADCAST, WM_FONTCHANGE, 0, 0);
      }
  </code></pre>
  
  <p>The font "FontFile.ttf" obviously exists.  As I mentioned, AddFontResource returns 2, which makes no sense, and SendMessage returns 1 so it's sending out correctly.</p>
  
  <p>Any ideas what might be going wrong?</p>
  
  <p>Thanks!</p>