title: Accessing COM methods from Foxpro
body: <p>My company is trying to use a 3rd party PDF generator from within VFoxpro 9.0. They supplied us with a .dll COM file and method documentation, but they don't support Foxpro so they can't help with this. </p>
  
  <p>I registered the DLL and load the COM, and it succeeds - after I createobject() intellisense prompts me with the list of methods, so I know it is importing them correctly. But, when I try calling any of the methods I get a popup window which simply says "syntax error.", which is of very little help. I tried calling one method which takes no arguments, in case the problem was passing conventions, but that one also returns "syntax error". Is there anything more I need to do besides create an object and use it for method calls?</p>
  
  <p>I am not really a foxpro guy, but I have tried this same thing using different COMs, like Excel.Application, and they work as I would expect them to. Is there any reason a COM might be incompatible with Foxpro, or require some other manipulation to get it to work?</p>
  
  <p>Thanks very much for any suggestions.</p>
  
  <hr>
  
  <p>OK, after a day and a half I found the problem.</p>
  
  <p>I was typing <code>a=createobject("library.class")</code> and then <code>= a.method()</code>, and it was returning "syntax error". It turns out that if I call the variable anything but <code>a</code> it works! It appears there is some sort of bug in foxpro so that it is not parsing this correctly when the variable name is <code>a</code>. If I use <code>b</code>, <code>x</code>, <code>anotherName</code>, or anything else it works. If I type <code>?a</code> it confirms that <code>a</code> is an <code>(object)</code>, and as I said intellisense is recognizing all the method names and types. I can't wait to get back to java.</p>
  
  <p>So thanks, no other answers are needed, but I will leave this up in case it can help some other poor soul.</p>