开发者

Accessing COM methods from Foxpro

开发者 https://www.devze.com 2023-03-27 11:59 出处:网络
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 t

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.

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?

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?

Thanks very much for any suggestions.


OK, after a day and a half I found the problem.

I was typing a=createobject("library.class") and then = a.method(), and it was returning "syntax error". It turns out that if I call the variable anything but a 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 a. If I use b, x, anotherName, or anything else it works. If I type ?a it confirms that a is an (object), and as I said intellisense is recognizing all the method names and types. I can't wait to get back to java.

So thanks, no other answers are needed, but I will leave this up in case it can help some other poor soul.


See the answer I typed in above - variables cannot be called "a". Sorry for not entering it as an answer so this could be closed.

0

精彩评论

暂无评论...
验证码 换一张
取 消