Jump to content
Server Maintenance This Week. ×

ActiveX causing FMP 8.5 to crash


This topic is 6051 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I have a VB app that runs a script in FMP 8.5 via activeX. For the most part it runs, but about 1 in ten times it causes FMP to terminate in a crash. I can't seen to figure out why it is doing this. I am using very standard VB code for the call and releasing the variables etc when done.

Windows reports this error:

AppName: filemaker pro advanced.exe AppVer: 8.5.1.378 ModName: dbengine.dll

ModVer: 8.5.1.378 Offset: 0007fde5

If you have experienced this or have sugestions I would really appriciate your help.

Thanks

Charles Delfs

Edited by Guest
Link to comment
Share on other sites

Hi Wim

Yes it crashes on several machines. I can not find a correlation to anything that is going on at the time of the crash, but its does crash pretty regular. Here is the FMP calling routine that i am using.

Public Sub CallFMPScript(theFile, theScript)

Dim fmDocs, fmDoc 'FMApp

On Error GoTo Error

' hook into FileMaker

Dim FMApp As FMPro70Lib.Application

Set FMApp = New FMPro70Lib.Application

FMApp.Visible = True

'script status of 2 = running, 1 = paused , 0 idle

If FMApp.ScriptStatus = 2 Then GoTo continue ' never interrupt when script is running

If FMApp.ScriptStatus = 1 And ScriptInterruptMode$ = "Not Allowed" Then GoTo continue 'if a script is running and not sup to interupt,do not interupt

' get the collection of open files

Set fmDocs = FMApp.Documents

' go find our target file

For Each fmDoc In fmDocs '***if collection is empty errors is trapped (cuz no docs open)

Debug.Print fmDoc.FullName

If InStr(LCase(fmDoc.FullName), LCase(theFile)) > 0 Then

' this is our file, run the script

fmDoc.DoFMScript (theScript)

GoTo continue ' Stop after 1st found file

End If

Next

Error: ' sometimes a error can ocure cuz wron fmp istalled and for some reason gets called

Call writeLog("***** Error calling FMP via ActiveX", True)

continue:

' clean up

Set fmDoc = Nothing

Set fmDocs = Nothing

Set FMApp = Nothing

End Sub

I think its pretty verbatum to the help files for the most part with the only addition of a check if the database is running a script at the time of the call. One thing odd that I did notice is that the script that is being called does actually start to run (I can tell because it sometimes starts to open a new window) just before it crashes.

Let me know what you think.

Charles

Edited by Guest
Link to comment
Share on other sites

I see nothing wrong with the code... If you step through the code, does the crash happen then too? And where exactly: right after executing the script?

Have you ruled out a problem with the script by having that script triggered by another FM file/script?

Link to comment
Share on other sites

  • 6 months later...

Try turning on the script debugger. Make sure that the FM Script "selects" the window (It needs the focus and if it is trying to open a window when it crashes...). You may also want to add a pause in your calling script and not destroy all the objects in your script before the FM script has run.

Link to comment
Share on other sites

  • 2 weeks later...

Well This problem still hasn't gone away, but here is my latest research findings:

- I have tried adding pauses and even single stepping through the VB calling program, the crash still occurs as soon as the script call is performed.

- Having the window focus does not make any difference

- I have creates a small test VB Application that can be used to test anyone's DDE (attached with source code)

- I created a test FMP database to recieve the DDE call

- When The FMP Database is opened and the DDE is called imediatly, Filemaker crashes.

- When the FMP Database is opened and the test script is run once from FMP , Subsiquent DDE calls do NOT cause crashing

- These tests are performed on version 8.5, when done on V9, the crash sometimes happens but FMP9 does not terminate, it just stops responding to DDE calls.

I think the problem lies with FMP but I would think more people would have run into this problem.

Any forther help or advice would be much appriciated.

Charles

dde_test.zip

Edited by Guest
Link to comment
Share on other sites

I will not even pretend to know why this is happing but I can tell you the following:

I tested this in FM_9 and FM_8.5v2 on Vista and could not get it to fail.

I tested this in FM_8.5v2 and FM_8.0v3 on XP and it failed exactly as you described.

I wrote the following VBS script and could not get it to fail

Set WshShell = WScript.CreateObject("WScript.Shell")

Set objFM = WScript.CreateObject ("FMPRO.Application")

    Set objFMfiles = objFM.Documents.Open("C:filepathDDETEST.fp7","admin","") 'open FM file

    objFM.Visible = True ' show FMPro

    objFMfiles.DoFMScript ("Test") ' call this FM script

WScript.DisconnectObject(objFM)

WScript.Quit(1)

So, what's differant between your's and mine?

1)I open the file before the script call, you connect to one. (sending a call to open a file that is already open will not hurt anything and will make it work even if the file is not open to start with.) Are you connecting to a served file or is it local? (if it's local just open the file directly before the script call, if it's served consider using a local file to trigger the script in the served one. Might break your error trapping for running scripts thou. )

2)I did not do any error traping. (I don't think this is the problem. NOTE: if the currently running script is paused it will not interrupt it, and will still be in the same state as it was before the external call)

Link to comment
Share on other sites

After giving this more thought, you might try the following: (assumes the problem is in the call to connect to the file, and that the file is served)

Create a file (will be local, if you need it at more than one workstation use the FileScriptingObject in your script to copy it from a fileserver on your network to a local path. Make Sure you create and open it with username/password that will open the served file with the right privleges) Create a script that Opens the remote file you are making a call to. (I would run this even if it is open.)

In your External script first call the new file (use the objFM.Documents.Open command to open it)and run the script to open the Served file.(even if it is open.) Then proceed as normal. (Not sure this will work but I suspect it will.)

The added bonus is that this will work even if file isn't open yet.

The Alternative is to make the local file trigger the script in the served file (which might break your error traping).

Let me know how this turns out,

Allen

Link to comment
Share on other sites

Ok,

I tried your code, well a VB version of it as follows, PErhaps VB vs. VBS is the difference here:

 Dim objFM As FMPro70Lib.Application

    Set objFM = CreateObject("FMPRO.Application")

    Set objFMfiles = objFM.Documents.Open("C:Documents and SettingsCharles Delfs.CHARLES-OFFICEDesktopDDETEST.fp7", "admin", "") 'open FM file

    objFM.Visible = True ' show FMPro

    objFMfiles.DoFMScript ("Test")  'call this FM script

and it still crashes on calling the script right after the file is already opened. I will keep experimenting ....

Charles

Also I should note one thing interesting: my test db creates a simple time stamped record when ActiveX calls the script. I noticed when FMP crashes, the record is created but the auto enter timestamp is not populated yet. When debug mode is on, the debug window starts to open and the crash also occures, this tell me that filemaker starts running normally after the call but some odd time based error happens and makes it crash, as if shortly after Activex Calls windows continues and in that process the crashing be being caused....

I THINK, the reason it does not crash if I run the script first is because the script gets cach'ed and thus runs faster when activex calls it, thus it is completed when this odd time delayed bug kicks in.

Edited by Guest
Typos
Link to comment
Share on other sites

This topic is 6051 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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