PlanetSquires Forums

Support Forums => General Board => Topic started by: Eros Olmi on December 29, 2014, 08:23:10 PM

Title: FF DLL Project: Form doesn't seem to close
Post by: Eros Olmi on December 29, 2014, 08:23:10 PM
Hope someone can help me.

I have a simple FF DLL project that contains a simple Form called frmMAIN.
DLL creation is OK.

In order to be able to show that form from a calling executable, I've create the following "ShowMyForm" function:
Function ShowMyForm Alias "ShowMyForm" (ByVal hwnd As Dword, ByVal sPath As String) Export As Long
  MsgBox "before: " & sPath
  FRMMAIN_SHOW (hwnd, %TRUE)
  MsgBox "after"
End Function


ShowMyForm function gets 2 params, show a MSGBOX before and after showing the the form.

All is working fine except that when I close the form, MsgBox "after" is never executed and my application never gets back control.
Control of the application seems remaining inside FRMMAIN_SHOW function.

If I call   FRMMAIN_SHOW (hwnd, %FALSE) it is even worst: control of the application immediately return from FRMMAIN_SHOW to the calling exe and frmMain remains hanged on screen.

What is the correct way to show a form in a FF DLL project?

Thanks a lot
Eros
Title: Re: FF DLL Project: Form doesn't seem to close
Post by: Elias Montoya on December 29, 2014, 11:01:08 PM
 First of, i would like to point out that firefly has a feature to make forms visible to external applications:

(https://www.planetsquires.com/protect/forum/index.php?action=dlattach;topic=3612.0;attach=1733;image)

  Second, depending on what your form does, the execution point can get stuck . There are several ways to
get your form stucked, like invoking a sendcommand from a Timer function to another form... weird.

So, try the exportation thing. The declarations are easy to find in the generated firefly source code, and can be
invoked as easy as:

Call FRMMAIN_SHOW(hWnd, %TRUE)

From your calling executable.
Title: Re: FF DLL Project: Form doesn't seem to close
Post by: Eros Olmi on December 30, 2014, 05:59:40 AM
Thanks a lot Elias, I didn't noticed that nice "Export" feature.

I'm using it right now, the form is showed correctly but the situation remain the same as before:

It seems FF form procedure remain running in some way.

I just need a way to show the form in modal way and after the form is closed the execution returns to the calling EXE.

Ciao
Eros
Title: Re: FF DLL Project: Form doesn't seem to close
Post by: Eros Olmi on December 30, 2014, 12:56:32 PM
UPDATE

Resolved the problem when calling not in MODAL way: frmMain_Show(0, %FALSE, 0)
I've added a message pump just after calling frmMain_Show(0, %FALSE, 0)

Still problems when calling in MODAL way: frmMain_Show(0, %TRUE, 0)
After I close the form, execution control does not return to calling exe.
Title: Re: FF DLL Project: Form doesn't seem to close
Post by: Eros Olmi on December 30, 2014, 01:01:44 PM
UPDATE

Resolved also MODAL way: in MODAL way it seems you have to specify a parent window handle.
If parent is 0 then it seems execution remain inside the DLL instead of being passed to calling EXE