Announcement

Collapse

Forum Guidelines

This forum is for finished source code that is working properly. If you have questions about this or any other source code, please post it in one of the Discussion Forums, not here.
See more
See less

Latest "Power AddOn" (Wizard) Open Source specs !

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Latest "Power AddOn" (Wizard) Open Source specs !

    Below is the latest source code for the Power AddOn specs :



    ------------------
    Chris Boss
    Computer Workshop
    Developer of "EZGUI"
    http://cwsof.com
    http://twitter.com/EZGUIProGuy

  • #2
    This is the Power AddOn include file used for the Wizards :

    This file should be named : pbadd10.inc

    Code:
    ' *************************************************************
    '                    Power AddOn Include File
    '                    Written by Christopher R. Boss
    '                    Sept. 2000
    '                    Public Domain - Royalty Free
    ' *************************************************************
    
    '        Declare for function in Main Source Code file
    DECLARE SUB PA_DisplayDialog(BYVAL hParent&)
    
    ' -------------------------------------------------------------
    
    GLOBAL PA_App_DLLInstance&
    GLOBAL PA_App_cbIDEproc AS DWORD
    
    ' -------------------------------------------------------------
    
    TYPE PADDINFO
        paVersion AS LONG           ' AddOn Version
        paName AS STRING*32         ' AddOn Name
        paDesc AS STRING*255        ' AddOn Description
    END TYPE
    
    TYPE PADDSTART
        pahParent AS LONG
        cbIDEproc AS DWORD     ' Code Pointer to IDE's callback procedure function
    END TYPE
    
    ' Note: Do not use this TYPE for GLOBAL or STATIC variables.
    '       It must be used only for LOCAL variables to avoid GPFs
    TYPE PADDIDE
        iMsg AS LONG                ' IDE Message (see Constants)
        iParam1 AS LONG             ' Parameter 1
        iParam2 AS LONG             ' Parameter 2
        iBuffer AS LONG             ' Pointer to Text Buffer
        iLen AS LONG                ' Length of Text in Buffer
    END TYPE
    
    
    ' -------------------------------------------------------------
    
    FUNCTION LibMain(BYVAL hInstance   AS LONG, _
                         BYVAL fwdReason   AS LONG, _
                         BYVAL lpvReserved AS LONG) EXPORT AS LONG
        SELECT CASE fwdReason
            CASE 1
                PA_App_DLLInstance&=hInstance
            CASE ELSE
        END SELECT
        LibMain=1
    END FUNCTION
    
    ' -------------------------------------------------------------
    
    ' *************************************************************
    '                    Power AddOn Entrance
    ' *************************************************************
    
    ' -------------------------------------------------------------
    
    FUNCTION PBAddOnInfo (MyInfo AS PADDINFO) EXPORT AS LONG
        LOCAL D$
        MyInfo.paVersion=%pa_Version
        MyInfo.paName=$pa_Name
        D$=$pa_Desc
        REPLACE "|" WITH CHR$(13)+CHR$(10) IN D$
        MyInfo.paDesc=D$
        FUNCTION=1
    END FUNCTION
    
    ' -------------------------------------------------------------
    
    FUNCTION PBAddOnStartup(MyStart AS PADDSTART) EXPORT AS LONG
        ' Test Code Pointer passed to make sure it is Valid
        IF IsBadCodePtr(MyStart.cbIDEproc)=0 THEN
            PA_App_cbIDEproc=MyStart.cbIDEproc
            PA_DisplayDialog MyStart.pahParent
            FUNCTION=1
        ELSE
            MSGBOX "Error: Cannot communicate with IDE"
            FUNCTION=0
        END IF
    END FUNCTION
    
    ' -------------------------------------------------------------
    
    ' IDE Messages for IDE Callback Procedure
    %IDE_SETRETURNTEXT          =   1       ' Set Generated Text Returned for current IDE TextBox
    %IDE_SETREPLACETEXT         =   2       ' Set Generated Text to Replace current Selected Text
    %IDE_FINDTEXT               =   3       ' Find Text in current IDE TextBox
    %IDE_DELETETEXT             =   4       ' Delete Text in current IDE TextBox
    %IDE_INSERTTEXT             =   5       ' Insert Text in current IDE TextBox
    %IDE_GETLENGTH              =   6       ' Get Length of text in current IDE TextBox
    
    ' Callback into IDE Prototypes
    DECLARE FUNCTION PA_IDEprocX(paMsg AS PADDIDE) AS LONG
    
    ' -------------------------------------------------------------
    
    FUNCTION PA_SetReturnText(BYVAL iText$) AS LONG
        LOCAL RV&
        LOCAL paMsg AS PADDIDE
        paMsg.iMsg=%IDE_SETRETURNTEXT
        paMsg.iBuffer=STRPTR(iText$)
        paMsg.iLen=LEN(iText$)
        CALL DWORD PA_App_cbIDEproc USING PA_IDEprocX(paMsg) TO RV&
        FUNCTION=RV&
    END FUNCTION
    
    ' -------------------------------------------------------------
    
    FUNCTION PA_SetReplaceText(BYVAL iText$) AS LONG
        LOCAL RV&
        LOCAL paMsg AS PADDIDE
        paMsg.iMsg=%IDE_SETREPLACETEXT
        paMsg.iBuffer=STRPTR(iText$)
        paMsg.iLen=LEN(iText$)
        CALL DWORD PA_App_cbIDEproc USING PA_IDEprocX(paMsg) TO RV&
        FUNCTION=RV&
    END FUNCTION
    
    ' -------------------------------------------------------------
    
    FUNCTION PA_FindText(BYVAL iPos&, BYVAL iText$, BYVAL iFlag& ) AS LONG
        LOCAL RV&
        LOCAL paMsg AS PADDIDE
        paMsg.iMsg=%IDE_FINDTEXT
        paMsg.iParam1=iPos&             ' Parameter 1 is starting Position
        paMsg.iParam2=iFlag&            ' Parameter 2 is Flag (1 = Match Case)
        paMsg.iBuffer=STRPTR(iText$)
        paMsg.iLen=LEN(iText$)
        CALL DWORD PA_App_cbIDEproc USING PA_IDEprocX(paMsg) TO RV&
        FUNCTION=RV&    ' Returns Position of text
    END FUNCTION
    
    ' -------------------------------------------------------------
    
    FUNCTION PA_DeleteText(BYVAL iPos&, BYVAL iLen&) AS LONG
        LOCAL RV&
        LOCAL paMsg AS PADDIDE
        paMsg.iMsg=%IDE_DELETETEXT
        paMsg.iParam1=iPos&            ' Parameter 1 is starting Position
        paMsg.iParam2=iLen&            ' Parameter 2 is Len of Text to Delete
        CALL DWORD PA_App_cbIDEproc USING PA_IDEprocX(paMsg) TO RV&
        FUNCTION=RV&
    END FUNCTION
    
    ' -------------------------------------------------------------
    
    FUNCTION PA_InsertText(BYVAL iPos&, BYVAL iText$) AS LONG
        LOCAL RV&
        LOCAL paMsg AS PADDIDE
        paMsg.iMsg=%IDE_INSERTTEXT
        paMsg.iParam1=iPos&             ' Parameter 1 is starting Position
        paMsg.iBuffer=STRPTR(iText$)
        paMsg.iLen=LEN(iText$)
        CALL DWORD PA_App_cbIDEproc USING PA_IDEprocX(paMsg) TO RV&
        FUNCTION=RV&
    END FUNCTION
    
    ' -------------------------------------------------------------
    
    FUNCTION PA_GetLength() AS LONG
        LOCAL RV&
        LOCAL paMsg AS PADDIDE
        paMsg.iMsg=%IDE_GETLENGTH
        CALL DWORD PA_App_cbIDEproc USING PA_IDEprocX(paMsg) TO RV&
        FUNCTION=RV&        ' returns length of current IDE textbox
    END FUNCTION
    
    ' -------------------------------------------------------------

    [This message has been edited by Chris Boss (edited September 20, 2000).]
    Chris Boss
    Computer Workshop
    Developer of "EZGUI"
    http://cwsof.com
    http://twitter.com/EZGUIProGuy

    Comment


    • #3
      This is the include file for use in your IDE, if you want your
      IDE to support "Power AddOns" !

      This file should be named : pbide10.inc

      Code:
      ' *************************************************************
      '                    Power AddOn Include File for IDEs
      '                    Written by Christopher R. Boss
      '                    Sept. 2000
      '                    Public Domain - Royalty Free
      ' *************************************************************
      
      %PA_VER         =   100         ' accept only Version 1.00 or greater AddOns
      
      TYPE PADDINFO
          paVersion AS LONG           ' AddOn Version
          paName AS STRING*32         ' AddOn Name
          paDesc AS STRING*255        ' AddOn Description
      END TYPE
      
      TYPE PADDSTART
          pahParent AS LONG
          cbIDEproc AS DWORD     ' Code Pointer to IDE's callback procedure function
      END TYPE
      
      
      ' -------------------------------------------------------------
      
      DECLARE FUNCTION PBAddOnInfoX (MyInfo AS PADDINFO) AS LONG
      DECLARE FUNCTION PBAddOnStartup(MyStart AS PADDSTART) AS LONG
      
      ' *************************************************************
      
      
      ' *************************************************************
      '           Functions to find and to load a Power AddOn
      ' *************************************************************
      
      SUB PA_FindAddOns(BYVAL AddOnPath$, AddOnName$(), AddOnDLL$(), AddOnDesc$())
      LOCAL N&, DFlag&, PA AS ASCIIZ * 255, D$
      LOCAL DA AS DWORD, DI&, RV&, MaxN&
      LOCAL MyInfo AS PADDINFO
      DFlag&=0
      MaxN&=UBOUND(AddOnName$)
      N&=UBOUND(AddOnDLL$)
      IF N&<MaxN& THEN MaxN&=N&
      N&=UBOUND(AddOnDesc$)
      IF N&<MaxN& THEN MaxN&=N&
      N&=0
      IF AddOnPath$<>"" THEN
          IF RIGHT$(AddOnPath$,1)<>"\" THEN AddOnPath$=AddOnPath$+"\"
      END IF
      DO
          IF N&>=MaxN& THEN EXIT DO
          IF DFlag&=0 THEN
              D$=DIR$(AddOnPath$+"*.dll")
              DFlag&=1
          ELSE
              D$=DIR$
          END IF
          IF D$="" THEN EXIT DO
          PA=D$+CHR$(0)
          DI&=LoadLibrary(PA)
          IF DI&<>0 THEN
              DA=GetProcAddress(DI&, "PBADDONINFO")
              IF DA<>0 THEN
                  CALL DWORD DA USING PBAddOnInfoX (MyInfo) TO RV&
                  IF MyInfo.paVersion>=%PA_VER THEN
                      N&=N&+1
                      AddOnName$(N&)=RTRIM$(MyInfo.paName)
                      AddOnDLL$(N&)=D$
                      AddOnDesc$(N&)=RTRIM$(MyInfo.paDesc)
                  END IF
              END IF
              FreeLibrary DI&
          END IF
      LOOP
      END SUB
      
      ' ------------------------------------------------
      
      SUB PA_RunAddOn(BYVAL hParent&, BYVAL AddOnDLL$)
      LOCAL D$, PA AS ASCIIZ * 255
      LOCAL DI&, DA AS DWORD, RV&
      LOCAL MyStart AS PADDSTART
      PA=AddOnDLL$+CHR$(0)
      DI&=LoadLibrary(PA)
      IF DI&<>0 THEN
          DA=GetProcAddress(DI&, "PBADDONSTARTUP")
          IF DA<>0 THEN
              MyStart.pahParent=hParent&
              MyStart.cbIDEproc=CODEPTR(PA_IDEproc)
              CALL DWORD DA USING PBAddOnStartup(MyStart) TO RV&
          END IF
          FreeLibrary DI&
      END IF
      END SUB
      
      ' ------------------------------------------------

      [This message has been edited by Chris Boss (edited September 20, 2000).]
      Chris Boss
      Computer Workshop
      Developer of "EZGUI"
      http://cwsof.com
      http://twitter.com/EZGUIProGuy

      Comment


      • #4
        This include file is a "template" for adding the IDE functions
        needed to support the Power Addons. The Power AddOns will make
        calls back into your IDE using these functions, so they can
        modify code directly in your IDE, by making "requests" to the IDE
        to modify the source code in its text editor.

        This file should be named : pbcus10.inc

        Code:
        ' *************************************************************
        '               Custom IDE functions needed by AddOns
        '                Power AddOn Include File for IDEs
        '                 Written by Christopher R. Boss
        '                 Sept. 2000
        '                 Public Domain - Royalty Free
        '
        '   To use, make a copy of this include file with another
        '   name and then add your own code to the Custom functions.
        '   Include the copy in your IDE application.
        ' *************************************************************
        
        
        ' *************************************************************
        '           Add your own code to the IDE callback procedure
        '           The AddOns will make calls to this function
        '           to modify the code in your IDE.
        ' *************************************************************
        
        ' Note: Do not use this TYPE for GLOBAL or STATIC variables.
        '       It must be used only for LOCAL variables.
        
        TYPE PADDIDE
            iMsg AS LONG                ' IDE Message (see Constants)
            iParam1 AS LONG             ' Parameter 1
            iParam2 AS LONG             ' Parameter 2
            iBuffer AS LONG             ' Pointer to Text Buffer
            iLen AS LONG                ' Length of Text in Buffer
        END TYPE
        
        ' IDE Messages for IDE Callback Procedure
        %IDE_SETRETURNTEXT          =   1       ' Set Generated Text Returned for current IDE TextBox
        %IDE_SETREPLACETEXT         =   2       ' Set Generated Text to Replace current Selected Text
        %IDE_FINDTEXT               =   3       ' Find Text in current IDE TextBox
        %IDE_DELETETEXT             =   4       ' Delete Text in current IDE TextBox
        %IDE_INSERTTEXT             =   5       ' Insert Text in current IDE TextBox
        %IDE_GETLENGTH              =   6       ' Get Length of text in current IDE TextBox
        
        FUNCTION PA_IDEproc (paMsg AS PADDIDE) EXPORT AS LONG
        LOCAL RV&
        SELECT CASE paMsg.iMsg
            CASE %IDE_SETRETURNTEXT
                ' paMsg.iBuffer contains pointer to Text buffer
                ' paMsg.iLen contains the length of text in buffer
                RV&=0       ' If Message processed return a True value
                CASE %IDE_SETREPLACETEXT
                ' paMsg.iBuffer contains pointer to Text buffer
                ' paMsg.iLen contains the length of text in buffer
                RV&=0       ' If Message processed return a True value
            CASE %IDE_FINDTEXT
                ' paMsg.iParam1 contains the starting position for search
                ' paMsg.iParam2 contains a Flag. If Flag=1 the Match Case
                ' paMsg.iBuffer contains pointer to Text buffer
                ' paMsg.iLen contains the length of text in buffer
                RV&=0       ' Return starting position where text is found in RV&
            CASE %IDE_DELETETEXT
                ' paMsg.iParam1 contains the starting position for Delete
                ' paMsg.iParam2 contains the number of characters to delete
                RV&=0       ' If Message processed return a True value
            CASE %IDE_INSERTTEXT
                ' paMsg.iParam1 contains the starting position for Insertion
                ' paMsg.iBuffer contains pointer to Text buffer
                ' paMsg.iLen contains the length of text in buffer
                RV&=0       ' If Message processed return a True value
            CASE %IDE_GETLENGTH
                RV&=0       ' Return Length of text in RV&
            CASE ELSE
        END SELECT
        FUNCTION=RV&
        END FUNCTION


        [This message has been edited by Chris Boss (edited September 20, 2000).]
        Chris Boss
        Computer Workshop
        Developer of "EZGUI"
        http://cwsof.com
        http://twitter.com/EZGUIProGuy

        Comment


        • #5
          Here is an explanation about the Custom functions your IDE must supply:

          The Wizards (AddOns) need to be able to "modify" the source code in whatever
          text control your IDE uses. They also need to be able to search the text in your IDE.
          The functions names cannot be changed in your IDE, but you do supply the core code in these functions.

          FUNCTION PA_FindText(BYVAL iPos&, BYVAL iText$, BYVAL iFlag& ) AS LONG

          This function requests the IDE to return the character position of the word passed in iText$.
          iPos& is where to start the search. This is similiar to the Basic command INSTR
          iFlag& has no meaning yet !


          FUNCTION PA_DeleteText(BYVAL iPos&, BYVAL iLen&) AS LONG

          This function requests the IDE to Delete some text starting at the char position iPos& and iLen& number of characters.

          FUNCTION PA_InsertText(BYVAL iPos&, BYVAL iText$) AS LONG

          This function requests the IDE to Insert some text, passed in iText$ starting at position iPos& .

          FUNCTION PA_GetLength() AS LONG

          This function requests the IDE to return a value with the number (len) of characters in the text control of the IDE.

          FUNCTION PA_ReplaceText(BYVAL iText$) AS LONG

          This function requests the IDE to Replace the text of the currently selected text with the text passed in iText$, after the AddOn (Wizard) is finished and it returns control back to the IDE.

          FUNCTION PA_ReturnText(BYVAL iText$) AS LONG

          This function requests the IDE to save the text passed in iText$ to do with it whatever it pleases (example the IDE may allow Pasting the text).

          I may add other IDE functions if needed.



          ------------------
          Chris Boss
          Computer Workshop
          Developer of "EZGUI"
          http://cwsof.com
          http://twitter.com/EZGUIProGuy

          Comment


          • #6
            Here is a sample AddOn. There is no actual guts to the program.
            It just demonstrates how the interface works for an AddOn.

            Save the file as : pbadd1.bas

            Code:
            ' *************************************************************
            '       Code Generated by EZGUI Freeware Dialog Designer
            ' *************************************************************
            
            
            #COMPILE DLL
            #REGISTER NONE
            #DIM ALL          '  This is helpful to prevent errors in coding
            
            
            #INCLUDE "win32api.inc"   ' Must come first before other include files !
            
            ' -------------------------------------------------------------
            %pa_Version     =   100
            $pa_Name        =   "MyWizard"
            $pa_Desc        =   "This is a description of my Wizard.|Second line."
            #INCLUDE "pbadd10.inc"
            ' -------------------------------------------------------------
            
                              ' Available PowerAddOn functions in IDE
                              ' X&=PA_FindText(iPos&, iText$, iFlag&)
                              ' X&=PA_DeleteText(iPos&, iLen&)
                              ' X&=PA_InsertText(iPos&, iText$)
                              ' X&=PA_GetLength()
                              ' X&=PA_ReplaceText(iText$)
                              ' X&=PA_ReturnText(iText$)
            
            ' -------------------------------------------------------------
            
            
            ' *************************************************************
            
            
            ' *************************************************************
            '              EZGUI Library Constants and Declares
            ' *************************************************************
            
            DECLARE SUB EZLIB_InitFonts()
            DECLARE SUB EZLIB_DeleteFonts()
            DECLARE SUB EZLIB_FixSize(BYVAL hDlg&, BYVAL Style&, BYVAL HasMenu&)
            DECLARE SUB EZLIB_DefColors()
            DECLARE SUB EZLIB_DeleteBrushes()
            DECLARE FUNCTION EZLIB_QBColor(N&) AS LONG
            
            ' *************************************************************
            '              Application Constants and Declares
            ' *************************************************************
            
            %PBADDON1_FRAME1             = 100
            %PBADDON1_LABEL2             = 105
            %PBADDON1_LABEL1             = 110
            %PBADDON1_REPLACETEXT        = 115
            %PBADDON1_WITHTEXT           = 120
            %PBADDON1_APPLYBUTTON        = 1
            %PBADDON1_CANCELBUTTON       = 125
            ' --------------------------------------------------
            DECLARE SUB ShowDialog_PBAddOn1(BYVAL hParent&)
            DECLARE CALLBACK FUNCTION PBAddOn1_DLGPROC
            ' --------------------------------------------------
            ' ------------------------------------------------
            
            DECLARE CALLBACK FUNCTION CBF_PBADDON1_REPLACETEXT()
            DECLARE CALLBACK FUNCTION CBF_PBADDON1_WITHTEXT()
            DECLARE CALLBACK FUNCTION CBF_PBADDON1_APPLYBUTTON()
            DECLARE CALLBACK FUNCTION CBF_PBADDON1_CANCELBUTTON()
            
            
            ' (1) Put NEXT DIALOG Constant and Declare code after here :
            
            
            ' *************************************************************
            '            Application Global Variables and Types
            ' *************************************************************
            
            GLOBAL App_Brush&()
            GLOBAL App_Color&()
            GLOBAL App_Font&()
            
            
            GLOBAL hPBAddOn1&    ' Dialog handle
            
            ' (2) Put NEXT DIALOG Globals code after here :
            
            
            ' (2) NEXT DIALOG  -  Put Globals after here :
            
            
            SUB PA_DisplayDialog(BYVAL hParent&)
            EZLIB_DefColors
            EZLIB_InitFonts
            ShowDialog_PBAddOn1 hParent&
            EZLIB_DeleteBrushes
            EZLIB_DeleteFonts
            END SUB
            
            ' *************************************************************
            '                    Application Dialogs
            ' *************************************************************
            
            SUB ShowDialog_PBAddOn1(BYVAL hParent&)
                LOCAL Style&, ExStyle&
                LOCAL N&, CT&        '  Variables used for Reading Data in Arrays for Listbox and Combobox
                '   hParent& = 0 if no parent Dialog
                Style& = %WS_POPUP OR %DS_MODALFRAME OR %WS_CAPTION OR %DS_CENTER
                ExStyle& = 0
                DIALOG NEW hParent&, "Power-AddOn Example", 0, 0,  267,  108, Style&, ExStyle& TO hPBAddOn1&
                EZLIB_FixSize hPBAddOn1&, Style&, 0
                ' Layer # 0
                CONTROL ADD FRAME, hPBAddOn1&,  %PBADDON1_FRAME1,  "Replace Text", 3, 2, 259, 101, _
                    %WS_CHILD OR %WS_VISIBLE OR %BS_GROUPBOX, _
                    %WS_EX_TRANSPARENT
                CONTROL SEND hPBAddOn1&,  %PBADDON1_FRAME1, %WM_SETFONT, App_Font&(0), %TRUE
                CONTROL ADD LABEL, hPBAddOn1&,  %PBADDON1_LABEL2,  "With :", 11, 42, 56, 12, _
                    %WS_CHILD OR %WS_VISIBLE OR %SS_CENTER OR %WS_BORDER
                CONTROL SEND hPBAddOn1&,  %PBADDON1_LABEL2, %WM_SETFONT, App_Font&(0), %TRUE
                CONTROL ADD LABEL, hPBAddOn1&,  %PBADDON1_LABEL1,  "Replace :", 11, 20, 56, 12, _
                    %WS_CHILD OR %WS_VISIBLE OR %SS_CENTER OR %WS_BORDER
                CONTROL SEND hPBAddOn1&,  %PBADDON1_LABEL1, %WM_SETFONT, App_Font&(0), %TRUE
                CONTROL ADD TEXTBOX, hPBAddOn1&,  %PBADDON1_REPLACETEXT,  "", 69, 20, 176, 12, _
                    %WS_CHILD OR %WS_VISIBLE OR %ES_AUTOHSCROLL OR %WS_TABSTOP, _
                    %WS_EX_CLIENTEDGE CALL CBF_PBADDON1_REPLACETEXT
                CONTROL ADD TEXTBOX, hPBAddOn1&,  %PBADDON1_WITHTEXT,  "", 69, 42, 176, 12, _
                    %WS_CHILD OR %WS_VISIBLE OR %ES_AUTOHSCROLL OR %WS_TABSTOP, _
                    %WS_EX_CLIENTEDGE CALL CBF_PBADDON1_WITHTEXT
                CONTROL ADD "Button", hPBAddOn1&,  %PBADDON1_APPLYBUTTON,  "Apply", 141, 69, 104, 25, _
                    %WS_CHILD OR %WS_VISIBLE OR %BS_DEFPUSHBUTTON OR %WS_TABSTOP CALL CBF_PBADDON1_APPLYBUTTON
                CONTROL SEND hPBAddOn1&,  %PBADDON1_APPLYBUTTON, %WM_SETFONT, App_Font&(0), %TRUE
                CONTROL ADD "Button", hPBAddOn1&,  %PBADDON1_CANCELBUTTON,  "Cancel", 16, 76, 80, 17, _
                    %WS_CHILD OR %WS_VISIBLE OR %BS_PUSHBUTTON OR %WS_TABSTOP CALL CBF_PBADDON1_CANCELBUTTON
                DIALOG SHOW MODAL hPBAddOn1& , CALL PBAddOn1_DLGPROC
            END SUB
            
            ' *************************************************************
            '                             Dialog Callback Procedure
            '                             for Form PBAddOn1
            '                             uses Global Handle - hPBAddOn1&
            ' *************************************************************
            
            CALLBACK FUNCTION PBAddOn1_DLGPROC
                SELECT CASE CBMSG
                    ' Common Windows Messages you may want to process
                    ' -----------------------------------------------
                    CASE %WM_TIMER
                    CASE %WM_HSCROLL
                    CASE %WM_VSCROLL
                    CASE %WM_SIZE
                    CASE %WM_CLOSE
                    CASE %WM_DESTROY
                    CASE %WM_SYSCOMMAND
                    CASE %WM_PAINT
                    ' -----------------------------------------------
                    CASE %WM_CTLCOLORMSGBOX , %WM_CTLCOLORBTN, %WM_CTLCOLOREDIT,_
                         %WM_CTLCOLORSTATIC, %WM_CTLCOLORSCROLLBAR, %WM_CTLCOLORLISTBOX
                        ' Control colors
                        SELECT CASE GetDlgCtrlID(CBLPARAM)
                            CASE  %PBADDON1_LABEL2
                                SetTextColor CBWPARAM, App_Color&( 15)
                                SetBkColor   CBWPARAM, App_Color&( 2)
                                FUNCTION=App_Brush&( 2)
                            CASE  %PBADDON1_LABEL1
                                SetTextColor CBWPARAM, App_Color&( 15)
                                SetBkColor   CBWPARAM, App_Color&( 1)
                                FUNCTION=App_Brush&( 1)
                            CASE ELSE
                                FUNCTION=0
                        END SELECT
                    CASE %WM_COMMAND
                        ' Process Messages to Controls that have no Callback Function
                        ' and Process Messages to Menu Items
                        SELECT CASE CBCTL
                            CASE ELSE
                        END SELECT
                    CASE ELSE
                END SELECT
            END FUNCTION
            
            
            ' (3) Put NEXT DIALOG Creation / Dialog Procedure code after here :
            
            
            ' *************************************************************
            '              EZGUI Freeware Dialog Designer Library
            '
            '                   see web site at EZGUI.COM
            '
            ' Copyright (C) 2000, Christopher R. Boss , All Rights Reserved !
            '
            ' This code was Generated by the EZGUI Freeware Dialog Designer
            ' and may be used ROYALTY FREE, as long as this Copyright notice
            ' is kept with the source code.
            ' The Author also gives you the right to post this code on a
            ' web site and to distribute it to others.
            ' *************************************************************
            
            SUB EZLIB_InitFonts()
                REDIM App_Font(0 TO 5)
                App_Font(0)=GetStockObject(%SYSTEM_FONT)
                App_Font(1)=GetStockObject(%SYSTEM_FIXED_FONT)
                App_Font(2)=GetStockObject(%ANSI_VAR_FONT)
                App_Font(3)=GetStockObject(%ANSI_FIXED_FONT)
                App_Font(4)=GetStockObject(%DEFAULT_GUI_FONT)    ' MS Sans Serif
                App_Font(5)=GetStockObject(%OEM_FIXED_FONT)      ' Terminal Font
                END SUB
            
            ' -------------------------------------------------------------
            
            SUB EZLIB_DeleteFonts()
                LOCAL N&
                ' Fonts 0 to 5 do not need to be deleted
                FOR N&=6 TO UBOUND(App_Font)
                    IF App_Font(N&)<>0 THEN DeleteObject App_Font(N&)
                NEXT N&
                END SUB
            
            ' -------------------------------------------------------------
            
            SUB EZLIB_FixSize(BYVAL hDlg&, BYVAL Style&, BYVAL HasMenu&)
                LOCAL X&, Y&, W&, H&, XX&, YY&
                DIALOG GET SIZE hDlg& TO X&, Y&
                IF (Style& AND %WS_CAPTION) = %WS_CAPTION THEN
                    IF HasMenu& THEN
                        H&=H&+GetSystemMetrics(%SM_CYCAPTION)
                    END IF
                END IF
                IF (Style& AND %WS_HSCROLL) = %WS_HSCROLL THEN
                    H&=H&+GetSystemMetrics(%SM_CYHSCROLL)
                END IF
                IF (Style& AND %WS_VSCROLL) = %WS_VSCROLL THEN
                    W&=W&+GetSystemMetrics(%SM_CYVSCROLL)
                END IF
                DIALOG PIXELS hDlg&, W&, H& TO UNITS XX&, YY&
                X&=X&+XX&
                Y&=Y&+YY&
                DIALOG SET SIZE hDlg&, X&, Y&
            END SUB
            
            ' -------------------------------------------------------------
            
            SUB EZLIB_DefColors()
                LOCAL T&
                REDIM App_Brush&(0 TO 31)
                REDIM App_Color&(0 TO 31)
                FOR T&=0 TO 31
                    App_Brush&(T&)=CreateSolidBrush(EZLIB_QBColor(T&))
                    App_Color&(T&)=EZLIB_QBColor(T&)
                NEXT T&
            END SUB
            
            ' -------------------------------------------------------------
            
            SUB EZLIB_DeleteBrushes()
                LOCAL T&
                FOR T&=0 TO 31
                    DeleteObject App_Brush&(T&)
                NEXT T&
            END SUB
            
            ' -------------------------------------------------------------
            
            FUNCTION EZLIB_QBColor(N&) AS LONG
                LOCAL RV&
                SELECT CASE N&
                    CASE 0
                    RV&=RGB(0,0,0)       ' Black
                CASE 1
                    RV&=RGB(0,0,128)     ' Blue
                CASE 2
                    RV&=RGB(0,128,0)     ' Green
                CASE 3
                    RV&=RGB(0,128,128)   ' Cyan
                CASE 4
                    RV&=RGB(196,0,0)     ' Red
                CASE 5
                    RV&=RGB(128,0,128)   ' Magenta (Purple)
                CASE 6
                    RV&=RGB(128,64,0)    ' Brown
                CASE 7
                    RV&=RGB(196,196,196) ' White
                CASE 8
                    RV&=RGB(128,128,128) ' Gray
                CASE 9
                    RV&=RGB(0,0, 255)    ' Lt. Blue
                CASE 10
                    RV&=RGB(0,255,0)     ' Lt. Green
                CASE 11
                    RV&=RGB(0,255,255)   ' Lt. Cyan
                CASE 12
                    RV&=RGB(255,0,0)     ' Lt. Red
                CASE 13
                    RV&=RGB(255,0,255)   ' Lt. magenta (Purple)
                CASE 14
                    RV&=RGB(255,255,0)   ' Yellow
                CASE 15
                    RV&=RGB(255,255,255) ' Bright White
                CASE 16   ' - Extended QB colors Pastel version -
                    RV&=RGB(164,164,164)
                CASE 17
                    RV&=RGB(128,160,255)
                CASE 18
                    RV&=RGB(160,255,160)
                CASE 19
                    RV&=RGB(160,255,255)
                CASE 20
                    RV&=RGB(255,160,160)
                CASE 21
                    RV&=RGB(255,160,255)
                CASE 22
                    RV&=RGB(255,255,160)
                CASE 23
                    RV&=RGB(212,212,212)
                CASE 24
                    RV&=RGB(180,180,180)
                CASE 25
                    RV&=RGB(188,220,255)
                CASE 26
                    RV&= RGB(220,255,220)
                CASE 27
                    RV&=RGB(220,255,255)
                CASE 28
                    RV&=RGB(255,220,220)
                CASE 29
                    RV&=RGB(255,220,255)
                CASE 30
                    RV&=RGB(255,255,220)
                CASE 31
                    RV&=RGB(228,228,228)
                CASE ELSE
                    RV&=RGB(0,0,0)
                END SELECT
                FUNCTION=RV&
            END FUNCTION
             ' -------------------------------------------------------------
            
            
            ' *************************************************************
            '             End of EZGUI Dynamic Dialogs Library
            ' *************************************************************
            
            
            ' *************************************************************
            '  Application Callback Functions (or Procedures) for Controls
            ' *************************************************************
            
            ' ------------------------------------------------
            CALLBACK FUNCTION CBF_PBADDON1_REPLACETEXT
                IF CBCTLMSG=%EN_CHANGE THEN
            
                END IF
            END FUNCTION
            ' ------------------------------------------------
            
            ' ------------------------------------------------
            CALLBACK FUNCTION CBF_PBADDON1_WITHTEXT
                IF CBCTLMSG=%EN_CHANGE THEN
            
                END IF
            END FUNCTION
            ' ------------------------------------------------
            
            ' ------------------------------------------------
            CALLBACK FUNCTION CBF_PBADDON1_APPLYBUTTON
                IF CBCTLMSG=%BN_CLICKED THEN
                    PA_GetLength    ' call back into main EXE (IDE) and display a messagebox
                END IF
            END FUNCTION
            ' ------------------------------------------------
            
            ' ------------------------------------------------
            CALLBACK FUNCTION CBF_PBADDON1_CANCELBUTTON
                IF CBCTLMSG=%BN_CLICKED THEN
                    DIALOG END hPBAddOn1&
                END IF
            END FUNCTION
            ' ------------------------------------------------
            
            ' (4) Put NEXT DIALOG Callback / Subs code after here :
            
            ' *************************************************************
            '                     Put Your Code Here
            ' *************************************************************



            [This message has been edited by Chris Boss (edited September 20, 2000).]
            Chris Boss
            Computer Workshop
            Developer of "EZGUI"
            http://cwsof.com
            http://twitter.com/EZGUIProGuy

            Comment


            • #7
              Here is a sample host application (IDE) which demonstrates
              finding and loading a Power AddOn.

              Save the file as : edit1.bas

              Code:
              ' *************************************************************
              '       Code Generated by EZGUI Freeware Dialog Designer
              ' *************************************************************
              
              #COMPILE EXE
              #REGISTER NONE
              #DIM ALL          '  This is helpful to prevent errors in coding
              
              
               ' Remark out the Constants for Controls you Will use in your program !
              
               %NOANIMATE    = 1
               %NOBUTTON     = 1
               %NOCOMBO      = 1
               %NODRAGLIST   = 1
               %NOHEADER     = 1
               %NOIMAGELIST  = 1
               %NOLIST       = 1
               '    %NOLISTVIEW   = 1
               '    %NOSTATUSBAR  = 1
               '    %NOTABCONTROL = 1
               '    %NOTOOLBAR    = 1
               '    %NOTOOLTIPS   = 1
               %NOTRACKBAR   = 1
               '    %NOTREEVIEW   = 1
               '    %NOUPDOWN     = 1
              #INCLUDE "win32api.inc"   ' Must come first before other include files !
              #INCLUDE "commctrl.inc"  ' The Common Controls include file !
              
              ' *************************************************************
              ' -------------------------------------------------------------
              #INCLUDE "pbide10.inc"      ' Power AddOn IDE INC file
              ' -------------------------------------------------------------
              ' *************************************************************
              
              ' *************************************************************
              '              EZGUI Library Constants and Declares
              ' *************************************************************
              
              DECLARE SUB EZLIB_InitFonts()
              DECLARE SUB EZLIB_DeleteFonts()
              DECLARE SUB EZLIB_FixSize(BYVAL hDlg&, BYVAL Style&, BYVAL HasMenu&)
              DECLARE FUNCTION EZLIB_IsTooltip(BYVAL lParam AS LONG) AS LONG
              DECLARE FUNCTION EZLIB_TooltipID(BYVAL lParam AS LONG) AS LONG
              DECLARE SUB EZLIB_SetTooltipText(BYVAL lParam AS LONG, TipText$)
              DECLARE FUNCTION EZLIB_IsTab(BYVAL lParam AS LONG) AS LONG
              DECLARE FUNCTION EZLIB_TabID(BYVAL lParam AS LONG) AS LONG
              DECLARE FUNCTION EZLIB_TabNum(BYVAL lParam AS LONG) AS LONG
              DECLARE SUB EZLIB_AddTabs(BYVAL hDlg AS LONG, BYVAL IDNum&, BYVAL TabText$)
              DECLARE SUB EZLIB_DefColors()
              DECLARE SUB EZLIB_DeleteBrushes()
              DECLARE FUNCTION EZLIB_QBColor(N&) AS LONG
              DECLARE SUB EZLIB_ShowControl(BYVAL hWnd&, BYVAL ID&, BYVAL SFlag&)
              
              ' *************************************************************
              '              Application Constants and Declares
              ' *************************************************************
              
              
              ' ----------------------------------------------------------
              %Form1_FILE                                     = 500
              ' ----------------------------------------------------------
              %Form1_EXIT                                     = 505
              
              ' ----------------------------------------------------------
              %Form1_ADDONS                                   = 600
              ' ----------------------------------------------------------
              %Form1_BLANK1                                   = 605
              %FORM1_TEXT1              = 100
              ' --------------------------------------------------
              DECLARE SUB ShowDialog_Form1(BYVAL hParent&)
              DECLARE CALLBACK FUNCTION Form1_DLGPROC
              ' --------------------------------------------------
              ' ------------------------------------------------
              
              DECLARE SUB Form1_EXIT_Select()
              DECLARE SUB Form1_BLANK1_Select(BYVAL N&)
              DECLARE CALLBACK FUNCTION CBF_FORM1_TEXT1()
              
              ' *************************************************************
              ' -------------------------------------------------------------
              DECLARE SUB LoadAddOns()
              ' -------------------------------------------------------------
              ' *************************************************************
              
              ' (1) Put NEXT DIALOG Constant and Declare code after here :
              
              
              ' *************************************************************
              '            Application Global Variables and Types
              ' *************************************************************
              
              GLOBAL App_Brush&()
              GLOBAL App_Color&()
              GLOBAL App_Font&()
              
              
              GLOBAL App_AddOnName$()
              GLOBAL App_AddOnDLL$()
              GLOBAL App_AddOnDesc$()
              GLOBAL App_Text$
              
              
              GLOBAL hForm1&    ' Dialog handle
              ' Global Handles for menus
              GLOBAL hForm1_Menu0&
              GLOBAL hForm1_Menu1&
              GLOBAL hForm1_Menu2&
              
              
              ' (2) Put NEXT DIALOG Globals code after here :
              
              
              ' (2) NEXT DIALOG  -  Put Globals after here :
              
              
              ' *************************************************************
              '      Application Entrance (can be replaced with PBMAIN)
              ' *************************************************************
              
              FUNCTION WINMAIN (BYVAL hCurInstance  AS LONG, _
                                BYVAL hPrevInstance AS LONG, _
                                lpszCmdLine         AS ASCIIZ PTR, _
                                BYVAL nCmdShow      AS LONG) EXPORT AS LONG
                  LOCAL Count&
                  LOCAL CC1 AS INIT_COMMON_CONTROLSEX
              
                  CC1.dwSize=SIZEOF(CC1)
                  CC1.dwICC=%ICC_WIN95_CLASSES
                  InitCommonControlsEX CC1
                  EZLIB_DefColors
                  EZLIB_InitFonts
                  LoadAddOns
                  ShowDialog_Form1 0
                  DO
                      DIALOG DOEVENTS TO Count&
                  LOOP UNTIL Count&=0
              
              
                  EZLIB_DeleteBrushes
                  EZLIB_DeleteFonts
              END FUNCTION
              ' -------------------------------------------------------------
              
              ' *************************************************************
              ' -------------------------------------------------------------
              SUB LoadAddOns()
              REDIM App_AddOnName$(1 TO 30)
              REDIM App_AddOnDLL$(1 TO 30)
              REDIM App_AddOnDesc$(1 TO 30)
              PA_FindAddOns "", App_AddOnName$(), App_AddOnDLL$(), App_AddOnDesc$()
              END SUB
              ' -------------------------------------------------------------
              #INCLUDE "mycus.inc"      ' Power AddOn INC file for Custom IDE AddOn functions
              ' -------------------------------------------------------------
              ' *************************************************************
              
              
              ' *************************************************************
              '                    Application Dialogs
              ' *************************************************************
              
              SUB ShowDialog_Form1(BYVAL hParent&)
                  LOCAL Style&, ExStyle&
                  LOCAL N&, CT&        '  Variables used for Reading Data in Arrays for Listbox and Combobox
                  '   hParent& = 0 if no parent Dialog
                  Style& = %WS_POPUP OR %DS_MODALFRAME OR %WS_CAPTION OR %WS_MINIMIZEBOX OR %WS_SYSMENU OR %DS_CENTER
                  ExStyle& = 0
                  DIALOG NEW hParent&, "Your Dialog", 0, 0,  331,  217, Style&, ExStyle& TO hForm1&
                  EZLIB_FixSize hForm1&, Style&, 1
                  ' ---------------------------
                  MENU NEW BAR TO hForm1_Menu0&
                  ' ---------------------------
                  MENU NEW POPUP TO hForm1_Menu1&
                  MENU ADD POPUP, hForm1_Menu0& ,"&File", hForm1_Menu1&, %MF_ENABLED
                  ' - - - - - - - - - - - - - -
                  MENU ADD STRING, hForm1_Menu1&, "E&xit",  %Form1_EXIT, %MF_ENABLED
                  MENU NEW POPUP TO hForm1_Menu2&
                  MENU ADD POPUP, hForm1_Menu0& ,"&AddOns", hForm1_Menu2&, %MF_ENABLED
                  ' - - - - - - - - - - - - - -
                  FOR N&=1 TO 30
                          IF App_AddOnDLL$(N&)<>"" THEN
                              MENU ADD STRING, hForm1_Menu2&, App_AddOnName$(N&),  %Form1_BLANK1+N&, %MF_ENABLED
                          END IF
                  NEXT N&
                  MENU ATTACH hForm1_Menu0&, hForm1&
                  ' Layer # 0
                  CONTROL ADD TEXTBOX, hForm1&,  %FORM1_TEXT1,  "", 3, 2, 325, 212, _
                      %WS_CHILD OR %WS_VISIBLE OR %ES_MULTILINE OR %ES_WANTRETURN OR %ES_LEFT OR %ES_AUTOVSCROLL OR %WS_VSCROLL OR %ES_AUTOHSCROLL OR %WS_HSCROLL OR %WS_TABSTOP, _
                      %WS_EX_CLIENTEDGE CALL CBF_FORM1_TEXT1
                  App_Text$=""
                  FOR N&=1 TO 100
                      App_Text$=App_Text$+"FOR X&=1 to"+STR$(N&)+CHR$(13)+CHR$(10)
                      App_Text$=App_Text$+"    Y&=Y&+X&"+CHR$(13)+CHR$(10)
                      App_Text$=App_Text$+"NEXT X&"+CHR$(13)+CHR$(10)
                      App_Text$=App_Text$+CHR$(13)+CHR$(10)
                      App_Text$=App_Text$+"' ----------------------------"+CHR$(13)+CHR$(10)
                      App_Text$=App_Text$+CHR$(13)+CHR$(10)
                  NEXT N&
                  App_Text$=App_Text$+CHR$(0)
              
                  CONTROL SEND hForm1&, %FORM1_TEXT1, %WM_SETFONT, App_Font(1), 1
                  CONTROL SEND hForm1&, %FORM1_TEXT1, %WM_SETTEXT, 0, STRPTR(App_Text$)
                  DIALOG SHOW MODELESS hForm1& , CALL Form1_DLGPROC
              END SUB
              
              ' *************************************************************
              '                             Dialog Callback Procedure
              '                             for Form Form1
              '                             uses Global Handle - hForm1&
              ' *************************************************************
              
              CALLBACK FUNCTION Form1_DLGPROC
                  SELECT CASE CBMSG
                      ' Common Windows Messages you may want to process
                      ' -----------------------------------------------
                      CASE %WM_TIMER
                      CASE %WM_HSCROLL
                      CASE %WM_VSCROLL
                      CASE %WM_SIZE
                      CASE %WM_CLOSE
                      CASE %WM_DESTROY
                      CASE %WM_SYSCOMMAND
                      CASE %WM_PAINT
                      ' -----------------------------------------------
                      CASE %WM_CTLCOLORMSGBOX , %WM_CTLCOLORBTN, %WM_CTLCOLOREDIT,_
                           %WM_CTLCOLORSTATIC, %WM_CTLCOLORSCROLLBAR, %WM_CTLCOLORLISTBOX
                          ' Control colors
                          SELECT CASE GetDlgCtrlID(CBLPARAM)
                              CASE ELSE
                                  FUNCTION=0
                          END SELECT
                      CASE %WM_COMMAND
                          ' Process Messages to Controls that have no Callback Function
                          ' and Process Messages to Menu Items
                          SELECT CASE CBCTL
                              CASE  %Form1_EXIT                                         ' Popup Menu Item Selected
                                  Form1_EXIT_Select
                              CASE  %Form1_BLANK1+1 TO %Form1_BLANK1+30
                                  Form1_BLANK1_Select CBCTL-%Form1_BLANK1
                              CASE ELSE
                          END SELECT
                      CASE ELSE
                  END SELECT
              END FUNCTION
              
              
              ' (3) Put NEXT DIALOG Creation / Dialog Procedure code after here :
              
              
              ' *************************************************************
              '              EZGUI Freeware Dialog Designer Library
              '
              '                   see web site at EZGUI.COM
              '
              ' Copyright (C) 2000, Christopher R. Boss , All Rights Reserved !
              '
              ' This code was Generated by the EZGUI Freeware Dialog Designer
              ' and may be used ROYALTY FREE, as long as this Copyright notice
              ' is kept with the source code.
              ' The Author also gives you the right to post this code on a
              ' web site and to distribute it to others.
              ' *************************************************************
              
              SUB EZLIB_InitFonts()
                  REDIM App_Font(0 TO 5)
                  App_Font(0)=GetStockObject(%SYSTEM_FONT)
                  App_Font(1)=GetStockObject(%SYSTEM_FIXED_FONT)
                  App_Font(2)=GetStockObject(%ANSI_VAR_FONT)
                  App_Font(3)=GetStockObject(%ANSI_FIXED_FONT)
                  App_Font(4)=GetStockObject(%DEFAULT_GUI_FONT)    ' MS Sans Serif
                  App_Font(5)=GetStockObject(%OEM_FIXED_FONT)      ' Terminal Font
                  END SUB
              
              ' -------------------------------------------------------------
              
              SUB EZLIB_DeleteFonts()
                  LOCAL N&
                  ' Fonts 0 to 5 do not need to be deleted
                  FOR N&=6 TO UBOUND(App_Font)
                      IF App_Font(N&)<>0 THEN DeleteObject App_Font(N&)
                  NEXT N&
                  END SUB
              
              ' -------------------------------------------------------------
              
              SUB EZLIB_FixSize(BYVAL hDlg&, BYVAL Style&, BYVAL HasMenu&)
                  LOCAL X&, Y&, W&, H&, XX&, YY&
                  DIALOG GET SIZE hDlg& TO X&, Y&
                  IF (Style& AND %WS_CAPTION) = %WS_CAPTION THEN
                      IF HasMenu& THEN
                          H&=H&+GetSystemMetrics(%SM_CYCAPTION)
                      END IF
                  END IF
                  IF (Style& AND %WS_HSCROLL) = %WS_HSCROLL THEN
                      H&=H&+GetSystemMetrics(%SM_CYHSCROLL)
                  END IF
                  IF (Style& AND %WS_VSCROLL) = %WS_VSCROLL THEN
                      W&=W&+GetSystemMetrics(%SM_CYVSCROLL)
                  END IF
                  DIALOG PIXELS hDlg&, W&, H& TO UNITS XX&, YY&
                  X&=X&+XX&
                  Y&=Y&+YY&
                  DIALOG SET SIZE hDlg&, X&, Y&
              END SUB
              
              ' -------------------------------------------------------------
              
              FUNCTION EZLIB_IsTooltip(BYVAL lParam AS LONG) AS LONG
                  LOCAL pNM AS NMHDR PTR
                  pNM=lParam
                  IF @pNM.code=%TTN_NEEDTEXT THEN FUNCTION=1 ELSE FUNCTION=0
              END FUNCTION
              
              ' -------------------------------------------------------------
              
              FUNCTION EZLIB_TooltipID(BYVAL lParam AS LONG) AS LONG
                  LOCAL pNM AS NMHDR PTR, pTT AS TOOLTIPTEXT PTR
                  LOCAL IDNum&, UF&
                  IDNum&=0
                  pNM=lParam
                  IF @pNM.code=%TTN_NEEDTEXT THEN
                      ' Check for Tooltip message
                      pTT=lParam
                      UF&[email protected] AND %TTF_IDISHWND
                      IF UF&=%TTF_IDISHWND THEN
                          IDNum&=GetDlgCtrlID(@pTT.hdr.idfrom)
                      ELSE
                          IDNum&[email protected]
                      END IF
                  END IF
                  FUNCTION=IDNum&
              END FUNCTION
              
              ' -------------------------------------------------------------
              
              SUB EZLIB_SetTooltipText(BYVAL lParam AS LONG, TipText$)
                  LOCAL pNM AS NMHDR PTR, pTT AS TOOLTIPTEXT PTR
                  pNM=lParam
                  IF @pNM.code=%TTN_NEEDTEXT THEN
                      ' Check for Tooltip message
                      pTT=lParam
                      IF TipText$<>"" THEN
                          @pTT.szText=LEFT$(TipText$, 79)+CHR$(0)
                      END IF
                  END IF
              END SUB
              
              ' -------------------------------------------------------------
              
              FUNCTION EZLIB_IsTab(BYVAL lParam AS LONG) AS LONG
                  LOCAL pNM AS NMHDR PTR
                  pNM=lParam
                  IF @pNM.code=%TCN_SELCHANGE THEN FUNCTION=1 ELSE FUNCTION=0
              END FUNCTION
              
              ' -------------------------------------------------------------
              
              FUNCTION EZLIB_TabID(BYVAL lParam AS LONG) AS LONG
                  LOCAL pNM AS NMHDR PTR
                  LOCAL IDNum&
                  pNM=lParam
                  IF @pNM.code=%TCN_SELCHANGE THEN
                      IDNum&[email protected]
                  END IF
                  FUNCTION=IDNum&
              END FUNCTION
              
              ' -------------------------------------------------------------
              
              FUNCTION EZLIB_TabNum(BYVAL lParam AS LONG) AS LONG
                  LOCAL RV&, pNM AS NMHDR PTR
                  LOCAL hCtrl AS LONG
                  pNM=lParam
                  IF @pNM.code=%TCN_SELCHANGE THEN
                  [email protected]
                      RV&=SendMessage(hCtrl, %TCM_GETCURSEL, 0, 0)+1
                  END IF
                  FUNCTION=RV&
              END FUNCTION
              
              ' -------------------------------------------------------------
              
              SUB EZLIB_AddTabs(BYVAL hDlg AS LONG, BYVAL IDNum&, BYVAL TabText$)
                  LOCAL pItem AS TC_ITEM, hCtrl&
                  LOCAL zText AS ASCIIZ*80
                  LOCAL D$, P&, TB&
                  IF IDNum&<>0 THEN
                      hCtrl&=GetDlgItem(hDlg,IDNum&)
                      IF hCtrl&<>0 THEN
                          TB&=0
                          DO
                              IF TabText$="" THEN EXIT DO
                              P&=INSTR(TabText$,"|")
                              IF P&>0 THEN
                                  D$=LEFT$(TabText$,P&-1)
                                  TabText$=MID$(TabText$,P&+1)
                              ELSE
                                  D$=TabText$
                                  IF TabText$="" THEN EXIT DO
                                  TabText$=""
                              END IF
                              pItem.Mask=%TCIF_TEXT
                              zText=D$+CHR$(0)
                              pItem.pszText=VARPTR(zText)
                              SendMessage hCtrl&, %TCM_INSERTITEM, TB&, VARPTR(pItem)
                              TB&=TB&+1
                          LOOP
                      END IF
                  END IF
              END SUB
              
              ' -------------------------------------------------------------
              
              SUB EZLIB_DefColors()
                  LOCAL T&
                  REDIM App_Brush&(0 TO 31)
                  REDIM App_Color&(0 TO 31)
                  FOR T&=0 TO 31
                      App_Brush&(T&)=CreateSolidBrush(EZLIB_QBColor(T&))
                      App_Color&(T&)=EZLIB_QBColor(T&)
                  NEXT T&
              END SUB
              
              ' -------------------------------------------------------------
              
              SUB EZLIB_DeleteBrushes()
                  LOCAL T&
                  FOR T&=0 TO 31
                      DeleteObject App_Brush&(T&)
                  NEXT T&
              END SUB
              
              ' -------------------------------------------------------------
              
              FUNCTION EZLIB_QBColor(N&) AS LONG
                  LOCAL RV&
                  SELECT CASE N&
                      CASE 0
                      RV&=RGB(0,0,0)       ' Black
                  CASE 1
                      RV&=RGB(0,0,128)     ' Blue
                  CASE 2
                      RV&=RGB(0,128,0)     ' Green
                  CASE 3
                      RV&=RGB(0,128,128)   ' Cyan
                  CASE 4
                      RV&=RGB(196,0,0)     ' Red
                  CASE 5
                      RV&=RGB(128,0,128)   ' Magenta (Purple)
                  CASE 6
                      RV&=RGB(128,64,0)    ' Brown
                  CASE 7
                      RV&=RGB(196,196,196) ' White
                  CASE 8
                      RV&=RGB(128,128,128) ' Gray
                  CASE 9
                      RV&=RGB(0,0, 255)    ' Lt. Blue
                  CASE 10
                      RV&=RGB(0,255,0)     ' Lt. Green
                  CASE 11
                      RV&=RGB(0,255,255)   ' Lt. Cyan
                  CASE 12
                      RV&=RGB(255,0,0)     ' Lt. Red
                  CASE 13
                      RV&=RGB(255,0,255)   ' Lt. magenta (Purple)
                  CASE 14
                      RV&=RGB(255,255,0)   ' Yellow
                  CASE 15
                      RV&=RGB(255,255,255) ' Bright White
                  CASE 16   ' - Extended QB colors Pastel version -
                      RV&=RGB(164,164,164)
                  CASE 17
                      RV&=RGB(128,160,255)
                  CASE 18
                      RV&=RGB(160,255,160)
                  CASE 19
                      RV&=RGB(160,255,255)
                  CASE 20
                      RV&=RGB(255,160,160)
                  CASE 21
                      RV&=RGB(255,160,255)
                  CASE 22
                      RV&=RGB(255,255,160)
                  CASE 23
                      RV&=RGB(212,212,212)
                  CASE 24
                      RV&=RGB(180,180,180)
                  CASE 25
                      RV&=RGB(188,220,255)
                  CASE 26
                      RV&= RGB(220,255,220)
                  CASE 27
                      RV&=RGB(220,255,255)
                  CASE 28
                      RV&=RGB(255,220,220)
                  CASE 29
                      RV&=RGB(255,220,255)
                  CASE 30
                      RV&=RGB(255,255,220)
                  CASE 31
                      RV&=RGB(228,228,228)
                  CASE ELSE
                      RV&=RGB(0,0,0)
                  END SELECT
                  FUNCTION=RV&
              END FUNCTION
               ' -------------------------------------------------------------
              SUB EZLIB_ShowControl(BYVAL hWnd&, BYVAL ID&, BYVAL SFlag&)
                  LOCAL hCtrl&
                  IF IsWindow(hWnd&) THEN
                      IF ID&<>0 THEN
                          hCtrl&=GetDlgItem(hWnd&,ID&)
                          IF SFlag&=0 THEN
                              ShowWindow hCtrl&, %SW_HIDE
                          ELSE
                              ShowWindow hCtrl&, %SW_SHOW
                          END IF
                      END IF
                  END IF
              END SUB
               ' -------------------------------------------------------------
              ' *************************************************************
              '             End of EZGUI Dynamic Dialogs Library
              ' *************************************************************
              
              
              ' *************************************************************
              '  Application Callback Functions (or Procedures) for Controls
              ' *************************************************************
              
              ' ------------------------------------------------
              SUB Form1_EXIT_Select()
              DIALOG END hForm1&
              END SUB
              ' ------------------------------------------------
              
              ' ------------------------------------------------
              
              SUB Form1_BLANK1_Select(BYVAL N&)
              LOCAL D$
              D$=App_AddOnDLL$(N&)+CHR$(0)
              
              ' *************************************************************
              ' -------------------------------------------------------------
              ' PA_RunAddOn  hParent&, AddOnDLL$
              PA_RunAddOn hForm1&,  D$
              ' -------------------------------------------------------------
              ' *************************************************************
              
              END SUB
              
              ' ------------------------------------------------
              
              ' ------------------------------------------------
              CALLBACK FUNCTION CBF_FORM1_TEXT1
                  IF CBCTLMSG=%EN_CHANGE THEN
              
                  END IF
                  IF CBCTLMSG=%EN_SETFOCUS THEN
              
                  END IF
                  IF CBCTLMSG=%EN_KILLFOCUS THEN
              
                  END IF
              END FUNCTION
              ' ------------------------------------------------
              
              ' (4) Put NEXT DIALOG Callback / Subs code after here :
              
              ' *************************************************************
              '                     Put Your Code Here
              ' *************************************************************


              [This message has been edited by Chris Boss (edited September 20, 2000).]
              Chris Boss
              Computer Workshop
              Developer of "EZGUI"
              http://cwsof.com
              http://twitter.com/EZGUIProGuy

              Comment


              • #8
                Here is a sample of a copy of the Template include file for use
                with the IDE.

                Save this file as : mycus.inc

                Code:
                ' *************************************************************
                '               Custom IDE functions needed by AddOns
                '                Power AddOn Include File for IDEs
                '                 Written by Christopher R. Boss
                '                 Sept. 2000
                '                 Public Domain - Royalty Free
                '
                '   To use, make a copy of this include file with another
                '   name and then add your own code to the Custom functions.
                '   Include the copy in your IDE application.
                ' *************************************************************
                
                
                ' *************************************************************
                '           Add your own code to these functions
                '           The AddOns will make calls to these functions
                '           to modify the code in your IDE.
                ' *************************************************************
                
                ' Note: Do not use this TYPE for GLOBAL or STATIC variables.
                '       It must be used only for LOCAL variables to avoid GPFs
                
                TYPE PADDIDE
                    iMsg AS LONG                ' IDE Message (see Constants)
                    iParam1 AS LONG             ' Parameter 1
                    iParam2 AS LONG             ' Parameter 2
                    iBuffer AS LONG             ' Pointer to Text Buffer
                    iLen AS LONG                ' Length of Text in Buffer
                END TYPE
                
                ' IDE Messages for IDE Callback Procedure
                %IDE_SETRETURNTEXT          =   1       ' Set Generated Text Returned for current IDE TextBox
                %IDE_SETREPLACETEXT         =   2       ' Set Generated Text to Replace current Selected Text
                %IDE_FINDTEXT               =   3       ' Find Text in current IDE TextBox
                %IDE_DELETETEXT             =   4       ' Delete Text in current IDE TextBox
                %IDE_INSERTTEXT             =   5       ' Insert Text in current IDE TextBox
                %IDE_GETLENGTH              =   6       ' Get Length of text in current IDE TextBox
                
                FUNCTION PA_IDEproc (paMsg AS PADDIDE) EXPORT AS LONG
                LOCAL RV&
                SELECT CASE paMsg.iMsg
                    CASE %IDE_SETRETURNTEXT
                        ' paMsg.iBuffer contains pointer to Text buffer
                        ' paMsg.iLen contains the length of text in buffer
                        RV&=0       ' If Message processed return a True value
                        CASE %IDE_SETREPLACETEXT
                        ' paMsg.iBuffer contains pointer to Text buffer
                        ' paMsg.iLen contains the length of text in buffer
                        RV&=0       ' If Message processed return a True value
                    CASE %IDE_FINDTEXT
                        ' paMsg.iParam1 contains the starting position for search
                        ' paMsg.iParam2 contains a Flag. If Flag=1 the Match Case
                        ' paMsg.iBuffer contains pointer to Text buffer
                        ' paMsg.iLen contains the length of text in buffer
                         ' CONTROL SEND hForm1&, %FORM1_TEXT1, %WM_SETFONT, App_Font(1), 1
                         ' CONTROL SEND hForm1&, %FORM1_TEXT1, %WM_SETTEXT, 0, STRPTR(App_Text$)
                
                
                        RV&=0       ' Return starting position where text is found in RV&
                    CASE %IDE_DELETETEXT
                        ' paMsg.iParam1 contains the starting position for Delete
                        ' paMsg.iParam2 contains the number of characters to delete
                        RV&=0       ' If Message processed return a True value
                    CASE %IDE_INSERTTEXT
                        ' paMsg.iParam1 contains the starting position for Insertion
                        ' paMsg.iBuffer contains pointer to Text buffer
                        ' paMsg.iLen contains the length of text in buffer
                        RV&=0       ' If Message processed return a True value
                    CASE %IDE_GETLENGTH
                        ' **************************************************************
                        ' this is test code:
                        MSGBOX "You clicked on the Apply Button in the Wizard !" _
                               +CHR$(13)+CHR$(10)+CHR$(13)+CHR$(10) _
                               +"The AddON made a Callback which generated this message"
                        ' **************************************************************
                        RV&=0       ' Return Length of text in RV&
                    CASE ELSE
                END SELECT
                FUNCTION=RV&
                END FUNCTION

                There is only a small amount of custom code added. Just a simple
                messagebox to demonstrate how the callback works in an AddOn.



                [This message has been edited by Chris Boss (edited September 20, 2000).]
                Chris Boss
                Computer Workshop
                Developer of "EZGUI"
                http://cwsof.com
                http://twitter.com/EZGUIProGuy

                Comment


                • #9
                  The code above is all new !

                  I totally rewrote the specs for the AddOns and how the IDE
                  processes requests made by the AddOn.

                  The code is much cleaner now and easier to work with and it allows
                  for expansion of the AddOn specs more easily than before.

                  There is a single entrance into the IDE now, using a single callback.

                  Kev Peel made some good suggestions which are incorporated into
                  the new specs.


                  ------------------
                  Chris Boss
                  Computer Workshop
                  Developer of "EZGUI"
                  http://cwsof.com
                  http://twitter.com/EZGUIProGuy

                  Comment

                  Working...
                  X