El_Pablo Posted February 12, 2009 Posted February 12, 2009 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?
Wim Decorte Posted February 13, 2009 Posted February 13, 2009 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(); } } }
El_Pablo Posted February 13, 2009 Author Posted February 13, 2009 I don't know why, but when I rebooted my computer everything went fine. Thanx
Wim Decorte Posted February 14, 2009 Posted February 14, 2009 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...
El_Pablo Posted February 16, 2009 Author Posted February 16, 2009 (edited) 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, 2009 by Guest
Wim Decorte Posted February 16, 2009 Posted February 16, 2009 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.
Recommended Posts
This topic is 5801 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now