FireFly 3.62 and MLG.SLL

Started by Jean-pierre Leroy, September 16, 2013, 01:28:51 PM

Previous topic - Next topic

Jean-pierre Leroy

Hi Paul,

I would like to use the SLL version of My Little Grid with FireFly.

For that purpose I have added these two lines into FF_AppStart file right after the directive #COMPILE


#COMPILE Exe "//PROJECT_NAME//.exe"
%MLGSLL = 1
#LINK "MLG.SLL"


The project compiles without any problem and the executable is bigger, so I know that the MLG.SLL file has been taken into account.

If I remove MLG.DLL in the release directory I get this error message when I run the executable:

QuoteCould not LoadLibray 3rd party custom control: MLG.DLL

If I click Ok, the program runs just fine as all the MLG functions are included in MLG.SLL

I know I can edit the file CODEGEN_MyProject_MAIN.bas and remove manually these lines, and then compile again my project to remove this error message.


' Load any 3rd party custom controls that need to use LoadLibrary or perform an Initialization routine. (if applicable)
hLib = LoadLibrary("MLG.DLL")
If hLib = 0 Then MsgBox "Could not LoadLibrary 3rd party custom control: MLG.DLL", %MB_ICONWARNING, "FireFly Error"


What can you suggest in order to add more automation in this process ?

Thanks for your support,
Jean-Pierre

Paul Squires

If the MLG control is used in your program (ie. it had been added to a Form via the ToolBoc controls) then the code to load the DLL will always be code generated. In my application where I use the MLG SLL, I do not add the grid from the ToolBox - I simply create the control in code during the WM_CREATE process.

In order to eliminate the generation of the DLL loading code I would have to modify FireFly so that it allows the option to use either an SLL or a DLL at compile time. That new feature request is already in my bug tracker.

Thanks,

Paul
Paul Squires
PlanetSquires Software

Jean-pierre Leroy

Hi Paul,

Thanks for your reply regarding this question.

I can use this workaround to avoid the generation of the DDL loading code; but I love your "Visual Designer" and I prefer to adjust MLG control in terms of size and position visually.

Do you think the option to use either an SLL or a DLL at compile time could be available in the next FireFly update ?

Thanks,
Jean-Pierre

Paul Squires

Quote from: Jean-Pierre Leroy on September 28, 2013, 01:18:48 PM
Do you think the option to use either an SLL or a DLL at compile time could be available in the next FireFly update ?
Definitely. There needs to be 3 options: SLL, DLL, Source Code. I should have this implemented later today.
Paul Squires
PlanetSquires Software

David Warner

Quote from: TechSupport on September 28, 2013, 02:58:09 PM
I should have this implemented later today.
Well Paul, whatever it is you're doing to motivate yourself at the moment seems to be working very well indeed!  ;D

Paul Squires

hahahahaha!  Yeah, I do seem to pumping out a lot more code lately. Feels good actually.  :)
Paul Squires
PlanetSquires Software

Jim Dunn

Quote... I should have this implemented later today ...

Later today?!  WOW!!!
3.14159265358979323846264338327950
"Ok, yes... I like pie... um, I meant, pi."

Paul Squires

I have the change made but I am going to email it to Jean-Pierre to test in order to see if it actually works correctly.
Paul Squires
PlanetSquires Software

Jean-pierre Leroy

Thank you Paul. It works perfectly.

I sent you an email with more details.

Regards,
Jean-Pierre

Paul Squires

Thanks Jean-Pierre, email received. I will make that small change you suggested.
Paul Squires
PlanetSquires Software

Carl Oligny

The ability to use MLG with an SLL is a huge plus for me. One of my primary goals with FF & PB is to create a single executable with no DLL dependencies.

Pete Totushek

#11
I use the visual designer with MLG (SLL) now (FireFly v3.62).  Here is how I have been doing it...


  • Copy MLG.SLL & MLG.INC to your modules folder
  • Place MLG definitions in FF_AppStart something like this
        ' Place your user defined Declares, Constants, and #Include files below this line. FireFly will not
        ' parse any of your defined #Include files - it simply includes it in the final generated code.
        ' -------------------------------------------------------------------------------------------------
        %MLGSLL = 1
        #Link "..\modules\MLG.SLL"
        #INCLUDE "..\modules\MLG.INC"
  • In your form create a CustomControl (ie. customcontrol1)
  • In the CustomControl properties the class name has to be MYLITTLEGRID
  • In the CustomControl properties the caption has to be the column, row, etc. settings (ie. r50/c8/Z1)
  • Last thing you need to do is initialize it.  From the code view, click on the customcontrol (ie customcontrol1) and then the init and that will bring up 'Function FORM1_CUSTOMCONTROL1_INIT...'.  Here you need to add in  MLG_Init  so that it looks like this...
    Function FORM1_CUSTOMCONTROL1_INIT ( _
                                       ClassName   As Asciiz, _  ' windows class
                                       Caption     As Asciiz, _  ' window caption
                                       hWndParent  As Dword,  _  ' handle of parent window
                                       ExStyles    As Dword,  _  ' extended window styles
                                       Styles      As Dword,  _  ' standard window styles
                                       nLeft       As Dword,  _  ' left position of control
                                       nTop        As Dword,  _  ' top position of control
                                       nWidth      As Dword,  _  ' width of control
                                       nHeight     As Dword   _  ' height of control
                                       ) As Long
       ' If your custom control uses CreateWindowEx then use the template below, otherwise
       ' follow the instructions provided by the Custom Control's author. The Custom Control
       ' INIT function is called during the %WM_CREATE message for the Form on which the
       ' Custom Control is created.

       Local hWndControl As Dword
       
       'Must do this before creating the control (.dll does this automatically)
       MLG_Init   

       hWndControl = CreateWindowEx( ExStyles, _
                                     ClassName, _
                                     Caption, _
                                     Styles, _
                                     nLeft, nTop, nWidth, nHeight, _
                                     hWndParent, IDC_FORM1_CUSTOMCONTROL1, _
                                     GetModuleHandle( ByVal %Null ), _
                                     ByVal %Null )
                                     
       'Must do this to unlock the registered version of MLG (remove big X from Grid)
       'EDIT: (removed by Moderator)

       'It is important that this function return the Windows Handle to the newly created Control *** Do not delete this ***.
       Function = hWndControl

    End Function

That's it.  Now you have an MLG custom control in your form that you can re-size, move around, etc from the FireFly's visual designer  :)

-Pete
-Pete
www.totusoft.com -- Home of LAN Speed Test

Paul Squires

I think you would also have to edit the MLG.ctl file in the custom control folder and set the dll_required = 0. I think that is the line that triggers the LoadLibrary code generation and also the copying of the DLL to the release folder (if I remember correctly).
Paul Squires
PlanetSquires Software

Pete Totushek

I don't use the MLG.ctl file, I just use the generic customcontrol tool.  I don't need to include the .dll or even have it on my computer.  I only need MLG.SLL & MLG.INC when compiling.

-Pete
-Pete
www.totusoft.com -- Home of LAN Speed Test

Paul Squires

Ah, yes, right you are. I should have read your post more closely. :)   
Paul Squires
PlanetSquires Software