Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Juggernaut

ActiveX and C Sharp

Featured Replies

Just begining to explore ActiveX for FM. I have a short console program I'm using to play around with different ideas. However, I can not get the "DoFMScript" method to work. In fact there seems to be a problem with how I'm creating the document object that I can not chase down. Here is the code

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using FMPRO70Lib;

using System.Data.OleDb;

using System.Data.Odbc;

namespace ConsoleApplication1

{

class Program

{

static void Main(string[] args)

{

FMPRO70Lib.Application FMProApp;

FMPRO70Lib.Documents FMProDocs;

FMPRO70Lib.Document FMProDoc;

try

{

FMProApp = new FMPRO70Lib.Application();

FMProDocs = new FMPRO70Lib.Documents();

FMProDoc = new FMPRO70Lib.Document();

FMProApp.Visible = 1;

FMProDocs.Open("C:\\Filemaker\\Job2.fp7", "Admin", "");

So far no problems this all works fine.

Console.WriteLine(FMProDoc.Parent);

FMProDoc.Activate();

FMProDoc.DoFMScript("New_Record");

FMProDoc = null;

FMProApp = null;

FMProDocs = null;

}

catch(Exception ex)

{

Console.WriteLine(ex);

}

}

}

}

This part is the showstopper. Any reference to to the document object "FMProDoc" causes a failure. The error message for this version says "Exception from HRESULT: 0x80010105 <RPC_E_SERVERFAULT>> at FMPRO70Lib.IFMIdocument.get.Parent<>"

What is wrong with my code?

You initiate the FMProDoc instance here:

FMProDoc = new FMPRO70Lib.Document();

But you never assign anything to it.

Try this:

FMProDoc = FMProDocs.Open("C:FilemakerJob2.fp7", "Admin", "");

If you want to see some working code, download the source code for fmDotNet (www.fmdotnet.org). Buried in there somewhere is commented out code that uses the ActiveX interface. I don't think I ever took it out.

Oh, keep in mind that there is a bug in FM (has been ever since FM8) that if you call a script through the ActiveX interface a few times in relative quick succession (as you will do I'm sure in testing), the ActiveX interface will go deaf. At some point the script will not fire. When you see that, you have restart FM.

  • Author

Hello Wim! Thanks for your help. I will check it out. - John

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.