February 12, 200916 yr I'm trying to talk to FM10 via the activeX. The problem is when I try to set the value of a FMPRO70Lib.Documents the ActiveX throws an error. Here's a sample FMPRO70Lib.Application fmApp; FMPRO70Lib.Documents fmDocs; fmApp = new FMPRO70Lib.Application(); fmApp.Visible = 1; fmDocs = (FMPRO70Lib.Documents) fmApp.Documents; // Error here! ... Does anyone know why?
February 13, 200916 yr No, works just fine here. You did make a reference to the FM COM object, right? using FMPRO70Lib; namespace test_FMactiveX { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { FMPRO70Lib.Application fmApp; FMPRO70Lib.Documents fmDocs; fmApp = new FMPRO70Lib.Application(); fmApp.Visible = 1; fmDocs = (FMPRO70Lib.Documents)fmApp.Documents; this.label1.Text = fmDocs.Count.ToString(); } } }
February 13, 200916 yr Author I don't know why, but when I rebooted my computer everything went fine. Thanx
February 14, 200916 yr Haven't had time to test this in 10 but keep in mind that there is known bug in the FM activeX implementation that if you hit it a number of times in quick succession, FM will go deaf and you'll get errors or scripts won't execute when you call them. The only cure is to quit FM and restart it...
February 16, 200916 yr Author Even if I quit FM and/or kill the process, I still had the null error. I really needed to reboot the computer. Might be something wrong with the internal addressing. By the way, do you know how to get the current instance of FM? Or the object will get it automatically when I instanciate it? Edited February 16, 200916 yr by Guest
February 16, 200916 yr yes, it will hook into the running instance of FMP. If FMP is not running it will launch the last version you launched manually. So if you have FMP8, 9 and 10 installed on your machine (or FMP and FMPA) and none is running, the call to FMPRO will launch the last one you used.
Create an account or sign in to comment