calling routines

Started by Christian Weilguny, June 18, 2010, 09:21:08 AM

Previous topic - Next topic

Christian Weilguny

Hi,

now I have a problem which probably belongs more to PowerBasic then to FireFly. Perhaps someone here can tell me a workaround:

I have to call the subroutines FireFly creates for opening forms automatted.
With other words, I fill a Menu (Treeview) with records from a database. There is the name of the form to open in a string-field. Now it's not difficult to build the name of the FireFly-routine, but I've not found any way to execute a command from a string. In VB there is "eval" and I can open a form by setting a string-parmeter to it's name.
Also I've no API-call found, that is helpful. "GetProcAddress" works only for exported functions in dll's.

Is someone here, who can help me with this issue?

christian

Rolf Brandt

You could maybe set up a little sub or function with a select case structure, for example:

Sub OpenForm(FormName as String)
   Local res as long

   Select Case FormName
      Case "FormXY"
         res = FORMXY_Show (HWND_FORM1, %FALSE)
      Case "FormYZ"
         res = FORMYZ_Show (HWND_FORM1, %FALSE)
      'etc.
      Case else
   End Select
End Sub
Rolf Brandt
http://www.rbsoft.eu
http://www.taxifreeware.com
I cook with wine, sometimes I even add it to the food.
(W. C. Fields)

Christian Weilguny

Hi Rolf,

yes, I thought about this remedy.
But then I have to distinguish between internal functions and functions from a dll.
Maybe there is a window (with it's calling function) in a dll and this is only referenced by a record in the database (this will use "late binding"). So I can add functionality "on the fly" without compiling the exe once more.

In VB I can solve this with a template-form and adding a custom control from an activeX-dll. But there is this the remedy. Becouse VB is not able to open a mdi-child from an activeX-dll.
I hoped, in PB with the "machine-oriented" working this is not necessary.

I am surprised, that the api has no solution for this (or it's difficult to find).

Christian

Rolf Brandt

Let's wait what solution Paul comes up with.
Rolf Brandt
http://www.rbsoft.eu
http://www.taxifreeware.com
I cook with wine, sometimes I even add it to the food.
(W. C. Fields)

Christian Weilguny

Ooops,

I've tried to make a form in a dll. Not possible to set it as "mdi-child".

             "This Form cannot be a mdi-child, becouse there is no MDIForm in this project."

This is the same restriction as in VB.

I think, I've to work with a template-mdi-child in the exe and placing functionality and controls with an activeX-control.

Christian