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

Html WYSIWYG editor

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

  • Html WYSIWYG editor

    ========== 1st CHUNK ===============
    Code:
    'PBHtmlEdit - WYSIWYG HTML EDITOR based on MS DHTML.OCX
    '======================================================
    'I needed to incorporate an HTML editor into a PB Mail application. After 
    'unsuccessful searches through these forums looking for anything to start from
    'I decided to do it myself out of a MS VB example and some code found in these
    'PB forums. This is a partial result. Many thanks to José Roca, Borje Hagsten
    'among others
    '---------------------------------------------------------------------------------
    'Found a problem trying to retrieve (enumerate) the html formatting names
    'through the command %DECMD_GETBLOCKFMTNAMES (see comments). Formatting is applied
    'using format name strings. Worked around by setting the menu options with the
    'fixed known names for the Formats (the correct would be to enumerate them
    'from the object due to locale issues). Perhaps José may want to help us on this  
    '---------------------------------------------------------------------------------
    'Another minor workaround in LoadDocument and SaveDocument methods (see comments)
    'These methods don't recognize the second parameter to prompt user - always = 0 (?)
    '---------------------------------------------------------------------------------
    'I removed the table insertion operations because the Active-X control doesn't seem
    'to show appropriate cursors for table manipulation: insert/delete cols, rows,
    'cells etc. I just commented out the code and if someone wants to try, just remove
    'them and adjust the menu options constants enumeration.
    '---------------------------------------------------------------------------------
    'Hope it may be of worth to someone here - Modify and use at your own risk
    '---------------------------------------------------------------------------------
    'Author: Heber Jorge da Silva, 03/24/2005
    '=================================================================================
    
    'For a short while you may download it here:  http://www.gasinf.com.br/gros/pbhtmledit.zip  (50K)
    
    
    #Compile Exe
    #Dim All
    
    ' Include files
    #Include "win32api.inc"
    #Include "commctrl.inc"
    #Include "comdlg32.inc"
    #Resource "pbhtmled.pbr"
    
    '++#Include "dprint.inc"
    
    'template for initctls 
    Declare Function InitiCommonControlsEx(iccex As INIT_COMMON_CONTROLSEX) As Long
    
    Macro InitComCtls(icc)
     MacroTemp   iccex
     MacroTemp   hLib
     MacroTemp   pProc
     Dim iccex   As INIT_COMMON_CONTROLSEX
     Dim hLib    As Dword
     Dim pProc   As Dword
     hLib = LoadLibrary("COMCTL32.DLL")
     If hLib Then
      pProc = GetProcAddress(hLib, "InitCommonControlsEx")
      If pProc Then
       iccex.dwSize    = SizeOf(iccex)
       iccex.dwICC     = icc
       Call Dword pProc Using InitiCommonControlsEx(iccex)
      Else
       InitCommonControls
      End If
      FreeLibrary hLib
     End If
    End Macro
    
    
    'ImageList draw style constants.
    %IMG_DIS = 0   ' Disabled
    %IMG_NOR = 1   ' Normal
    %IMG_HOT = 2   ' Selected
    
    'Sometimes, the text ovewrites the accel+erator key name or goes too close. In these cases,
    'we need to add an extra width to the text to separe them.
    %OMENU_EXTRAWIDTH  = 60   'Extra width in pixels
    %OMENU_CHECKEDICON = 58   'Identifier of the checked icon
    
    Global hOcx As Dword
    Global oOcx As Dispatch
    
    Global hMenu As Dword, hStatus As Dword
    Global hMenuTextBkBrush As Dword, hMenuHiBrush As Dword      'backgnd texto menu
    Global hImlHot As Dword, hImlDis As Dword, hImlNor As Dword  'imglist para os menus
    Global hTabMain As Dword, ImageListTab As Dword, hToolbarMain As Dword, hToolBarEdit As Dword
    Global hTab() As Dword
    Global MakeAbsString As String 'menu title that changes dynamically (make absolute in position menu)
    Global HtmlIsDirty As Long     'flag - edited html directly
    
    'Initial declares - eliminate unnecessary macros in COMMCTRL.INC
    %NOANIMATE         = 1 ' Animate control
    %NOBUTTON          = 1 ' Button
    %NOCOMBO           = 1 ' Combo box
    %NOCOMBOEX         = 1 ' ComboBoxEx
    %NODATETIMEPICK    = 1 ' Date/time picker
    %NODRAGLIST        = 1 ' Drag list control
    %NOEDIT            = 1 ' Edit control
    %NOFLATSBAPIS      = 1 ' Flat scroll bar
    %NOHEADER          = 1 ' Header control
    %NOHOTKEY          = 1 ' HotKey control
    %NOIMAGELIST       = 1 ' Image APIs
    %NOIPADDRESS       = 1 ' IP Address edit control
    %NOLIST            = 1 ' List box control
    %NOLISTVIEW        = 1 ' ListView control
    %NOMENUHELP        = 1 ' Menu help
    %NOMONTHCAL        = 1 ' MonthCal
    %NOMUI             = 1 ' MUI
    %NONATIVEFONTCTL   = 1 ' Native Font control
    %NOPAGESCROLLER    = 1 ' Pager
    %NOPROGRESS        = 1 ' Progress control
    '%NOREBAR           = 1  ' Rebar control
    %NOSTATUSBAR       = 1 ' Status bar
    %NOTABCONTROL      = 1 ' Tab control
    '%NOTOOLBAR        = 1  ' Tool bar
    '%NOTOOLTIPS       = 1  ' Tool tips
    %NOTRACKBAR        = 1 ' Track bar
    %NOTRACKMOUSEEVENT = 1 ' Track Mouse Event
    %NOTREEVIEW        = 1 ' TreeView
    %NOUPDOWN          = 1 ' Up Down arrow control
    
    'bitmaps tbmain
    %IDB_NORMAL        = 100
    %IDB_HOT           = 101
    'bitmaps tb16
    %IDB_MNOR          = 102
    %IDB_MHOT          = 103
    %IDB_MDIS          = 104
    
    
    'edit toolbar buttons
    %IDC_BOLD          = 200
    %IDC_ITALIC        = 201
    %IDC_UNDERLINE     = 202
    %IDC_TXTBACKCOLOR  = 203
    'sep
    %IDC_INDENT        = 204
    %IDC_OUTDENT       = 205
    %IDC_ORDERLIST     = 206
    %IDC_UNORDERLIST   = 207
    'sep
    %IDC_JUSTIFYLEFT   = 208
    %IDC_JUSTIFYCENTER = 209
    %IDC_JUSTIFYRIGHT  = 210
    'sep
    %IDC_UNDO          = 211
    %IDC_REDO          = 212
    'sep
    %IDC_IMAGE         = 213
    %IDC_LINE          = 214
    %IDC_HYPERLINK     = 215
    %IDC_UNLINK        = 216
    'sep
    %IDC_COPY          = 217
    %IDC_CUT           = 218
    %IDC_PASTE         = 219
    
    'menus
    %IDM_NEW           = %WM_USER + 2048
    %IDM_OPEN          = %IDM_NEW + 1
    %IDM_SAVE          = %IDM_OPEN + 1
    %IDM_SAVEAS        = %IDM_SAVE + 1
    %IDM_PRINT         = %IDM_SAVEAS + 1
    %IDM_EXIT          = %IDM_PRINT  + 1
                       
    %IDM_FIND          = %IDM_EXIT  + 1
    %IDM_UNDO          = %IDM_FIND + 1
    %IDM_REDO          = %IDM_UNDO + 1
    %IDM_COPY          = %IDM_REDO + 1
    %IDM_CUT           = %IDM_COPY + 1
    %IDM_PASTE         = %IDM_CUT + 1
    %IDM_TEXTFORECOLOR = %IDM_PASTE + 1
    %IDM_TEXTBACKCOLOR = %IDM_TEXTFORECOLOR + 1
    %IDM_BACKCOLOR     = %IDM_TEXTBACKCOLOR + 1
    %IDM_BACKSOUND     = %IDM_BACKCOLOR + 1
    %IDM_BACKIMAGE     = %IDM_BACKSOUND + 1
    %IDM_SELALL        = %IDM_BACKIMAGE + 1
                       
    %IDM_IMAGE         = %IDM_SELALL + 1
    %IDM_HTML          = %IDM_IMAGE + 1
    %IDM_LINE          = %IDM_HTML + 1
    %IDM_HYPERLINK     = %IDM_LINE + 1
                       
    '%IDM_TABLE         = %IDM_HYPERLINK + 1
    '%IDM_TABINSLINE    = %IDM_TABLE + 1
    '%IDM_TABINSCOL     = %IDM_TABINSLINE + 1
    '%IDM_TABINSCELL    = %IDM_TABINSCOL + 1
    '%IDM_TABREMLINE    = %IDM_TABINSCELL + 1
    '%IDM_TABREMCOL     = %IDM_TABREMLINE + 1
    '%IDM_TABREMCELL    = %IDM_TABREMCOL + 1
    '%IDM_TABJOINCELLS  = %IDM_TABREMCELL + 1
    '%IDM_TABDIVCELLS   = %IDM_TABJOINCELLS + 1
    '
    %IDM_NORMAL        = %IDM_HYPERLINK + 1 '%IDM_TABDIVCELLS + 1
    %IDM_FORMATTED     = %IDM_NORMAL + 1
    %IDM_ADDRESS       = %IDM_FORMATTED + 1
    %IDM_TIT1          = %IDM_ADDRESS + 1
    %IDM_TIT2          = %IDM_TIT1 + 1
    %IDM_TIT3          = %IDM_TIT2 + 1
    %IDM_TIT4          = %IDM_TIT3 + 1
    %IDM_TIT5          = %IDM_TIT4 + 1
    %IDM_TIT6          = %IDM_TIT5 + 1
    %IDM_ORDERLIST     = %IDM_TIT6 + 1
    %IDM_UNORDERLIST   = %IDM_ORDERLIST + 1
    %IDM_DIRLIST       = %IDM_UNORDERLIST + 1
    %IDM_MENULIST      = %IDM_DIRLIST + 1
    %IDM_DEFTERM       = %IDM_MENULIST + 1
    %IDM_DEFINITION    = %IDM_DEFTERM + 1
    %IDM_PARAGRAPH     = %IDM_DEFINITION + 1
    
    %IDM_MAKEABSOLUTE  = %IDM_PARAGRAPH + 1  
    %IDM_SENDTOTOP     = %IDM_MAKEABSOLUTE + 1  
    %IDM_SENDTOBOTTOM  = %IDM_SENDTOTOP + 1   
    %IDM_BRINGTOFRONT  = %IDM_SENDTOBOTTOM + 1  
    %IDM_SENDTOBACK    = %IDM_BRINGTOFRONT + 1  
    %IDM_ABOVETEXT     = %IDM_SENDTOBACK + 1   
    %IDM_BELOWTEXT     = %IDM_ABOVETEXT + 1  
    %IDM_LOCKITEM      = %IDM_BELOWTEXT + 1
    
    %IDM_CONTENTS      = %IDM_LOCKITEM + 1
    %IDM_USING         = %IDM_CONTENTS + 1
    %IDM_ABOUT         = %IDM_USING + 1
                       
    %IDM_SEPARATOR     = %IDM_ABOUT + 1
    
    ' Equates
    $APPTITLE        = "PBHtmlEd - WYSIWYG Html Editor"
    %MAINTOOLBUTTONS = 5
    %EDITTOOLBUTTONS = 25
    
    %QD_ICOIMGLIST = 11 'qde icones nas img list
    
    %ID_REBAR       = 1001
    %ID_CBOFONTNAME = 1002
    %ID_CBOFONTSIZE = 1003
    %ID_TOOLBARMAIN = 1004
    %ID_TOOLBAREDIT = 1005
    %ID_TABMAIN     = 1006
    
    %ID_OCX         = 1010
    %ID_HTML        = 1015
    
    
    'Globals
    Global hDlgMain As Dword, hInst As Dword, hRebar As Dword, hNormal As Dword, hHot As Dword, hHtml As Dword
    Global hComboFN As Dword, hComboFS As Dword
    Global htmlFile As String
    Global Lg As Long
    Global TwoDCmd() As Long
    Global TabPage As Long 'current tab page
    
    'Declarations
    Declare CallBack Function DialogCallback
    Declare CallBack Function Tab0Proc
    Declare CallBack Function Tab1Proc
    Declare Function CreateRebar(Byval hParent As Dword) As Long
    Declare Function CreateCombo(Byval hParent As Dword, Byval Id As Long) As Dword
    Declare CallBack Function DlgSoundCB
    Declare CallBack Function DlgBackgCB
    
    Declare Function CreateToolBarMain(Byval hParent As Dword) As Dword
    Declare Function CreateToolBarEdit(Byval hParent As Dword) As Dword
    Declare Sub DrawMenuItem(lp As Long)
    Declare Function Lgs(Byval Nr As Long) As String
    Declare Function GetLocaleCode() As Long
    Declare Sub BuildMenu(Byval hDlg As Dword)
    Declare Function GetMenuTextAndBitmap(Byval ItemId As Long, BmpNum As Long) As String
    Declare Function GetMenuBmpHandle(Byval BmpNum As Long, Byval nState As Long) As Long
    Declare Sub MeasureMenu(Byval hWnd As Dword, Byval lParam As Dword)
    Declare Function AppLoadBitmaps() As Long
    Declare Function EnumFontName(lf As LOGFONT, tm As TEXTMETRIC, Byval FontType As Long, lpData As Long) As Long
    Declare Sub FillFontCombo(Byval hCbo As Long)
    Declare Function SelectColor(Byval hParent As Long, Byval iStartColor As Long, Byval iUseExt As Long) As Long
    Declare Function GetFileNameToSave(Byval PATH As String, Byval xHwnd As Long, Byval xCaption As String, Byval 
    
    xMask As String, Byval xDefault As String) As String
    Declare Function MsgBoxApi(Byval hParent As Long, Byval sMsg As String, Byval dwFlags As Dword, Byval sTitle 
    
    As String) As Long
    Declare Sub SaveHtmlFile(Optional Byval PromptUser As Long)
    Declare Sub SetAppTitle()
    Declare Sub PasteHTML(Byval x As String)
    Declare Sub UpdateTbMainAndMenus()
    Declare Sub AddRemoveBackImage(Byval x As String, Byval Position As Long) 
    Declare Sub AddRemoveBackSound(Byval x As String, Byval SoundParms As String) 
    Declare Sub ShowSoundDialog() 
    Declare Sub ShowBackgroundDialog() 
    Declare Sub EnableToolbars(Byval Stat As Long)
    Declare Function MakeFont(Byval FontName As String, Byval PointSize As Long, Opt Byval Flags As String) As 
    
    Long
    
    %WM_FORWARDMSG = &H37F ' (895)
    
    #Include "dhtmledit.inc"
    
    'ATLAPI
    Declare Function AtlAxWinInit Lib "ATL.DLL" Alias "AtlAxWinInit" () As Long
    Declare Function AtlAxWinTerm() As Long
    Declare Function AtlAxGetControl Lib "ATL.DLL" Alias "AtlAxGetControl" _
                     (_
                      Byval hWnd As Dword, _ '[in] A handle to the window that is hosting the control.
                      Byref pp As Dword _    '[out] The IUnknown of the control being hosted.
                     ) As Dword
    
    'uninitialize ATL
    Function AtlAxWinTerm() As Long
     UnregisterClass("AtlAxWin", GetModuleHandle(Byval %Null))
    End Function
    
    'puts the address of an object in a variant and marks it as containing a dispatch variable
    Sub AtlMakeDispatch(_
                        Byval lpObj As Dword, _ ' Address of the object instance
                        Byref vObj As Variant _ ' Variant to contain this address
                       ) Export
     Local lpvObj As VARIANTAPI Ptr 'Pointer to a VARIANTAPI structure
     Let vObj = Empty               'Make sure is empty to avoid memory leaks
     lpvObj = VarPtr(vObj)          'Get the VARIANT address
     @lpvObj.vt = %Vt_Dispatch      'Mark it as containing a dispatch variable
     @lpvObj.vd.pdispVal = lpObj    'Set the dispatch pointer address
    End Sub
    
    'create comboboxes for fonts
    Function CreateCombo(Byval hParent As Dword, Byval Id As Long) As Dword
     Local i As Long, x As String
     Local hComboBox As Dword
     Control Add ComboBox, hParent, Id,, 0, 0, 0, 100, _
             %WS_CHILD Or %WS_VISIBLE Or %CBS_DROPDOWNLIST Or %WS_VSCROLL _
             Or %WS_CLIPSIBLINGS Or %WS_CLIPCHILDREN
     Control Handle hParent, Id To hComboBox
     If Id = %ID_CBOFONTSIZE Then    'Font Size
      For i = 1 To 7 
       x = Format$(i)
       SendMessage hComboBox, %CB_ADDSTRING, 0, StrPtr(x)
      Next
      SendMessage hComboBox, %CB_SETCURSEL, 0, 0
     Else                            'Font Names
      FillFontCombo hComboBox
      x = "Times New Roman"          'set as default
      i = SendMessage(hComboBox, %CB_FINDSTRINGEXACT, - 1, StrPtr(x))
      If i = %CB_ERR Then
       SendMessage hComboBox, %CB_SETCURSEL, 0, 0
      Else
       SendMessage hComboBox, %CB_SETCURSEL, i, 0
      End If
     End If
     Function = hComboBox
    End Function
    
    
    '*********************************************************************************************
    ' Function     : AppLoadBitmaps ()
    ' Description  : Loads the Applications Bitmaps from a Resource file.
    ' Return value : Returns the size of the bitmaps
    ' NOTE         : If you use 24x24 Bitmaps for the ToolBars, you will have to
    '                add 16x16 Bitmaps Strips for the Menus!
    '*********************************************************************************************
    Function AppLoadBitmaps() As Long
     Local bm As Bitmap
     Local hBmpHot As Dword
     Local hBmpDis As Dword
     Local hBmpNor As Dword
     Local lBmpSize As Long
     
     ' Setup and Initialize the Menu, ToolBar Bitmaps and ImageLists.
     hBmpNor = LoadBitmap(hInst, Byval %IDB_MNOR) 'carrega bitmap normal
     hBmpHot = LoadBitmap(hInst, Byval %IDB_MHOT) 'carrega bitmap hot
     hBmpDis = LoadBitmap(hInst, Byval %IDB_MDIS) 'carrega bitmap disab
    
     ' Get and Save the Bitmap size for later use.
     GetObject hBmpNor, SizeOf(bm), bm ' Get the Bitmap's sizes.
     lBmpSize = bm.bmHeight ' Save Bitmap size for later use.
     
     ' Create the Menu and ToolBar ImageLists Hot Selected, Disabled and Normal.
     hImlHot = ImageList_Create(lBmpSize, lBmpSize, %ILC_COLORDDB Or %ILC_MASK, 1, 0)
     ImageList_AddMasked hImlHot, hBmpHot, Rgb(255, 0, 255)
     ImageList_Add hImlHot, hBmpHot, Rgb(255, 0, 255)
     
     hImlDis = ImageList_Create(lBmpSize, lBmpSize, %ILC_COLORDDB Or %ILC_MASK, 1, 0)
     ImageList_AddMasked hImlDis, hBmpDis, Rgb(255, 0, 255)
     ImageList_Add hImlDis, hBmpDis, Rgb(255, 0, 255)
     
     hImlNor = ImageList_Create(lBmpSize, lBmpSize, %ILC_COLORDDB Or %ILC_MASK, 1, 0)
     ImageList_AddMasked hImlNor, hBmpNor, Rgb(255, 0, 255)
     ImageList_Add hImlNor, hBmpNor, Rgb(255, 0, 255)
     
     ' Clean-Up and Delete the Bitmap Handles they are no longer need.
     If hBmpHot Then DeleteObject(hBmpHot)
     If hBmpDis Then DeleteObject(hBmpDis)
     If hBmpNor Then DeleteObject(hBmpNor)
     
     Function = lBmpSize
     
    End Function
    
    
    Function CreateToolBarMain(Byval hParent As Dword) As Dword
     Local hImage As Dword, i As Long, j As Long
     Local hToolBar As Dword
     Local Tbb() As TBBUTTON
     Dim Tbb(0 : %MAINTOOLBUTTONS - 1) As Local TBBUTTON
     Control Add "TOOLBARWINDOW32", hParent, %ID_TOOLBARMAIN, "", 0, 0, 0, 0, _
             %WS_CHILD Or %WS_VISIBLE Or %TBSTYLE_TOOLTIPS Or %TBSTYLE_FLAT _
             Or %WS_CLIPCHILDREN Or %WS_CLIPSIBLINGS Or %CCS_NODIVIDER Or %CCS_NORESIZE
     
     Control Handle hParent, %ID_TOOLBARMAIN To hToolBar
     
     'create/initialize normal imagelist
     hNormal = ImageList_Create(32, 32, %ILC_COLORDDB Or %ILC_MASK, %QD_ICOIMGLIST, 0)
     If IsTrue hNormal Then
      'seta a cor fundo para desenhar imagens
      ImageList_SetBkColor hNormal, %CLR_NONE
      'adiciona imagens à imagelist
      hImage = LoadBitmap(hInst, Byval %IDB_NORMAL)         'load normal bitmap
      ImageList_AddMasked hNormal, hImage, Rgb(255, 0, 255) 'transparent color
      DeleteObject hImage
     End If
     
     'create/initialize hot imagelist
     hHot = ImageList_Create(32, 32, %ILC_COLORDDB Or %ILC_MASK, %QD_ICOIMGLIST, 0)
     If IsTrue hHot Then
      'seta a cor fundo para desenhar imagens
      ImageList_SetBkColor hHot, %CLR_NONE
      'adiciona imagens à imagelist
      hImage = LoadBitmap(hInst, Byval %IDB_HOT)
      ImageList_AddMasked hHot, hImage, Rgb(255, 0, 255) 'transparent
      DeleteObject hImage
     End If
     
     'Link imagelists to toolbar
     Control Send hParent, %ID_TOOLBARMAIN, %TB_SETIMAGELIST, 0, hNormal
     Control Send hParent, %ID_TOOLBARMAIN, %TB_SETHOTIMAGELIST, 0, hHot
     
     'Init Tbb array.
     For i = 0 To %MAINTOOLBUTTONS - 1
      'set the initial states for each button
      Tbb(i).iBitmap = 0
      Tbb(i).idCommand = 0
      Tbb(i).fsState = %TBSTATE_ENABLED
      Tbb(i).fsStyle = %TBSTYLE_BUTTON
      Tbb(i).dwData = 0
      Tbb(i).iString = 0
      Select Case As Long i 
       Case 2
        'gap creation buttons.
        Tbb(i).fsStyle = %TBSTYLE_SEP
       Case 0
        Tbb(i).iBitmap = 0
        Tbb(i).idCommand = %IDM_NEW
       Case 1
        Tbb(i).iBitmap = 1
        Tbb(i).idCommand = %IDM_OPEN
       Case 3
        Tbb(i).iBitmap = 2
        Tbb(i).idCommand = %IDM_SAVE
        Tbb(i).fsState = 0 'disabled
       Case 4
        Tbb(i).iBitmap = 3
        Tbb(i).idCommand = %IDM_PRINT
        Tbb(i).fsState = 0 'disabled
      End Select
     Next
    
     'set the buttons
     Control Send hParent, %ID_TOOLBARMAIN, %TB_BUTTONSTRUCTSIZE, SizeOf(Tbb(0)), 0 
     Control Send hParent, %ID_TOOLBARMAIN, %TB_ADDBUTTONS, %MAINTOOLBUTTONS, VarPtr(Tbb(0)) 
     
     'set the tooltip background color to yellow
     j = SendMessage(hToolbar, %TB_GETTOOLTIPS, 0, 0)
     SendMessage hToolbar, %TB_GETTOOLTIPS, 0, 0
     i = Rgb(255, 255, 134)   'yellow
     SendMessage j, %TTM_SETTIPBKCOLOR, i, 0
     Function = hToolBar
     
    End Function
    
    Function CreateToolBarEdit(Byval hParent As Dword) As Dword
     Local i As Long, j As Long
     Local hToolBar As Dword
     'Toolbar variables
     Local Tbb() As TBBUTTON
     Dim Tbb(0 : %EDITTOOLBUTTONS - 1) As Local TBBUTTON
     
     Call AppLoadBitmaps 'load menus and tb16 bitmaps
     
     Control Add "TOOLBARWINDOW32", hParent, %ID_TOOLBAREDIT, "", 0, 0, 0, 0, _
             %WS_CHILD Or %WS_VISIBLE Or %TBSTYLE_TOOLTIPS Or %TBSTYLE_FLAT _
             Or %WS_CLIPCHILDREN Or %WS_CLIPSIBLINGS Or %CCS_NODIVIDER Or %CCS_NORESIZE
     Control Handle hParent, %ID_TOOLBAREDIT To hToolBar
     
     'Link imagelists to toolbar
     Control Send hParent, %ID_TOOLBAREDIT, %TB_SETIMAGELIST, 0, hImlNor
     Control Send hParent, %ID_TOOLBAREDIT, %TB_SETHOTIMAGELIST, 0, hImlHot
    
     ' Init Tbb array.
     For i = 0 To %EDITTOOLBUTTONS - 1
      ' Set the initial states for each button
      Tbb(i).iBitmap = 0
      Tbb(i).idCommand = 0
      Tbb(i).fsState = %TBSTATE_ENABLED
      Tbb(i).fsStyle = %TBSTYLE_BUTTON
      Tbb(i).dwData = 0
      Tbb(i).iString = 0
      
      Select Case As Long i 
       Case 4, 9, 13, 16, 21
        Tbb(i).fsStyle = %TBSTYLE_SEP
       Case 0
        Tbb(i).iBitmap = 0 
        Tbb(i).idCommand = %IDC_BOLD
       Case 1
        Tbb(i).iBitmap = 1
        Tbb(i).idCommand = %IDC_ITALIC
       Case 2
        Tbb(i).iBitmap = 3
        Tbb(i).idCommand = %IDC_UNDERLINE
       Case 3
        Tbb(i).iBitmap = 2
        Tbb(i).idCommand = %IDC_TXTBACKCOLOR
       Case 5
        Tbb(i).iBitmap = 4
        Tbb(i).idCommand = %IDC_INDENT
       Case 6
        Tbb(i).iBitmap = 5
        Tbb(i).idCommand = %IDC_OUTDENT
       Case 7
        Tbb(i).iBitmap = 6
        Tbb(i).idCommand = %IDC_ORDERLIST
       Case 8
        Tbb(i).iBitmap = 7
        Tbb(i).idCommand = %IDC_UNORDERLIST
       Case 10
        Tbb(i).iBitmap = 9
        Tbb(i).idCommand = %IDC_JUSTIFYLEFT
       Case 11
        Tbb(i).iBitmap = 10
        Tbb(i).idCommand = %IDC_JUSTIFYCENTER
       Case 12
        Tbb(i).iBitmap = 11
        Tbb(i).idCommand = %IDC_JUSTIFYRIGHT
       Case 14
        Tbb(i).iBitmap = 12
        Tbb(i).idCommand = %IDC_UNDO
       Case 15
        Tbb(i).iBitmap = 13
        Tbb(i).idCommand = %IDC_REDO
       Case 17
        Tbb(i).iBitmap = 14
        Tbb(i).idCommand = %IDC_IMAGE
       Case 18
        Tbb(i).iBitmap = 15
        Tbb(i).idCommand = %IDC_LINE
       Case 19
        Tbb(i).iBitmap = 16
        Tbb(i).idCommand = %IDC_HYPERLINK
       Case 20
        Tbb(i).iBitmap = 17
        Tbb(i).idCommand = %IDC_UNLINK
       Case 22
        Tbb(i).iBitmap = 22
        Tbb(i).idCommand = %IDC_COPY
       Case 23
        Tbb(i).iBitmap = 23
        Tbb(i).idCommand = %IDC_CUT
       Case 24
        Tbb(i).iBitmap = 24
        Tbb(i).idCommand = %IDC_PASTE
        
      End Select
     Next
     
     'Set the buttons
     Control Send hParent, %ID_TOOLBAREDIT, %TB_BUTTONSTRUCTSIZE, SizeOf(Tbb(0)), 0 
     Control Send hParent, %ID_TOOLBAREDIT, %TB_ADDBUTTONS, %EDITTOOLBUTTONS, VarPtr(Tbb(0)) 
     
     'Set the tooltip background color to yellow
     j = SendMessage(hToolbar, %TB_GETTOOLTIPS, 0, 0)
     SendMessage hToolbar, %TB_GETTOOLTIPS, 0, 0
     i = Rgb(255, 255, 134)   'yellow
     SendMessage j, %TTM_SETTIPBKCOLOR, i, 0
     
     Function = hToolBar
     
    End Function
    
    
    Function CreateRebar(Byval hParent As Dword) As Long
     Local rbi As REBARINFO 
     Local rbBand As REBARBANDINFO 
     Local rc As RECT 
     Local szCbText As Asciiz * 255 
     Local dwBtnSize As Dword 
     
     Control Add $REBARCLASSNAME, hParent, %ID_REBAR, "", 0, 0, 0, 0, _ 
             %WS_CHILD Or %WS_VISIBLE Or %WS_CLIPSIBLINGS Or %WS_CLIPCHILDREN Or _ 
             %RBS_VARHEIGHT Or %RBS_BANDBORDERS Or %WS_BORDER '++Or %CCS_NODIVIDER 
     Control Handle hParent, %ID_REBAR To hRebar 
     
     'Initialize and send the REBARINFO structure
     rbi.cbSize = SizeOf(rbi) 
     rbi.fMask = 0
     rbi.himl = 0
     Control Send hParent, %ID_REBAR, %RB_SETBARINFO, 0, VarPtr(rbi) 
     
     'initialize REBARBANDINFO for all rebar bands
     rbBand.cbSize = SizeOf(rbBand)
     'rbBand.fMask = %RBBIM_COLORS Or _            '// clrFore and clrBack are valid...
     rbBand.fMask = %RBBIM_CHILD Or _ '// hwndChild is valid
                    %RBBIM_CHILDSIZE Or _ '// cxMinChild and cyMinChild are valid
                    %RBBIM_STYLE     Or _ '// fStyle is valid
                    %RBBIM_ID        Or _ '// wID is valid
                    %RBBIM_SIZE      Or _ '// cx is valid
                    %RBBIM_TEXT      Or _ '// lpText is valid
                    %RBBIM_BACKGROUND '// hbmBack is valid
     'rbBand.clrFore = Rgb(0, 0, 255)              '// Red
     'rbBand.clrBack = Rgb(223, 248, 104)           '// Yellow
     rbBand.fStyle = %RBBS_NOVERT Or _ '// do not display in vertical orientation
                   %RBBS_CHILDEDGE  Or _
                   %RBBS_FIXEDBMP
     rbBand.hbmBack = 0  'backg bmp
     
     hToolbarMain = CreateToolBarMain(hParent)
     dwBtnSize = SendMessage(hToolbarMain, %TB_GETBUTTONSIZE, 0, 0)
     rbBand.hwndChild = hToolbarMain
     rbBand.wID = %ID_TOOLBARMAIN
     rbBand.cxMinChild = 230
     rbBand.cyMinChild = HiWrd(dwBtnSize)
     rbBand.Cx = 250
     'insert band into rebar 
     Control Send hParent, %ID_REBAR, %RB_INSERTBAND, - 1, VarPtr(rbBand) 
    
     'insert font combo
     hComboFN = CreateCombo(hParent, %ID_CBOFONTNAME)
     szCbText = Lgs(100)
     rbBand.lpText = VarPtr(szCbText)
     rbBand.hwndChild = hComboFN
     rbBand.wID = %ID_CBOFONTNAME
     GetWindowRect hComboFN, rc
     rbBand.cxMinChild = 160
     rbBand.cyMinChild = rc.nBottom - rc.nTop
     rbBand.Cx = 160
     'insert band into rebar
     Control Send hParent, %ID_REBAR, %RB_INSERTBAND, - 1, VarPtr(rbBand)
    
     'insert font size combo
     hComboFS = CreateCombo(hParent, %ID_CBOFONTSIZE)
     szCbText = Lgs(101)
     rbBand.lpText = VarPtr(szCbText)
     rbBand.hwndChild = hComboFS
     rbBand.wID = %ID_CBOFONTNAME
     GetWindowRect hComboFS, rc
     rbBand.cxMinChild = 40
     rbBand.cyMinChild = rc.nBottom - rc.nTop
     rbBand.Cx = 40
     'insert band into rebar
     Control Send hParent, %ID_REBAR, %RB_INSERTBAND, - 1, VarPtr(rbBand)
    
     'insert toolbar edit
     hToolbarEdit = CreateToolBarEdit(hParent)
     dwBtnSize = SendMessage(hToolbarEdit, %TB_GETBUTTONSIZE, 0, 0)
     szCbText = ""
     rbBand.hwndChild = hToolbarEdit
     rbBand.wID = %ID_TOOLBAREDIT
     rbBand.cxMinChild = 230
     rbBand.cyMinChild = HiWrd(dwBtnSize)
     rbBand.Cx = 250
     'insert band into rebar 
     Control Send hParent, %ID_REBAR, %RB_INSERTBAND, - 1, VarPtr(rbBand) 
     
    End Function 
    
    
    '=================================================
    ' Main entry point for the application
    '=================================================
    
    Function PbMain() As Long
     Local i As Long
     Local tTC_Item As TC_ITEM
     Local szBuf As Asciiz * 32
     Local OcxName As Asciiz * 255
      Local pUnk As Dword, dwCookie As Dword
     Local hWnd As Dword, hFont As Dword
     Local vVar As Variant
     Local uMsg As TAGMSG
     Redim hTab(0 To 1) As Global Dword     'handle dos 3 tabs
    
     hInst = GetModuleHandle(Byval 0)
     OcxName = "DHTMLEdit.DHTMLEdit.1"
     Call AtlAxWinInit         'initializes ATL
     Lg = GetLocaleCode()
     
     'initialize the common control library
     InitComCtls(%ICC_WIN95_CLASSES Or %ICC_DATE_CLASSES Or %ICC_INTERNET_CLASSES Or %ICC_COOL_CLASSES Or 
    
    %ICC_USEREX_CLASSES)
    
     'creates the brushes for the submenu text background
     hMenuTextBkBrush = CreateSolidBrush(Rgb(249, 249, 249))
     'creates the brushes for the submenu highlighted text background
     hMenuHiBrush = CreateSolidBrush(Rgb(182, 209, 234))
     
     'no error trapping, we will handle it ourself
     On Error Resume Next
    
    
     ' OcxName must be formatted in one of the following ways:
     ' ·  A ProgID such as "MSCAL.Calendar.7"
     ' ·  A CLSID such as "{8E27C92B-1264-101C-8A2F-040224009C02}"
     ' ·  A URL such as "http://www.microsoft.com"
     ' ·  A reference to an Active document such as "file://\\Documents\MyDoc.doc"
     ' ·  A fragment of HTML such as "MSHTML:<HTML><BODY>This is a line of text</BODY></HTML>"
     ' Note   "MSHTML:" must precede the HTML fragment so that it is designated as being an MSHTML stream.
     Dialog New %HWND_DESKTOP, $APPTITLE, 0, 0, _
            400, 300, %WS_OVERLAPPEDWINDOW Or %WS_MAXIMIZEBOX Or %WS_MINIMIZEBOX Or %WS_SYSMENU Or _
            %WS_THICKFRAME Or %WS_CLIPCHILDREN Or %WS_CLIPSIBLINGS Or %DS_CENTER To hDlgMain
     Dialog Send hDlgMain, %WM_SETICON, %ICON_SMALL, LoadIcon(GetModuleHandle("" ), "APPLICA")
     Dialog Send hDlgMain, %WM_SETICON, %ICON_BIG, LoadIcon(GetModuleHandle("" ), "APPLICA")
     
     BuildMenu hDlgMain
     CreateRebar hDlgMain
    
     'create tab ctl with 2 tabs
     Control Add "SysTabControl32", hDlgMain, %ID_TABMAIN, "SysTabControl321", 0, 60, 400, 220, _
                 %WS_CHILD Or %WS_VISIBLE Or %WS_TABSTOP Or %TCS_MULTILINE Or _
                 %TCS_RIGHTJUSTIFY Or %TCS_BOTTOM, %WS_EX_LEFT Or %WS_EX_LTRREADING
     Control Handle hDlgMain, %ID_TABMAIN To hTabMain 
     ImageListTab = ImageList_Create(16, 16, %ILC_COLORDDB Or %ILC_MASK, 0, 4)
     i = LoadImage(GetModuleHandle(Byval 0&), "EDIT", %IMAGE_ICON, 16, 16, %LR_DEFAULTCOLOR Or %LR_SHARED)
     ImageList_AddIcon ImageListTab, i
     i = LoadImage(GetModuleHandle(Byval 0&), "HTML", %IMAGE_ICON, 16, 16, %LR_DEFAULTCOLOR Or %LR_SHARED)
     ImageList_AddIcon ImageListTab, i
     TabCtrl_SetImageList hTabMain, ImageListTab
     tTC_Item.Mask = %TCIF_TEXT Or %TCIF_IMAGE
     tTC_Item.pszText = VarPtr(szBuf)
     For i = 0 To 1
      szBuf = Parse$(Lgs(114), "|", i + 1)
      tTC_Item.iImage = i
      TabCtrl_InsertItem hTabMain, i, tTC_Item
     Next
    
    
     'TAB0 (OCX)
     Dialog New hTabMain, "", 0, 0, 400, 220, %WS_CHILD Or %WS_VISIBLE To hTab(0)
     Control Add "AtlAxWin", hTab(0), %ID_OCX, OcxName, 0, 0, 400, 220, %WS_VISIBLE Or %WS_CHILD
     Control Handle hTab(0), %ID_OCX To hOcx
     AtlAxGetControl(hOcx, pUnk)
     AtlMakeDispatch(pUnk, vVar)
     Set oOcx = vVar
     SetFocus(hOcx)
     Dialog Show ModeLess hTab(0), Call Tab0Proc
    
     Call SetAppTitle()
    
     'TAB1 (TXT)
     Dialog New hTabMain, "", 0, 0, 400, 220, %WS_CHILD Or %WS_VISIBLE To hTab(1)
     Control Add TextBox, hTab(1), %ID_HTML, "", 0, 0, 400, 220, %ES_MULTILINE Or %ES_WANTRETURN Or %ES_NOHIDESEL 
    
    _
                          Or %ES_AUTOVSCROLL Or %ES_AUTOHSCROLL Or %WS_BORDER Or %WS_VSCROLL Or %WS_HSCROLL Or 
    
    %WS_TABSTOP
     Control Handle hTab(1), %ID_HTML To hHtml
     hfont = MakeFont("Arial", 8, "B")
     SendMessage hHtml, %WM_SETFONT, hFont, 0
     Dialog Show ModeLess hTab(1), Call Tab1Proc
    
     ' create the status bar window
     hStatus = CreateStatusWindow(%WS_CHILD Or %WS_BORDER Or %WS_VISIBLE Or %SBS_SIZEGRIP, "", hDlgMain, 200)
    
     'show tabs
     Dialog Show State hTab(0), %SW_SHOW
     Dialog Show State hTab(1), %SW_HIDE
     Dialog Show ModeLess hDlgMain Call DialogCallback
    
     'get the handle of the ancestor of the control that has the focus
     hWnd = GetFocus
     While GetParent(hWnd) <> hTab(0)
      hWnd = GetParent(hWnd)
     Wend
    
     Call DHTMLEditEvents_ConnectEvents(Objptr(oOcx), dwCookie)
    
     While GetMessage(uMsg, %Null, 0, 0)
      'Pass keyboard messages to the ancestor
      'Returns 0 if the message was not processed, nonzero if it was
      If SendMessage(hWnd, %WM_FORWARDMSG, 0, VarPtr(uMsg)) = 0 Or TabPage = 1 Then
       If IsDialogMessage(hTab(0), uMsg) = %FALSE Then
        TranslateMessage uMsg
        DispatchMessage uMsg
       End If
      End If
     Wend
     
     Call DHTMLEditEvents_DisconnectEvents(Objptr(oOcx), dwCookie)
     DeleteObject hFont 
     
     AtlAxWinTerm  'uninitializes ATL
     Set oOcx = Nothing
     
    End Function

    ------------------

  • #2
    PASTE JUST AFTER 1st CHUNK

    Code:
    ' Main callback
    '------------------------------------------------------------------------------
    CallBack Function DialogCallback
     Local i As Long, j As Long
     Local RetC As RECT
     Local pToolTip As TOOLTIPTEXT Ptr  ' Structure pointer via NMHDR
     Local ptnmhdr As NMHDR Ptr         'information about a notification message
     Local pRebar As NMREBAR Ptr
     Local mminfo As MINMAXINFO Ptr
     Local zT As Asciiz * 255
     Local x As String
     Local v As Variant, v1 As Variant, v2 As Variant
     Local vv As Variant, Dp As Dispatch
     Static hR As Long, hS As Long
     Static BackColor As Long, TxtBackColor As Long, TxtForeColor As Long
     Static szTipText As Asciiz * 64 ' ToolTips text buffer
    
     Select Case CbMsg
      Case %WM_INITDIALOG
       Redim TwoDCmd(%IDM_MAKEABSOLUTE To %IDM_LOCKITEM) As Global Long
       TwoDCmd(%IDM_MAKEABSOLUTE) = %DECMD_MAKE_ABSOLUTE
       TwoDCmd(%IDM_SENDTOTOP) = %DECMD_BRING_TO_FRONT
       TwoDCmd(%IDM_SENDTOBOTTOM) = %DECMD_SEND_TO_BACK 
       TwoDCmd(%IDM_BRINGTOFRONT) = %DECMD_BRING_FORWARD 
       TwoDCmd(%IDM_SENDTOBACK) = %DECMD_SEND_BACKWARD
       TwoDCmd(%IDM_ABOVETEXT) = %DECMD_BRING_ABOVE_TEXT
       TwoDCmd(%IDM_BELOWTEXT) = %DECMD_SEND_BELOW_TEXT
       TwoDCmd(%IDM_LOCKITEM) = %DECMD_LOCK_ELEMENT
       BackColor = Bgr(%White)
       TxtBackColor = %White
       TxtForeColor = %Black
       MakeAbsString = Lgs(%IDM_MAKEABSOLUTE)
    
      Case %WM_COMMAND
       Select Case Cbctl 
        Case %IDM_NEW, %IDM_OPEN
          Object Get oOcx.IsDirty To v
          If IsTrue Variant#(v) Then
           'want to save file?
           i = MsgBoxApi(CbHndl, Lgs(103), %MB_ICONQUESTION + %MB_YESNOCANCEL, $APPTITLE)
           If i = %IDYES Then
            Call SaveHtmlFile()
           ElseIf i = %IDCANCEL Then
            SetFocus hOcx
            Exit Function
           End If  
          End If
     
         If Cbctl = %IDM_NEW Then    'new file
          htmlFile = ""
          FlagNewDoc = %FALSE  
          Object Call oOcx.NewDocument
         Else                        'open file 
          '------- oOcx.LoadDocument() DIDN'T WORK FULLY - doesn't recognize V1 as true to prompt user
          'v = ""
          'v1 = %TRUE
          'Object Call oOcx.LoadDocument(v, v1) '!!! (doesn't recognize v1 as true)
          'workaround: create public htmlFile and get file name to pass to this ocx function
          '------------------------------------------------------------------------------------
          If OpenFileDialog(CbHndl, Lgs(115), x, CurDir$, Lgs(102), "", %OFN_FILEMUSTEXIST) Then
           v = x
           On Error Resume Next
           Object Call oOcx.LoadDocument(v)
           If Err <> 0 Then
            MsgBoxApi CbHndl, Lgs(116), %MB_ICONEXCLAMATION, $APPTITLE
            htmlFile = ""
            FlagNewDoc = %FALSE  
            Object Call oOcx.NewDocument
           Else
            htmlFile = x
           End If
          End If
         End If
         Call SetAppTitle()
         SetFocus hOcx
     
        Case %IDM_SAVE
         Call SaveHtmlFile()
     
        Case %IDM_SAVEAS
         Call SaveHtmlFile(%TRUE)  'save and prompt user
         Call SetAppTitle()
    
        Case %IDM_PRINT
         v = 1
         Object Call oOcx.PrintDocument(v) 
    
        Case %IDM_EXIT
         Dialog End CbHndl, %TRUE
    
        Case %IDC_BOLD
         If CbctlMsg = %BN_CLICKED Or CbctlMsg = 1 Then
          v = %DECMD_BOLD
          Object Call oOcx.ExecCommand(v)
         End If
        Case %IDC_ITALIC
         If CbctlMsg = %BN_CLICKED Or CbctlMsg = 1 Then
          v = %DECMD_ITALIC
          Object Call oOcx.ExecCommand(v)
         End If
        Case %IDC_UNDERLINE
         If CbctlMsg = %BN_CLICKED Or CbctlMsg = 1 Then
          v = %DECMD_UNDERLINE
          Object Call oOcx.ExecCommand(v)
         End If
        Case %IDC_INDENT
         If CbctlMsg = %BN_CLICKED Or CbctlMsg = 1 Then
          v = %DECMD_INDENT
          Object Call oOcx.ExecCommand(v)
         End If
        Case %IDC_OUTDENT
         If CbctlMsg = %BN_CLICKED Or CbctlMsg = 1 Then
          v = %DECMD_OUTDENT
          Object Call oOcx.ExecCommand(v)
         End If
        Case %IDC_ORDERLIST
         If CbctlMsg = %BN_CLICKED Or CbctlMsg = 1 Then
          v = %DECMD_ORDERLIST
          Object Call oOcx.ExecCommand(v)
         End If
        Case %IDC_UNORDERLIST
         If CbctlMsg = %BN_CLICKED Or CbctlMsg = 1 Then
          v = %DECMD_UNORDERLIST
          Object Call oOcx.ExecCommand(v)
         End If
        Case %IDC_JUSTIFYLEFT
         If CbctlMsg = %BN_CLICKED Or CbctlMsg = 1 Then
          v = %DECMD_JUSTIFYLEFT
          Object Call oOcx.ExecCommand(v)
         End If
        Case %IDC_JUSTIFYCENTER
         If CbctlMsg = %BN_CLICKED Or CbctlMsg = 1 Then
          v = %DECMD_JUSTIFYCENTER
          Object Call oOcx.ExecCommand(v)
         End If
        Case %IDC_JUSTIFYRIGHT
         If CbctlMsg = %BN_CLICKED Or CbctlMsg = 1 Then
          v = %DECMD_JUSTIFYRIGHT
          Object Call oOcx.ExecCommand(v)
         End If
        Case %IDM_FIND
         If CbctlMsg = %BN_CLICKED Or CbctlMsg = 1 Then
          v = %DECMD_FINDTEXT
          Object Call oOcx.ExecCommand(v)
         End If
        Case %IDC_UNDO, %IDM_UNDO
         If CbctlMsg = %BN_CLICKED Or CbctlMsg = 1 Then
          v = %DECMD_UNDO
          Object Call oOcx.ExecCommand(v)
         End If
        Case %IDC_REDO, %IDM_REDO
         If CbctlMsg = %BN_CLICKED Or CbctlMsg = 1 Then
          v = %DECMD_REDO
          Object Call oOcx.ExecCommand(v)
         End If
        Case %IDC_LINE, %IDM_LINE
         If CbctlMsg = %BN_CLICKED Or CbctlMsg = 1 Then
          Call PasteHTML("<HR>")
         End If
        Case %IDC_HYPERLINK, %IDM_HYPERLINK
         If CbctlMsg = %BN_CLICKED Or CbctlMsg = 1 Then
          v = %DECMD_HYPERLINK
          Object Call oOcx.ExecCommand(v)
         End If
        Case %IDM_SELALL
         If CbctlMsg = %BN_CLICKED Then
          v = %DECMD_SELECTALL
          Object Call oOcx.ExecCommand(v)
         End If
        Case %IDC_UNLINK
         If CbctlMsg = %BN_CLICKED Or CbctlMsg = 1 Then
          v = %DECMD_UNLINK
          Object Call oOcx.ExecCommand(v)
         End If
        Case %IDC_COPY, %IDM_COPY
         If CbctlMsg = %BN_CLICKED Or CbctlMsg = 1 Then
          v = %DECMD_COPY
          Object Call oOcx.ExecCommand(v)
         End If
        Case %IDC_CUT, %IDM_CUT
         If CbctlMsg = %BN_CLICKED Or CbctlMsg = 1 Then
          v = %DECMD_CUT
          Object Call oOcx.ExecCommand(v)
         End If
        Case %IDC_PASTE, %IDM_PASTE
         If CbctlMsg = %BN_CLICKED Or CbctlMsg = 1 Then
          v = %DECMD_PASTE
          Object Call oOcx.ExecCommand(v)
         End If
        'formatting menu options
        Case %IDM_NORMAL To %IDM_PARAGRAPH
         If CbctlMsg = %BN_CLICKED Or CbctlMsg = 1 Then
          v = %DECMD_SETBLOCKFMT
          Object Call oOcx.QueryStatus(v) To v1
          If Variant#(v1) >= %DECMDF_ENABLED Then
           v1 = %OLECMDEXECOPT_DONTPROMPTUSER
           GetMenuString hMenu, Byval Cbctl, Byval VarPtr(zT), SizeOf(zT), Byval %MF_BYCOMMAND
           v2 = Trim$(zT)
           Object Call oOcx.ExecCommand(v, v1, v2)
          End If
         End If
        
        '2d menu options
        Case %IDM_MAKEABSOLUTE To %IDM_LOCKITEM
         If CbctlMsg = %BN_CLICKED Or CbctlMsg = 1 Then
          v = TwoDCmd(Cbctl) 
          v1 = %OLECMDEXECOPT_DODEFAULT
          Object Call oOcx.ExecCommand(v, v1)
          v = %DECMD_MAKE_ABSOLUTE
          Object Call oOcx.QueryStatus(v) To v1
          i = Variant#(v1)
          If i = %DECMDF_LATCHED Then
           MakeAbsString = Lgs(117)  'use 1D positioning
           Menu Set State hMenu, Bycmd %IDM_MAKEABSOLUTE, %MF_ENABLED
          ElseIf i = %DECMDF_ENABLED Then
           MakeAbsString = Lgs(%IDM_MAKEABSOLUTE)
           Menu Set State hMenu, Bycmd %IDM_MAKEABSOLUTE, %MF_ENABLED
          Else
           MakeAbsString = Lgs(%IDM_MAKEABSOLUTE)
           Menu Set State hMenu, Bycmd %IDM_MAKEABSOLUTE, %MF_DISABLED
          End If
         End If
    
        Case %IDM_TEXTFORECOLOR
         If CbctlMsg = %BN_CLICKED Or CbctlMsg = 1 Then
          i = SelectColor(CbHndl, TxtForeColor, 1)
          If IsTrue i Then 
           TxtForeColor = i
           v = %DECMD_SETFORECOLOR
           v1 = %OLECMDEXECOPT_DODEFAULT
           v2 = TxtForeColor
           Object Call oOcx.ExecCommand(v, v1, v2)
           UpdateWindow hOcx
           SetFocus hOcx 
          End If
         End If
    
        Case %IDM_TEXTBACKCOLOR, %IDC_TXTBACKCOLOR
         If CbctlMsg = %BN_CLICKED Or CbctlMsg = 1 Then
          i = SelectColor(CbHndl, TxtBackColor, 1)
          If IsTrue i Then
           TxtBackColor = i
           v = %DECMD_SETBACKCOLOR
           v1 = %OLECMDEXECOPT_DODEFAULT
           v2 = TxtBackColor
           Object Call oOcx.ExecCommand(v, v1, v2)
           UpdateWindow hOcx 
           SetFocus hOcx 
          End If 
         End If
    
        Case %IDM_BACKCOLOR   'pg
         If CbctlMsg = %BN_CLICKED Or CbctlMsg = 1 Then
          i = SelectColor(CbHndl, Bgr(BackColor), 1)
          If IsTrue i Then 
           BackColor = Bgr(i)
           Object Get oOcx.dom To vv : Dp = vv
           v = BackColor
           Object Let Dp.bgColor = v
           UpdateWindow hOcx 
           SetFocus hOcx 
          End If 
         End If
    
        Case %IDM_BACKIMAGE   'background image
         If CbctlMsg = %BN_CLICKED Or CbctlMsg = 1 Then
          Call ShowBackgroundDialog()
         End If
    
        Case %IDM_BACKSOUND   'background sound
         If CbctlMsg = %BN_CLICKED Or CbctlMsg = 1 Then
          Call ShowSoundDialog() 
         End If
    
        Case %IDC_IMAGE, %IDM_IMAGE
         If CbctlMsg = %BN_CLICKED Or CbctlMsg = 1 Then
          v = %DECMD_IMAGE
          v1 = %OLECMDEXECOPT_PROMPTUSER
          Object Call oOcx.ExecCommand(v, v1)
         End If
    
        Case %IDM_HTML
         If CbctlMsg = %BN_CLICKED Or CbctlMsg = 1 Then
          If OpenFileDialog(CbHndl, Lgs(113), x, CurDir$, Lgs(102) + "|" + Lgs(105), "", %OFN_FILEMUSTEXIST) Then
           i = FreeFile
           Open x For Binary As #i
           Get$ #i, Lof(i), x
           Close #i
           Call PasteHTML(x)
          End If
    
         End If
    
        Case %ID_CBOFONTNAME
         If CbctlMsg = %CBN_SELENDOK Then
          v = %DECMD_SETFONTNAME
          Object Call oOcx.QueryStatus(v) To v1
          If Variant#(v1) >= %DECMDF_ENABLED Then
           v = %DECMD_SETFONTNAME
           v1 = %OLECMDEXECOPT_DONTPROMPTUSER
           ComboBox Get Text hREbar, %ID_CBOFONTNAME To x
           v2 = x
           Object Call oOcx.ExecCommand(v, v1, v2)
          End If
         End If
    
        Case %ID_CBOFONTSIZE
         If CbctlMsg = %CBN_SELENDOK Then
          v = %DECMD_SETFONTSIZE
          v1 = %OLECMDEXECOPT_DONTPROMPTUSER
          Control Send hRebar, %ID_CBOFONTSIZE, %CB_GETCURSEL, 0, 0 To i
          v2 = i + 1
          Object Call oOcx.ExecCommand(v, v1, v2)
         End If
    
       End Select
       
      Case %WM_MENUSELECT
       Select Case Lowrd(CbwParam)
        Case 1      'EDIT MENU - disable if editing html text box
         If TabPage = 1 Then
          For i = %IDM_FIND To %IDM_SELALL
           Menu Set State hMenu, Bycmd i, %MF_DISABLED
          Next
         End If
    
        Case 2      'INSERT MENU - disable if editing html text box
         If TabPage = 1 Then 
          For i = %IDM_IMAGE To %IDM_HYPERLINK
           Menu Set State hMenu, Bycmd i, %MF_DISABLED
          Next
         End If
     
        Case 3      'Prepare FORMATTING MENU...
         If TabPage = 1 Then  'is editing html text box
          For i = %IDM_NORMAL To %IDM_PARAGRAPH
           Menu Set State hMenu, Bycmd i, %MF_DISABLED
          Next
         Else
          'adjust menu according to format of selected text
          v = %DECMD_GETBLOCKFMT
          Object Call oOcx.QueryStatus(v) To v1
          If Variant#(v1) >= %DECMDF_ENABLED Then
           v = %DECMD_GETBLOCKFMT
           v1 = %OLECMDEXECOPT_DONTPROMPTUSER
           Object Call oOCx.ExecCommand(v, v1) To v2
           x = Variant$(v2)
           For i = %IDM_NORMAL To %IDM_PARAGRAPH
            Menu Set State hMenu, Bycmd i, %MF_ENABLED
            GetMenuString hMenu, Byval i, Byval VarPtr(zT), SizeOf(zT), Byval %MF_BYCOMMAND
            If x = Trim$(zT) Then
             Menu Set State hMenu, Bycmd i, %MF_CHECKED
            Else
             Menu Set State hMenu, Bycmd i, %MF_UNCHECKED
            End If
           Next
          Else
           For i = %IDM_NORMAL To %IDM_PARAGRAPH
            Menu Set State hMenu, Bycmd i, %MF_DISABLED
            Menu Set State hMenu, Bycmd i, %MF_UNCHECKED
           Next 
          End If
         End If
     
        Case 4  'Prepare POSITIONING MENU
         If TabPage = 1 Then  'is editing html text box
          For i = %IDM_MAKEABSOLUTE To %IDM_LOCKITEM
           Menu Set State hMenu, Bycmd i, %MF_DISABLED
          Next
         Else
          'adjust menu according to format of selected text
          For j = %IDM_MAKEABSOLUTE To %IDM_LOCKITEM
           v = TwoDCmd(j)
           Object Call oOcx.QueryStatus(v) To v1
           If Variant#(v1) >= %DECMDF_ENABLED Then
            Menu Set State hMenu, Bycmd j, %MF_ENABLED
           Else 
            Menu Set State hMenu, Bycmd j, %MF_DISABLED
           End If      
          Next 
          Menu Get State hMenu, Bycmd %IDM_LOCKITEM To i
          If i = %MF_ENABLED Then
           v = TwoDCmd(%IDM_LOCKITEM) 
           Object Call oOcx.QueryStatus(v) To v1
           If Variant#(v1) = %DECMDF_LATCHED Then
            Menu Set State hMenu, Bycmd %IDM_LOCKITEM, %MF_CHECKED
           Else
            Menu Set State hMenu, Bycmd %IDM_LOCKITEM, %MF_UNCHECKED
           End If     
          End If 
         End If 
        
       End Select
     
      Case %WM_DRAWITEM
       If CbwParam = 0 Then   'if identifier is 0, msg was sent from a menu
        DrawMenuItem CblParam
        Function = %TRUE
        Exit Function
       End If
       
      Case %WM_MEASUREITEM  'Get menu item size
       If CbwParam = 0 Then 'A menu is calling
        MeasureMenu CbHndl, CblParam ' Do all work in separate Sub
        Function = %TRUE
        Exit Function
       End If
    
      Case %WM_CLOSE
        Object Get oOcx.IsDirty To v
        If IsTrue Variant#(v) Then     
         If MsgBoxApi(CbHndl, Lgs(103), %MB_ICONQUESTION + %MB_YESNO, $APPTITLE) = %IDYES Then 'save file
          Call SaveHtmlFile()
         End If 
        End If
        
      Case %WM_DESTROY
       If hImlHot Then ImageList_Destroy hImlHot              ' Destroy Hot Selected ImageList Handle.
       If hImlDis Then ImageList_Destroy hImlDis              ' Destroy Dis Disabled ImageList Handle.
       If hImlNor Then ImageList_Destroy hImlNor              ' Destroy Nor Normal   ImageList Handle.
       If ImagelistTab Then ImageList_Destroy ImageListTab
       DeleteObject hMenuTextBkBrush                          ' Delete the submenu text brush
       DeleteObject hMenuHiBrush                              ' Delete the highlighted text brush
       PostQuitMessage 0
    
      Case %WM_GETMINMAXINFO
       i = DefWindowProc(CbHndl, CbMsg, CbwParam, CblParam)
       mminfo = CblParam
       @mminfo.ptMinTrackSize.x = 550
       @mminfo.ptMinTrackSize.y = 420
       Function=0
       Exit Function
    
      Case %WM_SIZE
       If CbwParam <> %SIZE_MINIMIZED Then
        If hR = 0 Then
         GetWindowRect hRebar, RetC
         hR = (RetC.nBottom - RetC.nTop)    'rebar height
        End If
        If hS = 0 Then
         GetWindowRect hStatus, RetC
         hS = (RetC.nBottom - RetC.nTop)    'rebar height
        End If
        MoveWindow hRebar, 0, 0, Lowrd(CblParam), HiWrd(CblParam), %TRUE
        MoveWindow hStatus, 0, 0, Lowrd(CblParam), HiWrd(CblParam), %TRUE
        GetClientRect CbHndl, RetC    'dlg client rect
        MoveWindow hTabMain, 2, retC.nTop + hR, RetC.nRight - 4, RetC.nBottom - hR - hS, %TRUE
        GetClientRect hTabMain, RetC  'get rect tabmain
        For i = 0 To 1
         MoveWindow hTab(i), 1, 1, RetC.nRight - 3, RetC.nBottom - 25, %TRUE 'move tab child
        Next 
        GetClientRect hTab(0), RetC  'get rect htab(0)
        MoveWindow hOCX, 0, 0, (RetC.nRight - RetC.nLeft), (RetC.nBottom - RetC.nTop), %TRUE  'move ocs 
        MoveWindow hHtml, 0, 0, (RetC.nRight - RetC.nLeft), (RetC.nBottom - RetC.nTop), %TRUE  'move ocs 
       End If
       
      Case %WM_NOTIFY
       'init pointer values
       ptnmhdr = CblParam
       pRebar = CblParam
       Select Case @ptnmhdr.idFrom
        Case %ID_TABMAIN
         'get current tab
          Control Send CbHndl, %ID_TABMAIN, %TCM_GETCURSEL, 0, 0 To TabPage
          Select Case @ptnmhdr.code
           Case %TCN_SELCHANGING
            If TabPage = 0 Then   'changing from ocx to html page
             x = GetHtmlStream()
             Control Set Text hTab(1), %ID_HTML, x
             Control Set Focus hTab(1), %ID_HTML
             Call EnableToolBars(%FALSE)
            Else                  'changing from html to ocx page
             If IsTrue HTMLIsDirty Then
              HTMLIsDirty = %FALSE
              Control Get Text hTab(1), %ID_HTML To x     
              v = x
              Object Let oOcx.DocumentHTML = v
             End If
             Call EnableToolBars(%TRUE)
             SetFocus hOcx         
            End If 
            Dialog Show State hTab(TabPage), %SW_HIDE
         
           Case %TCN_SELCHANGE
            Dialog Show State hTab(TabPage), %SW_SHOW
          End Select
     
        Case %ID_REBAR
         If @pRebar.hdr.code = %RBN_HEIGHTCHANGE Then
          GetWindowRect hRebar, RetC
          hR = (RetC.nBottom - RetC.nTop)    'rebar height
         End If
        Case Else
         'show tooltip
         pToolTip = CblParam
         If @pToolTip.hdr.code = %TTN_NEEDTEXT Then
          szTipText = Lgs(@pToolTip.hdr.idFrom)
          @pToolTip.lpszText = VarPtr(szTipText)
          Function = 1
         End If
    
       End Select
        
     End Select
     
    End Function
    
    
    'messages for 1st tab
    CallBack Function Tab0Proc()
     Select Case CbMsg
    
      Case %WM_NOTIFY
       Select Case Cbctl
    
       End Select
      End Select
    End Function
    
    'messages for 2nd tab
    CallBack Function Tab1Proc()
     Select Case CbMsg
    
      Case %WM_NOTIFY
      Case %WM_COMMAND
       Select Case Cbctl
        Case %ID_HTML
         Select Case CbctlMsg
          Case %EN_CHANGE
           htmlIsDirty = %TRUE     'set flag
       
         End Select
    
       End Select
      End Select
    End Function
    
    
    'show dialog for sound background
    Sub ShowSoundDialog() 
     Local hDlgSound As Dword
     Dialog New 0, Lgs(118),,, 192, 90, %DS_SYSMODAL, %WS_EX_TOPMOST To hDlgSound
     Control Add Imagex, hDlgSound, - 1, "SND", 5, 5, 18, 18
     Control Add Label, hDlgSound, - 1, Lgs(119), 35, 5, 130, 10
     Control Add TextBox, hDlgSound, 100, "", 35, 15, 130, 12
     Control Add Button, hDlgSound, 110, "...", 165, 15, 15, 12
     Control Add Label, hDlgSound, - 1, Lgs(120), 35, 30, 130, 10
     Control Add TextBox, hDlgSound, 101, "1", 35, 40, 20, 12, %WS_TABSTOP Or %ES_NUMBER Or %SS_RIGHT, 
    
    %WS_EX_CLIENTEDGE
     Control Send hDlgSound, 101, %EM_SETLIMITTEXT, 4, 0
     Control Add Label, hDlgSound, - 1, Lgs(121), 62, 42, 100, 10
     Control Add Button, hDlgSound, %IDOK, "&Ok", 88, 56, 46, 14
     Control Add Button, hDlgSound, %IDCANCEL, Lgs(122), 134, 56, 46, 14
     Dialog Show Modal hDlgSOund Call DlgSoundCB
    End Sub
    
    CallBack Function DlgSoundCB
     Local fName As String, x As String 
     Select Case CbMsg
      Case %WM_COMMAND
       Select Case Cbctl
        Case %IDCANCEL
         Dialog End CbHndl, 0
        Case %IDOK
         Control Get Text CbHndl, 100 To fName
         If fName = "" Then
          Call AddRemoveBackSound("", "")  'remove sound
          Dialog End CbHndl, 0
         Else
          If Len(Dir$(fName)) = 0 Then
           MsgBoxApi CbHndl, Lgs(123), %MB_ICONEXCLAMATION, $APPTITLE
          Else
           Control Get Text CbHndl, 101 To x
           If Val(x) = 0 Then
            x = " volume=0 loop=infinite"
           ElseIf Val(x) > 1 Then
            x = " volume=0 loop=" + x
           Else
            x = " volume=0"
           End If
           Call AddRemoveBackSound(fName, x)
           Dialog End CbHndl, 0
          End If
         End If  
         
        Case 110  'browse for file
         fName = ""
         x = Lgs(108) + Lgs(109) + "|" + Lgs(110) + Lgs(111)
         OpenFileDialog CbHndl, Lgs(124), fName, CurDir$, x, "", %OFN_FILEMUSTEXIST
         Control Set Text CbHndl, 100, fName
    
      End Select   
     End Select
    End Function
    
    Sub ShowBackgroundDialog() 
     Local hDlgBackg As Dword
     Dialog New 0, Lgs(125),,, 192, 140, %DS_SYSMODAL, %WS_EX_TOPMOST To hDlgBackg
     Control Add Imagex, hDlgBackg, - 1, "IMG", 5, 5, 18, 18
     Control Add Label, hDlgBackg, - 1, Lgs(126), 35, 5, 130, 10
     Control Add TextBox, hDlgBackg, 100, "", 35, 15, 130, 12
     Control Add Button, hDlgBackg, 110, "...", 165, 15, 15, 12
     Control Add Frame, hDlgBackg, - 1, Lgs(127), 35, 30, 145, 73
     Control Add Option, hDlgBackg, 120, Lgs(128), 60, 43, 80, 10
     Control Add Option, hDlgBackg, 121, Lgs(129), 60, 54, 80, 10
     Control Add Option, hDlgBackg, 122, Lgs(130), 60, 65, 80, 10
     Control Add Option, hDlgBackg, 123, Lgs(131), 60, 76, 80, 10
     Control Add Option, hDlgBackg, 124, Lgs(132), 60, 87, 80, 10
     Control Set Check hDlgBackg, 120, 1
    
     Control Add Button, hDlgBackg, %IDOK, "&Ok", 88, 107, 46, 14
     Control Add Button, hDlgBackg, %IDCANCEL, Lgs(122), 134, 107, 46, 14
     Dialog Show Modal hDlgBackg Call DlgBackgCB
    End Sub
    
    CallBack Function DlgBackgCB
     Local fName As String
     Static Position As Long
     Select Case CbMsg
      Case %WM_INITDIALOG
       Position = 0
       
      Case %WM_COMMAND
       Select Case Cbctl
        Case %IDCANCEL
         Dialog End CbHndl, 0
        Case 120 To 124    'checkbox
         Position = Cbctl - 120
        
        Case %IDOK
         Control Get Text CbHndl, 100 To fName
         If fName = "" Then
    
          Call AddRemoveBackImage(fName, Position)  'remove
          Dialog End CbHndl, 0
    
         Else
          If Len(Dir$(fName)) = 0 Then
           MsgBoxApi CbHndl, Lgs(123), %MB_ICONEXCLAMATION, $APPTITLE
          Else
           Call AddRemoveBackImage(fName, Position)
           Dialog End CbHndl, 0
          End If
         End If  
    
        Case 110  'browse for file
         fName = ""
         If OpenFileDialog(CbHndl, Lgs(112), fName, CurDir$, Lgs(106) + Lgs(107), "", %OFN_FILEMUSTEXIST) Then
          Control Set Text CbHndl, 100, fName
         End If 
      End Select   
     End Select
    End Function
    ------------------


    [This message has been edited by Heber Jorge da Silva (edited March 28, 2005).]

    Comment


    • #3
      PASTE JUST AFTER 2nd CHUNK

      Code:
      'modify html body to insert/delete tags
      Sub AddRemoveBackImage(Byval fName As String, Byval Position As Long)
       Local html As String, x As String, k As String
       Local ImgAlign As String, ImgRepeat As String
       Dim BackImageParm(1 To 2) As String
       Local Body As String, NewBody As String, Sty As String, NewSty As String
       Local i As Long, j As Long, p As Long, n As Long
       Local v As Variant 
       
       BackImageParm(1) = "BACKGROUND-POSITION: "
       BackImageParm(2) = "BACKGROUND-REPEAT: "
       
       Select Case Position
        Case 1          'use as a header
         ImgAlign = "left top; "
         ImgRepeat = "repeat-x; "
        Case 2          'left margin 
         ImgAlign = "left top; "
         ImgRepeat = "repeat-y; "
        Case 3          'right margin
         ImgAlign = "right top; "
         ImgRepeat = "repeat-y; "
        Case 4          'footing
         ImgAlign = "right bottom; "
         ImgRepeat = "repeat-x; "
        Case 0
         'not needed
       End Select
       
       html = GetHtmlStream()
       i = Instr(UCase$(html), "<BODY")
       j = Instr(i, html, ">")
       Body = Mid$(html, i, j - i + 1)
       NewBody = Body
       x = "BACKGROUND"
       i = Instr(UCase$(NewBody), x)
       k = ""
      
       If i > 0 Then                'has already a backimage -- remove it
        p = Instr(i, NewBody, "=")  'may have several spaces before/after =
        Do
         Incr p
        Loop Until Mid$(NewBody, p, 1) <> " "
        j = Instr(p, NewBody, Any " >")
        k = Mid$(NewBody, i, j - i)  'get background tag
        If Instr(k, $Dq) > 0 And Tally(k, $Dq) = 1 Then  'quoted filename... may have blanks in name
         j = Instr(j, NewBody, $Dq)
         k = Mid$(NewBody, i, j - i + 1) 'get background tag
        End If
        NewBody = Remove$(NewBody, " " + k)
       End If
      
       'now remove former background parms, if exist
       i = Instr(UCase$(html), "<STYLE")
       If i > 1 Then
        Do
         Incr i
        Loop Until Mid$(html, i, 1) = ">"
        j = Instr(i, html, "</STYLE>") 'look 1st >
        If j > 0 Then
         Sty = Mid$(html, i, j - i)
         NewSty = Sty
         i = Instr(UCase$(Sty), "BODY")
         If i > 0 Then
          Sty = Trim$(Mid$(Sty, i + 5))
          NewSty = Sty
          For n = 1 To 2
           i = Instr(UCase$(NewSty), BackImageParm(n))
           If i > 0 Then    'remove...
            k = BackImageParm(n)
            p = i + Len(BackImageParm(n))
            Do
             x = Mid$(NewSty, p, 1)
             k = k + x
             Incr p
            Loop Until x = ";"   'wait for a ; or spc
            NewSty = Remove$(NewSty, k)    'remove position/repeat tags
           End If         
          Next
         End If
        End If  
       End If
         
       If fName <> "" Then
        'insert new backimage if exists
        NewBody = Left$(NewBody, 5) + " BACKGROUND=" + $Dq + fName + $Dq + Mid$(NewBody, 6)
        If ImgAlign <> "" Then
         If NewSty <> "" Then  'body { already in there
          NewSty = Left$(NewSty, 1) + BackImageParm(1) + ImgAlign + BackImageParm(2) + ImgRepeat + Mid$(NewSty, 2)
         End If 
        End If
       End If 
        
       'put in html stream          
       Replace Sty With NewSty In html   
       Replace Body With NewBody In html     
       v = html
       Object Let oOcx.DocumentHtml = v
       UpdateWindow hOcx 
       SetFocus hOcx 
      End Sub
      
      
      'modify html body to insert/delete tags
      Sub AddRemoveBackSound(Byval fName As String, Byval SoundParms As String)
       Local html As String, x As String
       Local i As Long, j As Long, p As Long
       Local v As Variant 
       html = GetHtmlStream()
       i = Instr(UCase$(html), "<BODY")
       If i > 1 Then
        i = Instr(i, html, ">")   'end of Body tag - sound insertion point
        j = Instr(UCase$(html), "<BGSOUND")
        If j > 0 Then   'already has bgsoung
         p = Instr(j, html, ">")
         x = Mid$(html, j, p - j + 1)  'sound string
         html = Remove$(html, x)       'remove from html
        End If
        If fname <> "" And SoundParms <> "" Then
         html = Left$(html, i) + "<BGSOUND balance=0 src=" + $Dq + fname + $Dq + SoundParms + ">" + Mid$(html, i + 
      
      1)
        End If 
      
        'put in html stream          
        v = html
        Object Let oOcx.DocumentHtml = v
        UpdateWindow hOcx 
        SetFocus hOcx 
       End If
      End Sub
      
      'carrega msg e trata segundo a linngua
      Function Lgs(Byval Nr As Long) As String
       Local zT As Asciiz * 255, x As String
       LoadString hInst, Nr, zT, SizeOf(zT)
       If Instr(zT, "@") Then
        x = Parse$(zT, "@", Lg + 1) 'parseia língua
       Else
        x = zT 'string comum para todas as línguas
       End If
       Function = x
      End Function
      
      'retrieve country code
      '0=port, 1=english, ...
      Function GetLocaleCode() As Long
       Local RetVal As Long
       Local szLangID As Asciiz * 5
       GetLocaleInfo %LOCALE_USER_DEFAULT, %LOCALE_ILANGUAGE, szLangID, SizeOf(szLangID)
       Select Case Val(szLangID)
        Case 416, 816
         RetVal = 0   'portuguese
        Case 409, 809 'english
         RetVal = 1
        Case Else
         RetVal = 1  'default=english
       End Select
       Function = RetVal
      End Function
      
      'build menu bar
      Sub BuildMenu(Byval hDlg As Dword)
       Local hPopFiles As Dword, hPopEdit As Dword, hPopInsert As Dword, hPopFormat As Dword, _
             hPopPositioning As Dword, hPopHelp As Dword ', hPopTable As Dword
       
       hMenu = CreateMenu
       'FILE
       hPopFiles = CreatePopupMenu
       AppendMenu hMenu, %MF_POPUP Or %MF_ENABLED, hPopFiles, Lgs(150)
       AppendMenu hPopFiles, %MF_ENABLED, %IDM_NEW, Lgs(%IDM_NEW)
       AppendMenu hPopFiles, %MF_ENABLED, %IDM_OPEN, Lgs(%IDM_OPEN)
       AppendMenu hPopFiles, %MF_ENABLED, %IDM_SAVE, Lgs(%IDM_SAVE)
       AppendMenu hPopFiles, %MF_ENABLED, %IDM_SAVEAS, Lgs(%IDM_SAVEAS)
       AppendMenu hPopFiles, %MF_SEPARATOR Or %MF_OWNERDRAW, 0, ""
       AppendMenu hPopFiles, %MF_ENABLED, %IDM_PRINT, Lgs(%IDM_PRINT)
       AppendMenu hPopFiles, %MF_SEPARATOR Or %MF_OWNERDRAW, 0, ""
       AppendMenu hPopFiles, %MF_ENABLED, %IDM_EXIT, Lgs(%IDM_EXIT)
       'Make all menu items ownerdrawn
       ModifyMenu hPopFiles, %IDM_NEW, %MF_OWNERDRAW, %IDM_NEW, Byval %Null
       ModifyMenu hPopFiles, %IDM_OPEN, %MF_OWNERDRAW, %IDM_OPEN, Byval %Null
       ModifyMenu hPopFiles, %IDM_SAVE, %MF_OWNERDRAW, %IDM_SAVE, Byval %Null
       ModifyMenu hPopFiles, %IDM_SAVEAS, %MF_OWNERDRAW, %IDM_SAVEAS, Byval %Null
       ModifyMenu hPopFiles, %IDM_PRINT, %MF_OWNERDRAW, %IDM_PRINT, Byval %Null
       ModifyMenu hPopFiles, %IDM_EXIT, %MF_OWNERDRAW, %IDM_EXIT, Byval %Null
      
       'EDIT
       hPopEdit = CreatePopupMenu
       AppendMenu hMenu, %MF_POPUP Or %MF_ENABLED, hPopEdit, Lgs(151)
       AppendMenu hPopEdit, %MF_ENABLED, %IDM_FIND, Lgs(%IDM_FIND)
       AppendMenu hPopEdit, %MF_SEPARATOR Or %MF_OWNERDRAW, 0, ""
       AppendMenu hPopEdit, %MF_ENABLED, %IDM_UNDO, Lgs(%IDM_UNDO)
       AppendMenu hPopEdit, %MF_ENABLED, %IDM_REDO, Lgs(%IDM_REDO)
       AppendMenu hPopEdit, %MF_SEPARATOR Or %MF_OWNERDRAW, 0, ""
       AppendMenu hPopEdit, %MF_ENABLED, %IDM_COPY, Lgs(%IDM_COPY)
       AppendMenu hPopEdit, %MF_ENABLED, %IDM_CUT, Lgs(%IDM_CUT)
       AppendMenu hPopEdit, %MF_ENABLED, %IDM_PASTE, Lgs(%IDM_PASTE)
       AppendMenu hPopEdit, %MF_SEPARATOR Or %MF_OWNERDRAW, 0, ""
       AppendMenu hPopEdit, %MF_ENABLED, %IDM_TEXTFORECOLOR, Lgs(%IDM_TEXTFORECOLOR)
       AppendMenu hPopEdit, %MF_ENABLED, %IDM_TEXTBACKCOLOR, Lgs(%IDM_TEXTBACKCOLOR)
       AppendMenu hPopEdit, %MF_ENABLED, %IDM_BACKCOLOR, Lgs(%IDM_BACKCOLOR)
       AppendMenu hPopEdit, %MF_ENABLED, %IDM_BACKSOUND, Lgs(%IDM_BACKSOUND)
       AppendMenu hPopEdit, %MF_ENABLED, %IDM_BACKIMAGE, Lgs(%IDM_BACKIMAGE)
       AppendMenu hPopEdit, %MF_SEPARATOR Or %MF_OWNERDRAW, 0, ""
       AppendMenu hPopEdit, %MF_ENABLED, %IDM_SELALL, Lgs(%IDM_SELALL)
       'Make all menu items ownerdrawn
       ModifyMenu hPopEdit, %IDM_FIND, %MF_OWNERDRAW, %IDM_FIND, Byval %Null
       ModifyMenu hPopEdit, %IDM_UNDO, %MF_OWNERDRAW, %IDM_UNDO, Byval %Null
       ModifyMenu hPopEdit, %IDM_REDO, %MF_OWNERDRAW, %IDM_REDO, Byval %Null
       ModifyMenu hPopEdit, %IDM_COPY, %MF_OWNERDRAW, %IDM_COPY, Byval %Null
       ModifyMenu hPopEdit, %IDM_CUT, %MF_OWNERDRAW, %IDM_CUT, Byval %Null
       ModifyMenu hPopEdit, %IDM_PASTE, %MF_OWNERDRAW, %IDM_PASTE, Byval %Null
       ModifyMenu hPopEdit, %IDM_TEXTFORECOLOR, %MF_OWNERDRAW, %IDM_TEXTFORECOLOR, Byval %Null
       ModifyMenu hPopEdit, %IDM_TEXTBACKCOLOR, %MF_OWNERDRAW, %IDM_TEXTBACKCOLOR, Byval %Null
       ModifyMenu hPopEdit, %IDM_BACKCOLOR, %MF_OWNERDRAW, %IDM_BACKCOLOR, Byval %Null
       ModifyMenu hPopEdit, %IDM_BACKSOUND, %MF_OWNERDRAW, %IDM_BACKSOUND, Byval %Null
       ModifyMenu hPopEdit, %IDM_BACKIMAGE, %MF_OWNERDRAW, %IDM_BACKIMAGE, Byval %Null
       ModifyMenu hPopEdit, %IDM_SELALL, %MF_OWNERDRAW, %IDM_SELALL, Byval %Null
       
       'INSERT
       hPopInsert = CreatePopupMenu
       AppendMenu hMenu, %MF_POPUP Or %MF_ENABLED, hPopInsert, Lgs(152)
       AppendMenu hPopInsert, %MF_ENABLED, %IDM_IMAGE, Lgs(%IDM_IMAGE)
       AppendMenu hPopInsert, %MF_ENABLED, %IDM_HTML, Lgs(%IDM_HTML)
       AppendMenu hPopInsert, %MF_ENABLED, %IDM_LINE, Lgs(%IDM_LINE)
       AppendMenu hPopInsert, %MF_ENABLED, %IDM_HYPERLINK, Lgs(%IDM_HYPERLINK)
       'Make all menu items ownerdrawn
       ModifyMenu hPopInsert, %IDM_IMAGE, %MF_OWNERDRAW, %IDM_IMAGE, Byval %Null
       ModifyMenu hPopInsert, %IDM_HTML, %MF_OWNERDRAW, %IDM_HTML, Byval %Null
       ModifyMenu hPopInsert, %IDM_LINE, %MF_OWNERDRAW, %IDM_LINE, Byval %Null
       ModifyMenu hPopInsert, %IDM_HYPERLINK, %MF_OWNERDRAW, %IDM_HYPERLINK, Byval %Null
      
       'TABLE
       'hPopTable = CreatePopupMenu
       'AppendMenu hMenu, %MF_POPUP Or %MF_ENABLED, hPopTable, "&Tabela"
       'AppendMenu hPopTable, %MF_ENABLED, %IDM_TABLE, "Inserir &tabela"
       'AppendMenu hPopTable, %MF_SEPARATOR Or %MF_OWNERDRAW, 0, ""
       'AppendMenu hPopTable, %MF_DISABLED, %IDM_TABINSLINE, "Inserir &linha"
       'AppendMenu hPopTable, %MF_DISABLED, %IDM_TABINSCOL, "Inserir &coluna"
       'AppendMenu hPopTable, %MF_DISABLED, %IDM_TABINSCELL, "Inserir célul&a"
       'AppendMenu hPopTable, %MF_SEPARATOR Or %MF_OWNERDRAW, 0, ""
       'AppendMenu hPopTable, %MF_DISABLED, %IDM_TABREMLINE, "&Remover linha"
       'AppendMenu hPopTable, %MF_DISABLED, %IDM_TABREMCOL, "Re&mover coluna"
       'AppendMenu hPopTable, %MF_DISABLED, %IDM_TABREMCELL, "Remo&ver célula"
       'AppendMenu hPopTable, %MF_SEPARATOR Or %MF_OWNERDRAW, 0, ""
       'AppendMenu hPopTable, %MF_DISABLED, %IDM_TABJOINCELLS, "&Juntar células"
       'AppendMenu hPopTable, %MF_DISABLED, %IDM_TABDIVCELLS, "&Dividir células"
       ''Make all menu items ownerdrawn
       'ModifyMenu hPopTable, %IDM_TABLE, %MF_OWNERDRAW, %IDM_TABLE, Byval %Null
       'ModifyMenu hPopTable, %IDM_TABLE, %MF_OWNERDRAW, %IDM_TABLE, Byval %Null
       'ModifyMenu hPopTable, %IDM_TABINSLINE, %MF_OWNERDRAW, %IDM_TABINSLINE, Byval %Null
       'ModifyMenu hPopTable, %IDM_TABINSCOL, %MF_OWNERDRAW, %IDM_TABINSCOL, Byval %Null
       'ModifyMenu hPopTable, %IDM_TABINSCELL, %MF_OWNERDRAW, %IDM_TABINSCELL, Byval %Null
       'ModifyMenu hPopTable, %IDM_TABREMLINE, %MF_OWNERDRAW, %IDM_TABREMLINE, Byval %Null
       'ModifyMenu hPopTable, %IDM_TABREMCOL, %MF_OWNERDRAW, %IDM_TABREMCOL, Byval %Null
       'ModifyMenu hPopTable, %IDM_TABREMCELL, %MF_OWNERDRAW, %IDM_TABREMCELL, Byval %Null
       'ModifyMenu hPopTable, %IDM_TABJOINCELLS, %MF_OWNERDRAW, %IDM_TABJOINCELLS, Byval %Null
       'ModifyMenu hPopTable, %IDM_TABDIVCELLS, %MF_OWNERDRAW, %IDM_TABDIVCELLS, Byval %Null
      
       'FORMAT
       hPopFormat = CreatePopupMenu
       AppendMenu hMenu, %MF_POPUP Or %MF_ENABLED, hPopFormat, Lgs(153)
       AppendMenu hPopFormat, %MF_ENABLED, %IDM_NORMAL, Lgs(%IDM_NORMAL)
       AppendMenu hPopFormat, %MF_ENABLED, %IDM_FORMATTED, Lgs(%IDM_FORMATTED)
       AppendMenu hPopFormat, %MF_ENABLED, %IDM_ADDRESS, Lgs(%IDM_ADDRESS)
       AppendMenu hPopFormat, %MF_ENABLED, %IDM_TIT1, Lgs(%IDM_TIT1)
       AppendMenu hPopFormat, %MF_ENABLED, %IDM_TIT2, Lgs(%IDM_TIT2)
       AppendMenu hPopFormat, %MF_ENABLED, %IDM_TIT3, Lgs(%IDM_TIT3)
       AppendMenu hPopFormat, %MF_ENABLED, %IDM_TIT4, Lgs(%IDM_TIT4)
       AppendMenu hPopFormat, %MF_ENABLED, %IDM_TIT5, Lgs(%IDM_TIT5)
       AppendMenu hPopFormat, %MF_ENABLED, %IDM_TIT6, Lgs(%IDM_TIT6)
       AppendMenu hPopFormat, %MF_SEPARATOR Or %MF_OWNERDRAW, 0, ""
       AppendMenu hPopFormat, %MF_ENABLED, %IDM_ORDERLIST, Lgs(%IDM_ORDERLIST)
       AppendMenu hPopFormat, %MF_ENABLED, %IDM_UNORDERLIST, Lgs(%IDM_UNORDERLIST)
       AppendMenu hPopFormat, %MF_ENABLED, %IDM_DIRLIST, Lgs(%IDM_DIRLIST)
       AppendMenu hPopFormat, %MF_ENABLED, %IDM_MENULIST, Lgs(%IDM_MENULIST)
       AppendMenu hPopFormat, %MF_SEPARATOR Or %MF_OWNERDRAW, 0, ""
       AppendMenu hPopFormat, %MF_ENABLED, %IDM_DEFTERM, Lgs(%IDM_DEFTERM)
       AppendMenu hPopFormat, %MF_ENABLED, %IDM_DEFINITION, Lgs(%IDM_DEFINITION)
       AppendMenu hPopFormat, %MF_ENABLED, %IDM_PARAGRAPH, Lgs(%IDM_PARAGRAPH)
       'Make all menu items ownerdrawn
       ModifyMenu hPopFormat, %IDM_NORMAL, %MF_OWNERDRAW, %IDM_NORMAL, Byval %Null
       ModifyMenu hPopFormat, %IDM_FORMATTED, %MF_OWNERDRAW, %IDM_FORMATTED, Byval %Null
       ModifyMenu hPopFormat, %IDM_ADDRESS, %MF_OWNERDRAW, %IDM_ADDRESS, Byval %Null
       ModifyMenu hPopFormat, %IDM_TIT1, %MF_OWNERDRAW, %IDM_TIT1, Byval %Null
       ModifyMenu hPopFormat, %IDM_TIT2, %MF_OWNERDRAW, %IDM_TIT2, Byval %Null
       ModifyMenu hPopFormat, %IDM_TIT3, %MF_OWNERDRAW, %IDM_TIT3, Byval %Null
       ModifyMenu hPopFormat, %IDM_TIT4, %MF_OWNERDRAW, %IDM_TIT4, Byval %Null
       ModifyMenu hPopFormat, %IDM_TIT5, %MF_OWNERDRAW, %IDM_TIT5, Byval %Null
       ModifyMenu hPopFormat, %IDM_TIT6, %MF_OWNERDRAW, %IDM_TIT6, Byval %Null
       ModifyMenu hPopFormat, %IDM_ORDERLIST, %MF_OWNERDRAW, %IDM_ORDERLIST, Byval %Null
       ModifyMenu hPopFormat, %IDM_UNORDERLIST, %MF_OWNERDRAW, %IDM_UNORDERLIST, Byval %Null
       ModifyMenu hPopFormat, %IDM_DIRLIST, %MF_OWNERDRAW, %IDM_DIRLIST, Byval %Null
       ModifyMenu hPopFormat, %IDM_MENULIST, %MF_OWNERDRAW, %IDM_MENULIST, Byval %Null
       ModifyMenu hPopFormat, %IDM_DEFTERM, %MF_OWNERDRAW, %IDM_DEFTERM, Byval %Null
       ModifyMenu hPopFormat, %IDM_DEFINITION, %MF_OWNERDRAW, %IDM_DEFINITION, Byval %Null
       ModifyMenu hPopFormat, %IDM_PARAGRAPH, %MF_OWNERDRAW, %IDM_PARAGRAPH, Byval %Null
      
       'Positioning
       hPopPositioning = CreatePopupMenu
       AppendMenu hMenu, %MF_POPUP Or %MF_ENABLED, hPopPositioning, Lgs(154)
       AppendMenu hPopPositioning, %MF_ENABLED, %IDM_MAKEABSOLUTE, Lgs(%IDM_MAKEABSOLUTE)
       AppendMenu hPopPositioning, %MF_ENABLED, %IDM_SENDTOTOP, Lgs(%IDM_SENDTOTOP)
       AppendMenu hPopPositioning, %MF_ENABLED, %IDM_SENDTOBOTTOM, Lgs(%IDM_SENDTOBOTTOM)
       AppendMenu hPopPositioning, %MF_ENABLED, %IDM_BRINGTOFRONT, Lgs(%IDM_BRINGTOFRONT)
       AppendMenu hPopPositioning, %MF_ENABLED, %IDM_SENDTOBACK, Lgs(%IDM_SENDTOBACK)
       AppendMenu hPopPositioning, %MF_SEPARATOR Or %MF_OWNERDRAW, 0, ""
       AppendMenu hPopPositioning, %MF_ENABLED, %IDM_ABOVETEXT, Lgs(%IDM_ABOVETEXT)
       AppendMenu hPopPositioning, %MF_ENABLED, %IDM_BELOWTEXT, Lgs(%IDM_BELOWTEXT)
       AppendMenu hPopPositioning, %MF_SEPARATOR Or %MF_OWNERDRAW, 0, ""
       AppendMenu hPopPositioning, %MF_ENABLED, %IDM_LOCKITEM, Lgs(%IDM_LOCKITEM)
       'Make all menu items ownerdrawn
       ModifyMenu hPopPositioning, %IDM_MAKEABSOLUTE, %MF_OWNERDRAW, %IDM_MAKEABSOLUTE, Byval %Null
       ModifyMenu hPopPositioning, %IDM_SENDTOTOP, %MF_OWNERDRAW, %IDM_SENDTOTOP, Byval %Null
       ModifyMenu hPopPositioning, %IDM_SENDTOBOTTOM, %MF_OWNERDRAW, %IDM_SENDTOBOTTOM, Byval %Null
       ModifyMenu hPopPositioning, %IDM_BRINGTOFRONT, %MF_OWNERDRAW, %IDM_BRINGTOFRONT, Byval %Null
       ModifyMenu hPopPositioning, %IDM_SENDTOBACK, %MF_OWNERDRAW, %IDM_SENDTOBACK, Byval %Null
       ModifyMenu hPopPositioning, %IDM_ABOVETEXT, %MF_OWNERDRAW, %IDM_ABOVETEXT, Byval %Null
       ModifyMenu hPopPositioning, %IDM_BELOWTEXT, %MF_OWNERDRAW, %IDM_BELOWTEXT, Byval %Null
       ModifyMenu hPopPositioning, %IDM_LOCKITEM, %MF_OWNERDRAW, %IDM_LOCKITEM, Byval %Null
      
       
       hPopHelp = CreatePopupMenu
       AppendMenu hMenu, %MF_POPUP Or %MF_ENABLED, hPopHelp, Lgs(155)
       AppendMenu hPopHelp, %MF_ENABLED, %IDM_CONTENTS, Lgs(%IDM_CONTENTS)
       AppendMenu hPopHelp, %MF_ENABLED, %IDM_USING, Lgs(%IDM_USING)
       AppendMenu hPopHelp, %MF_SEPARATOR Or %MF_OWNERDRAW, 0, ""
       AppendMenu hPopHelp, %MF_ENABLED, %IDM_ABOUT, Lgs(%IDM_ABOUT)
       'Make all menu items ownerdrawn
       ModifyMenu hPopHelp, %IDM_CONTENTS, %MF_OWNERDRAW, %IDM_CONTENTS, Byval %Null
       ModifyMenu hPopHelp, %IDM_USING, %MF_OWNERDRAW, %IDM_USING, Byval %Null
       ModifyMenu hPopHelp, %IDM_ABOUT, %MF_OWNERDRAW, %IDM_ABOUT, Byval %Null
      
       SetMenu hDlg, hMenu 
      
       'set initial state
       Menu Set State hMenu, Bycmd %IDM_SAVE, %MF_DISABLED
       Menu Set State hMenu, Bycmd %IDM_SAVEAS, %MF_DISABLED
       Menu Set State hMenu, Bycmd %IDM_PRINT, %MF_DISABLED
      
       Menu Set State hMenu, Bycmd %IDM_FIND, %MF_DISABLED
       Menu Set State hMenu, Bycmd %IDM_UNDO, %MF_DISABLED
       Menu Set State hMenu, Bycmd %IDM_REDO, %MF_DISABLED
       Menu Set State hMenu, Bycmd %IDM_COPY, %MF_DISABLED
       Menu Set State hMenu, Bycmd %IDM_CUT, %MF_DISABLED
       Menu Set State hMenu, Bycmd %IDM_PASTE, %MF_DISABLED
       Menu Set State hMenu, Bycmd %IDM_SELALL, %MF_DISABLED
      
      ' Menu Set State hMenu, Bycmd %IDM_TABINSLINE, %MF_DISABLED
      ' Menu Set State hMenu, Bycmd %IDM_TABINSCOL, %MF_DISABLED
      ' Menu Set State hMenu, Bycmd %IDM_TABINSCELL, %MF_DISABLED
      ' Menu Set State hMenu, Bycmd %IDM_TABREMLINE, %MF_DISABLED
      ' Menu Set State hMenu, Bycmd %IDM_TABREMCOL, %MF_DISABLED
      ' Menu Set State hMenu, Bycmd %IDM_TABREMCELL, %MF_DISABLED
      ' Menu Set State hMenu, Bycmd %IDM_TABJOINCELLS, %MF_DISABLED
      ' Menu Set State hMenu, Bycmd %IDM_TABDIVCELLS, %MF_DISABLED
      
      End Sub
      
      
      ' Sub Routine : DrawMenuItem ()
      ' Description : Draw Owner Drawn Menu Items - called from the %WM_DRAITEM message
      Sub DrawMenuItem(Byref lp As Long)
       Register c As Long ' for/next counter
       Local ShortCutWidth As Long ' for ShortCut text width (if any)
       Local id As Long ' tmp item id
       Local BmpNum As Long ' bitmap number
       Local hBmp As Long ' icon to draw
       Local hBrush As Long ' brush used for selection draw
       Local bHighlight As Long ' higlighted flag
       Local drawTxtFlags As Dword ' how we draw the text
       Local drawBmpFlags As Dword ' how we draw the icon
       Local menuBtnW As Long ' Width of the menubutton, in pixels
       Local sCaption As String ' string for the menu item text
       Local sShortCut As String ' string for eventual shortcut text
       Local rc As RECT ' RECT used for drawing areas
       Local szl As SIZEL ' used to calculate text extent
       Local lpDis As DRAWITEMSTRUCT Ptr ' we fill this from received pointer
       
       Local bGrayed As Long
       Local bDisabled As Long
       
       Local nState As Long ' For ImageList Bitmap Strip ID.
       
       lpDis = lp ' Get structure from given pointer
       menuBtnW = GetSystemMetrics(%SM_CYMENU) - 1 ' for "button" size
       
       '----------------------------------------------------------------------------
       ' Calculate pos for eventual shortcut. We need to look at all items
       ' in dropped menu and calculate largest width, which then is used
       ' as base to calculate all shortcuts' pos.
       '----------------------------------------------------------------------------
      
       For c = 0 To GetMenuItemCount(@lpDis.hwndItem) - 1 ' hwndItem is dropped menu's handle
        id = GetMenuItemID(@lpDis.hwndItem, c)
        If id Then
         sCaption = GetMenuTextAndBitmap(id, 0)
         If Instr(sCaption, $Tab) Then ' if it has shortcut (Ctrl+X, etc.)
          sShortCut = Trim$(Parse$(sCaption, $Tab, 2))
         Else
          sShortCut = ""
         End If
         
         If Len(sShortCut) Then
          GetTextExtentPoint32 @lpDis.hDC, Byval StrPtr(sShortCut), _
                               Len(sShortCut), Byval VarPtr(szl)
          ShortCutWidth = Max&(ShortCutWidth, szl.Cx)
         End If
        End If
       Next
       
       ' Get menu item string and split up into ev. text and shortcut part.
       sCaption = GetMenuTextAndBitmap(@lpDis.itemID, BmpNum)
       
       If Instr(sCaption, $Tab) Then ' if it has shortcut (Ctrl+X, etc.)
        '      sShortCut = TRIM$(PARSE$(sCaption, $TAB, 2))
        sShortCut = Parse$(sCaption, $Tab, 2)
        sCaption = Trim$(Parse$(sCaption, $Tab, 1))
       Else
        '      sCaption = TRIM$(sCaption)
        sCaption = sCaption
        sShortCut = ""
       End If
       
       ' Calculate menu item string's height.
       GetTextExtentPoint32 @lpDis.hDC, Byval StrPtr(sCaption), Len(sCaption), szl
       
       ' Set up colors depending on what drawing actions we need to take.
       If (@lpDis.itemState And %ODS_SELECTED) Then ' menu item is selected
        nState = %IMG_HOT
        hBrush = hMenuHiBrush
        SetBkColor @lpDis.hDC, GetSysColor(%COLOR_HIGHLIGHT)
        SetTextColor @lpDis.hDC, GetSysColor(%COLOR_HIGHLIGHTTEXT)
        bHighlight = %TRUE ' flag, so later we can add or remove the 3D edge around the icon
        ' Selected but grayed or disabled
        If (@lpDis.itemState And %ODS_GRAYED) Then
         nState = %IMG_DIS
         bGrayed = %TRUE
        ElseIf (@lpDis.itemState And %ODS_DISABLED) Then
         nState = %IMG_DIS
         bDisabled = %TRUE
        End If
       ElseIf (@lpDis.itemState And %ODS_GRAYED) Then ' menu item is grayed
        nState = %IMG_DIS
        hBrush = GetSysColorBrush(%COLOR_MENU)
        SetBkColor @lpDis.hDC, GetSysColor(%COLOR_MENU)
        SetTextColor @lpDis.hDC, GetSysColor(%COLOR_MENUTEXT)
        bGrayed = %TRUE
       ElseIf (@lpDis.itemState And %ODS_DISABLED) Then ' menu item is disabled
        nState = %IMG_DIS
        hBrush = GetSysColorBrush(%COLOR_MENU)
        SetBkColor @lpDis.hDC, GetSysColor(%COLOR_MENU)
        SetTextColor @lpDis.hDC, GetSysColor(%COLOR_MENUTEXT)
        bDisabled = %TRUE
       Else ' not selected or disabled
        nState = %IMG_NOR
        hBrush = GetSysColorBrush(%COLOR_MENU)
        SetBkColor @lpDis.hDC, GetSysColor(%COLOR_MENU)
        SetTextColor @lpDis.hDC, GetSysColor(%COLOR_MENUTEXT)
       End If
       
       drawTxtFlags = %DST_PREFIXTEXT
       drawBmpFlags = %DST_BITMAP
       
       If IsTrue bGrayed Or IsTrue bDisabled Then ' if grayed or disabled item
        If (@lpDis.itemState And %ODS_SELECTED) Then ' if it's selected
         SetTextColor @lpDis.hDC, GetSysColor(%COLOR_GRAYTEXT)
        Else
         drawTxtFlags = drawTxtFlags Or %DSS_DISABLED
        End If
       End If
       
       '----------------------------------------------------------------------------
       ' Calculate rect for highlight area (selected item) and fill rect with proper
       ' color, either COLOR_MENU or COLOR_HIGHLIGHT, depending on selection state.
       '----------------------------------------------------------------------------
       rc = @lpDis.rcItem
       
       If IsTrue bGrayed Or IsTrue bDisabled Or BmpNum = -1 Then ' grayed or no bitmap
        rc.nLeft = 0
       Else
        rc.nLeft = menuBtnW + 4 ' enabled, with bitmap
       End If
       
       ' For GRAYED With Bitmap.
       If IsTrue bGrayed Or IsTrue bDisabled Then
        If BmpNum = > 0 Then
         rc.nLeft = menuBtnW + 4
         hBrush = GetSysColorBrush(%COLOR_MENU)
         drawTxtFlags = drawTxtFlags Or %DSS_DISABLED
        End If
       End If
       
       FillRect @lpDis.hDC, rc, hBrush
       
       If @lpDis.itemId = 0 Or @lpDis.itemId = %IDM_SEPARATOR Then  ' Separator
        rc.nLeft = menuBtnW + 4
        FillRect @lpDis.hDC, rc, hMenuTextBkBrush 
        rc.nLeft = rc.nLeft + 4 
        rc.nTop = rc.nTop + (rc.nBottom - rc.nTop) \ 2
        DrawEdge @lpdis.hDC, rc, %EDGE_ETCHED, %BF_TOP
        Exit Sub
       End If
       
       ' Draw the disabled bitmap.
       If IsTrue bGrayed Or IsTrue bDisabled Then
        ' Draw Disabled Bitmap.
        If BmpNum = > 0 Then hBmp = GetMenuBmpHandle(BmpNum, nState)
        If nState = %IMG_DIS Then
         ImageList_DrawEx(hImlDis, BmpNum, @lpDis.hDC, ((menuBtnW + 3) \ 2) - 8, _
                                   ((@lpDis.rcItem.nTop + @lpDis.rcItem.nBottom) \ 2) - 8, _
                                   16, 16, %CLR_NONE, %CLR_NONE, %ILD_TRANSPARENT)
        End If
       End If
       
       'Draw the bitmap "button", if item is not grayed out (disabled).
       'ImageList Draw Style Constants:  %IMG_DIS = 0 : %IMG_NOR = 1 : %IMG_HOT = 2
       If (@lpdis.itemState And %ODS_CHECKED) Then
        ' Make adjustments for checked items
        BmpNum = %OMENU_CHECKEDICON 
        hBmp = GetMenuBmpHandle(%OMENU_CHECKEDICON, nState)
        nState = %IMG_NOR
       Else
        If BmpNum = > 0 Then hBmp = GetMenuBmpHandle(BmpNum, nState)
       End If
       
       If hBmp <> 0 Then ' Draw bitmap, centered in "button"
        If nState = %IMG_NOR Then
         ImageList_DrawEx(hImlNor, BmpNum, @lpDis.hDC, ((menuBtnW + 3) \ 2) - 8, _
                                   ((@lpDis.rcItem.nTop + @lpDis.rcItem.nBottom) \ 2) - 8, _
                                   16, 16, %CLR_NONE, %CLR_NONE, %ILD_TRANSPARENT)
        ElseIf nState = %IMG_HOT Then
         ImageList_DrawEx(hImlHot, BmpNum, @lpDis.hDC, ((menuBtnW + 3) \ 2) - 8, _
                                   ((@lpDis.rcItem.nTop + @lpDis.rcItem.nBottom) \ 2) - 8, _
                                   16, 16, %CLR_NONE, %CLR_NONE, %ILD_TRANSPARENT)
      
        ElseIf nState = %IMG_DIS Then
         ImageList_DrawEx(hImlDis, BmpNum, @lpDis.hDC, ((menuBtnW + 3) \ 2) - 8, _
                                   ((@lpDis.rcItem.nTop + @lpDis.rcItem.nBottom) \ 2) - 8, _
                                   16, 16, %CLR_NONE, %CLR_NONE, %ILD_TRANSPARENT)
        End If
        
        ' Calculate the RECT we need for the 3D edge.
        rc = @lpDis.rcItem
        rc.nLeft = 0 ' Size and pos for "button"..
        rc.nRight = menuBtnW + 4
        rc.nBottom = rc.nTop + GetSystemMetrics(%SM_CYMENU) + 1
        
        ' Draw "button" flat
        DrawEdge @lpDis.hDC, rc, %BDR_RAISEDINNER, %BF_FLAT Or %BF_RECT
       End If
       
       DeleteObject hBmp ' Delete the bitmap when done, to avoid memory leaks!
       
       ' Draw the menu text next to bitmap button, with centered y-pos.
       rc = @lpDis.rcItem
       rc.nLeft = menuBtnW + 4 : rc.nRight = @lpDis.rcItem.nRight
       rc.nTop = rc.nTop + ((rc.nBottom - rc.nTop) - szl.cy) \ 2
       '   rc.nTop = rc.nTop - 3
       rc.nTop = rc.nTop - 4
       If IsTrue bHighlight Then
        FillRect @lpDis.hDC, rc, hMenuHiBrush
        If IsTrue bGrayed Or IsTrue bDisabled Then
         SetTextColor @lpdis.hDC, GetSysColor(%COLOR_GRAYTEXT)
        Else
         SetTextColor @lpdis.hDC, Rgb(0, 0, 0)
        End If
        'Draw frame using custom colored pen
        MoveToEx @lpdis.hDC, @lpdis.rcItem.nLeft, @lpdis.rcItem.nTop, Byval 0
        LineTo @lpdis.hDC, @lpdis.rcItem.nRight - 1, @lpdis.rcItem.nTop
        LineTo @lpdis.hDC, @lpdis.rcItem.nRight - 1, @lpdis.rcItem.nBottom - 1
        LineTo @lpdis.hDC, @lpdis.rcItem.nLeft, @lpdis.rcItem.nBottom - 1
        LineTo @lpdis.hDC, @lpdis.rcItem.nLeft, @lpdis.rcItem.nTop
       ElseIf IsTrue bGrayed Or IsTrue bDisabled Then
        FillRect @lpDis.hDC, rc, hMenuTextBkBrush
        SetTextColor @lpdis.hDC, GetSysColor(%COLOR_GRAYTEXT)
       Else
        FillRect @lpDis.hDC, rc, hMenuTextBkBrush
        SetTextColor @lpdis.hDC, Rgb(0, 0, 0)
       End If
       SetBkMode @lpdis.hDC, %TRANSPARENT
       rc.nTop = rc.nTop + 3
       rc.nLeft = menuBtnW + 8
       DrawState @lpDis.hDC, hMenuTextBkBrush, 0, Byval StrPtr(sCaption), Len(sCaption), _
                 rc.nLeft, rc.nTop, rc.nRight, szl.cy, drawTxtFlags
       If ShortCutWidth Then ' if there's shortcut text (Ctrl+N, etc)
       DrawState @lpDis.hDC, 0, 0, Byval StrPtr(sShortCut), Len(sShortCut), _
                  @lpDis.rcItem.nRight - ShortCutWidth - 8, rc.nTop, _
                  rc.nRight, szl.cy, drawTxtFlags
       End If
       
      End Sub
      
      ' Sub Routine : MeasureMenu ()
      ' Description : Called form the %WM_MEASUREITEM message
      ' *********************************************************************************************
      Sub MeasureMenu(Byval hWnd As Dword, Byval lParam As Dword)
       
       Local hDC As Dword
       Local hf As Dword
       Local txt As String
       Local sl As SIZEL
       Local lpMis As MEASUREITEMSTRUCT Ptr
       Local ncm As NONCLIENTMETRICS
       
       lpMis = lParam ' lParam points to MEASUREITEMSTRUCT
       txt = GetMenuTextAndBitmap(@lpMis.itemID, 0) ' get menu item's text
       
       hDC = GetDC(hWnd) ' grab dialog's DC
       ncm.cbSize = SizeOf(ncm) ' grab menu font
       SystemParametersInfo %SPI_GETNONCLIENTMETRICS, SizeOf(ncm), Byval VarPtr(ncm), 0
       If Len(ncm.lfMenuFont) Then
        hf = CreateFontIndirect(ncm.lfMenuFont) ' create font from menu LogFont data
        If hf Then hf = SelectObject(hDC, hf) ' select it in DC
       End If
       GetTextExtentPoint32 hDC, Byval StrPtr(txt), Len(txt), sl ' get text size
       '     @lpMis.itemWidth  = sl.cx                                 ' set width
       @lpMis.itemWidth = sl.Cx + %OMENU_EXTRAWIDTH ' set width
       @lpMis.ItemHeight = GetSystemMetrics(%SM_CYMENU) + 1 ' set height
       If hf Then DeleteObject SelectObject(hDC, hf) ' delete our tmp menu font object
       ReleaseDC hWnd, hDC ' release DC to avoid memory leak
      
       If @lpMis.itemId = 0 Or @lpMis.itemId = %IDM_SEPARATOR Then  ' Separator
        @lpMis.itemHeight = @lpMis.itemHeight \ 2
       End If
       
      End Sub
      
      
      ' Function    : GetMenuBmpHandle ()
      ' Description : Get desired Menu Item's bitmap handle.
      ' *********************************************************************************************
      Function GetMenuBmpHandle(Byval BmpNum As Long, Byval nState As Long) As Long
       Local hBmp1 As Dword
       Local hBmp2 As Dword
       Local hDC As Dword
       Local memDC1 As Dword 
       Local memDC2 As Dword
       
       ' Load the Bitmap Strips and create the ImageLists.
       ' Disabled bitmap strip.
       If nState = %IMG_DIS Then
        hBmp1 = LoadBitmap(hInst, Byval %IDB_MDIS)
       End If
       
       ' Normal bitmap strip.
       If nState = %IMG_NOR Then
        hBmp1 = LoadBitmap(hInst, Byval %IDB_MNOR)
       End If
       
       ' Hot Selected bitmap strip.
       If nState = %IMG_HOT Then
        hBmp1 = LoadBitmap(hInst, Byval %IDB_MHOT)
       End If
       
       ' Create memory DC's and draw the bitmaps.
       hdc = GetDC(0) ' GET device context FOR screen
       memDC1 = CreateCompatibleDC(hDC) ' Create two memory device contexts
       memDC2 = CreateCompatibleDC(hDC)
       hBmp2 = CreateCompatibleBitmap(hDC, 16, 16) ' Create compatible 16x16 pixel bmp
       ReleaseDC 0, hdc ' Release the DC - don't need it anymore.
       SelectObject memDC1, hBmp1 ' Select the bitmaps into the mem dc's
       SelectObject memDC2, hBmp2
       BitBlt memDC2, 0, 0, 16, 16, memDC1, BmpNum * 16, 0, %SRCCOPY 'copy bNum part of hBmp1 strip to hBmp2
       DeleteDC memDC1 ' Cleanup memDC's and delete main bmp strip object
       DeleteDC memDC2
       DeleteObject hBmp1 ' (note: 16x16 pixel hBmp2 is deleted in DrawMenu routine)
      
       Function = hBmp2 ' return handle to 16x16 pixel bitmap
      End Function
      
      
      ' Function    : GetMenuTextAndBitmap
      ' Description : Return menu item string and zero-based bitmap number (-1 = no bitmap).
      '               Bitmap ImageList Strip starts at Zero, so BmpNum starts at Zero.
      Function GetMenuTextAndBitmap(Byval ItemId As Long, BmpNum As Long) As String
       Local x As String
       Select Case ItemId
        Select Case ItemID
         Case %IDM_NEW
          BmpNum = 18
         Case %IDM_OPEN
          BmpNum = 19
         Case %IDM_SAVE
          BmpNum = 20
         Case %IDM_PRINT
          BmpNum = 21
         Case %IDM_EXIT
          BmpNum = 42
      
         'edit
         Case %IDM_FIND
          BmpNum = 25
         Case %IDM_UNDO
          BmpNum = 12
         Case %IDM_REDO
          BmpNum = 13
         Case %IDM_COPY
          BmpNum = 22
         Case %IDM_CUT
          BmpNum = 23
         Case %IDM_PASTE
          BmpNum = 24
         Case %IDM_TEXTFORECOLOR
          BmpNum = 50
         Case %IDM_TEXTBACKCOLOR
          BmpNum = 51
         Case %IDM_BACKSOUND
          BmpNum = 52
         Case %IDM_BACKIMAGE
          BmpNum = 53
          
          
         'insert
         Case %IDM_IMAGE
          BmpNum = 14
         Case %IDM_HTML
          BmpNum = 49
          
         Case %IDM_LINE
          BmpNum = 15
         Case %IDM_HYPERLINK
          BmpNum = 16
          
      '   'tables
      '   Case %IDM_TABLE
      '    BmpNum = 26
      '   Case %IDM_TABINSLINE
      '    BmpNum = 27
      '   Case %IDM_TABINSCOL
      '    BmpNum = 28
      '   Case %IDM_TABINSCELL
      '    BmpNum = 29
      '   Case %IDM_TABREMLINE
      '    BmpNum = 30
      '   Case %IDM_TABREMCOL
      '    BmpNum = 31
      '   Case %IDM_TABREMCELL
      '    BmpNum = 32
      '   Case %IDM_TABJOINCELLS
      '    BmpNum = 33
      '   Case %IDM_TABDIVCELLS
      '    BmpNum = 34
       
      '   'formatting
      '   Case %IDM_FORMATTED
      '    BmpNum = 47
      '   Case %IDM_ADDRESS
      '    BmpNum = 46
      '   Case %IDM_ORDERLIST
      '    BmpNum = 6
      '   Case %IDM_UNORDERLIST
      '    BmpNum = 7
      '   Case %IDM_DEFINITION
      '    BmpNum = 48
      '   Case %IDM_PARAGRAPH
      '    BmpNum = 45
       
         'positioning
         Case %IDM_SENDTOTOP
          BmpNum = 35
         Case %IDM_SENDTOBOTTOM
          BmpNum = 36
         Case %IDM_BRINGTOFRONT
          BmpNum = 37
         Case %IDM_SENDTOBACK
          BmpNum = 38
         Case %IDM_ABOVETEXT
          BmpNum = 39
         Case %IDM_BELOWTEXT
          BmpNum = 40
      
         'help
         Case %IDM_CONTENTS
          BmpNum = 43
         Case %IDM_USING
          BmpNum = 44
         
         Case Else
          BmpNum = -1   'no bitmap 
        End Select
       End Select
      
       x = Lgs(ItemID)
       If ItemID = %IDM_MAKEABSOLUTE Then x = MakeAbsString  'this string change dynamically (make absolute)
        
       Function = x
      End Function
      
      ' Enumerate the names of all the fonts
      Function EnumFontName(lf As LOGFONT, tm As TEXTMETRIC, Byval FontType As Long, lpData As Long) As Long
       Local zText As Asciiz * 256
       zText = lf.lfFaceName
       SendMessage lpData, %CB_ADDSTRING, 0, VarPtr(zText)
       Function = 1
      End Function
      
      ' Fill the specified combo box with the names of all the fonts
      Sub FillFontCombo(Byval hCbo As Long)
       Local hDC As Long
       SendMessage hCbo, %CB_RESETCONTENT, 0, 0
       hDC = GetDC(%HWND_DESKTOP)
       EnumFonts hDC, Byval %NULL, CodePtr(EnumFontName), Byval VarPtr(hCbo)
       ReleaseDC %HWND_DESKTOP, hDC
       SendMessage hCbo, %CB_SETCURSEL, 0, 0
      End Sub
      
      'colocr selection
      Function SelectColor(Byval hParent As Long, Byval iStartColor As Long, Byval iUseExt As Long) As Long
       Local cca As ChooseColorApi
       Dim ccTemp(16) As Static Dword
       cca.hinstance = 0
       cca.lStructSize = SizeOf(cca)
       cca.lpCustColors = VarPtr(ccTemp(0))
       cca.Flags = %CC_RGBINIT
       If iUseExt = 0 Then cca.Flags = cca.Flags Or %CC_PREVENTFULLOPEN
       cca.hwndowner = hParent
       cca.rgbResult = iStartColor
       If ChooseColor(cca) Then Function = cca.rgbResult
      End Function
      
      'GetFileNameToSave
      Function GetFileNameToSave(Byval PATH As String, Byval xHwnd As Long, Byval xCaption As String, Byval xMask As 
      
      String, Byval xDefault As String) As String
       On Error Resume Next
       Local F As String
       Local Style As Dword
       f = xDefault
       Style = %OFN_HIDEREADONLY Or %OFN_LONGNAMES
       If SaveFileDialog(xHwnd, xCaption, f, Path, xMask, xDefault, Bycopy Style) Then
        Function = f
       Else
        Function = ""
       End If
      End Function
      
      'save html stream to file
      Sub SaveHtmlFile(Optional Byval PromptUser As Long)
       Local v As Variant
       '++Object Get oOcx.CurrentDocumentPath To v 'get current file name CurrentDocumentPath
       If IsTrue PromptUser Or htmlFile = "" Then  'Len(Variant$(v)) = 0 Then  'prompt user for filename
        '---------oOcx.SaveDocument() DIDN'T WORK - doesn't recognize second param v1 as true
        'v = ""
        'v1 = %TRUE
        'On Error Resume Next
        'Object Call oOcx.SaveDocument(v, v1) '!!! doesn't recognize v1 as true
        'WorkAround: create public htmlFile, get file name to pass to the ocx function
        '-------------------------------------------------------
        htmlFile = GetFileNameToSave(CurDir$, hDlgMain, "Informe um nome para gravar o arquivo", Lgs(102), htmlFile)
       End If
       If htmlFile <> "" Then
        On Error Resume Next
        v = htmlFile
        Object Call oOcx.SaveDocument(v)
       End If 
      End Sub
      
      'paste into HTML
      Sub PasteHTML(Byval x As String)       
       Local Dp As Dispatch
       Local v As Variant, vv As Variant 
       Object Get oOcx.dom To vv : Dp = vv
       Object Get Dp.Selection To vv : Dp = vv
       Object Call Dp.CreateRange To vv : Dp = vv
       v = x
       Object Call Dp.PasteHTML(v)
      End Sub
      
      'change app title
      Sub SetAppTitle()
       Local z As Asciiz * 255
       '++Local v As Variant 
       '++Object Get oOcx.CurrentDocumentPath To v
       z = $APPTITLE & " - " & IIf$(htmlFile = "", "NONAMED", htmlFile)
       SetWindowText hDlgMain, z
      End Sub
      
      ' messagebox by api
      Function MsgBoxApi(Byval hParent As Long, Byval sMsg As String, Byval dwFlags As Dword, Byval sTitle As 
      
      String) As Long
       If hParent = 0 Then hParent = GetFocus()
       Function = MessageBox(hParent, Byval StrPtr(sMsg), Byval StrPtr(sTitle), dwFlags)
      End Function
      
      'update toolbar main
      Sub UpdateTbMainAndMenus()
       Local v As Variant
       Static TbStat As Long
       Object Get oOcx.IsDirty To v
       If IsTrue Variant#(v) Then
        If TbStat = 0 Then
         SendMessage hToolbarMain, %TB_SETSTATE, %IDM_SAVE, %TBSTATE_ENABLED
         SendMessage hToolbarMain, %TB_SETSTATE, %IDM_PRINT, %TBSTATE_ENABLED
         SendMessage hToolbarMain, %TB_SETSTATE, %IDM_FIND, %TBSTATE_ENABLED
         Menu Set State hMenu, Bycmd %IDM_FIND, %MF_ENABLED
         Menu Set State hMenu, Bycmd %IDM_SAVE, %MF_ENABLED
         Menu Set State hMenu, Bycmd %IDM_SAVEAS, %MF_ENABLED
         Menu Set State hMenu, Bycmd %IDM_PRINT, %MF_ENABLED
         TbStat = 1
        End If
       Else
        If TbStat = 1 Then
         SendMessage hToolbarMain, %TB_SETSTATE, %IDM_SAVE, 0
         SendMessage hToolbarMain, %TB_SETSTATE, %IDM_PRINT, 0
         Menu Set State hMenu, Bycmd %IDM_FIND, %MF_DISABLED
         Menu Set State hMenu, Bycmd %IDM_SAVE, %MF_DISABLED
         Menu Set State hMenu, Bycmd %IDM_SAVEAS, %MF_DISABLED
         Menu Set State hMenu, Bycmd %IDM_PRINT, %MF_DISABLED
         TbStat = 0
        End If
       End If
      End Sub
      
      Sub EnableToolbars(Byval Stat As Long)
       EnableWindow hToolbarMain, Stat
       EnableWindow hToolbarEdit, Stat
       EnableWindow hRebar, Stat
      End Sub
      
      'MakeFont
      'Usage: hfont = MakeFont("Courier", 14, "IBU") '(italic/bold/underline)
      Function MakeFont(Byval FontName As String, Byval PointSize As Long, Opt Byval Flags As String) As Long
       Local W As Long, I As Long, U As Long, CyPixels As Long
       W = %FW_NORMAL
       If Flags <> "" Then
        Flags = UCase$(Flags)
        If Instr(Flags, "B") Then W = %FW_BOLD
        If Instr(Flags, "U") Then U = 1 Else U = 0
        If Instr(Flags, "I") Then I = 1 Else I = 0
       End If
       CyPixels = GetDeviceCaps(GetDC(%HWND_DESKTOP), %LOGPIXELSY)
       PointSize = (PointSize * CyPixels) \ 72
       Function = CreateFont(0 - PointSize, 0, 0, 0, W, I, U, 0, _
                  %ANSI_CHARSET, %OUT_TT_PRECIS, %CLIP_DEFAULT_PRECIS, _
                  %DEFAULT_QUALITY, %FF_DONTCARE, Bycopy FontName)
      End Function
      
      'Eof PbHtmlEd.bas

      ------------------

      Comment


      • #4

        ============ RESOURCE FILE

        Code:
        #include "\pb8\winapi\resource.h"
        
        
        #define IDB_NORMAL   100
        #define IDB_HOT      101
        #define IDB_MNOR     102
        #define IDB_MHOT     103
        #define IDB_MDIS     104
        
        //edit toolbar
        #define IDC_BOLD          200
        #define IDC_ITALIC        201
        #define IDC_UNDERLINE     202
        #define IDC_TXTBACKCOLOR  203
        #define IDC_INDENT        204
        #define IDC_OUTDENT       205
        #define IDC_ORDERLIST     206
        #define IDC_UNORDERLIST   207
        #define IDC_JUSTIFYLEFT   208
        #define IDC_JUSTIFYCENTER 209
        #define IDC_JUSTIFYRIGHT  210
        #define IDC_UNDO          211
        #define IDC_REDO          212
        #define IDC_IMAGE         213
        #define IDC_LINE          214
        #define IDC_HYPERLINK     215
        #define IDC_UNLINK        216
        #define IDC_COPY          217
        #define IDC_CUT           218
        #define IDC_PASTE         219
        
        
        // controls
        #define IDM_NEW           WM_USER + 2048
        #define IDM_OPEN          IDM_NEW + 1
        #define IDM_SAVE          IDM_OPEN + 1
        #define IDM_SAVEAS        IDM_SAVE + 1
        #define IDM_PRINT         IDM_SAVEAS + 1
        #define IDM_EXIT          IDM_PRINT  + 1
                                  
        #define IDM_FIND          IDM_EXIT  + 1
        #define IDM_UNDO          IDM_FIND + 1
        #define IDM_REDO          IDM_UNDO + 1
        #define IDM_COPY          IDM_REDO + 1
        #define IDM_CUT           IDM_COPY + 1
        #define IDM_PASTE         IDM_CUT + 1
        #define IDM_TEXTFORECOLOR IDM_PASTE + 1
        #define IDM_TEXTBACKCOLOR IDM_TEXTFORECOLOR + 1
        #define IDM_BACKCOLOR     IDM_TEXTBACKCOLOR + 1
        #define IDM_BACKSOUND     IDM_BACKCOLOR + 1
        #define IDM_BACKIMAGE     IDM_BACKSOUND + 1
        #define IDM_SELALL        IDM_BACKIMAGE + 1
                                  
        #define IDM_IMAGE         IDM_SELALL + 1
        #define IDM_HTML          IDM_IMAGE + 1
        #define IDM_LINE          IDM_HTML + 1
        #define IDM_HYPERLINK     IDM_LINE + 1
                                  
        // #define IDM_TABLE         IDM_HYPERLINK + 1
        // #define IDM_TABINSLINE    IDM_TABLE + 1
        // #define IDM_TABINSCOL     IDM_TABINSLINE + 1
        // #define IDM_TABINSCELL    IDM_TABINSCOL + 1
        // #define IDM_TABREMLINE    IDM_TABINSCELL + 1
        // #define IDM_TABREMCOL     IDM_TABREMLINE + 1
        // #define IDM_TABREMCELL    IDM_TABREMCOL + 1
        // #define IDM_TABJOINCELLS  IDM_TABREMCELL + 1
        // #define IDM_TABDIVCELLS   IDM_TABJOINCELLS + 1
                                  
        #define IDM_NORMAL        IDM_HYPERLINK + 1  //IDM_TABDIVCELLS + 1
        #define IDM_FORMATTED     IDM_NORMAL + 1
        #define IDM_ADDRESS       IDM_FORMATTED + 1
        #define IDM_TIT1          IDM_ADDRESS + 1
        #define IDM_TIT2          IDM_TIT1 + 1
        #define IDM_TIT3          IDM_TIT2 + 1
        #define IDM_TIT4          IDM_TIT3 + 1
        #define IDM_TIT5          IDM_TIT4 + 1
        #define IDM_TIT6          IDM_TIT5 + 1
        #define IDM_ORDERLIST     IDM_TIT6 + 1
        #define IDM_BULLETLIST    IDM_ORDERLIST + 1
        #define IDM_DIRLIST       IDM_BULLETLIST + 1
        #define IDM_MENULIST      IDM_DIRLIST + 1
        #define IDM_DEFTERM       IDM_MENULIST + 1
        #define IDM_DEFINITION    IDM_DEFTERM + 1
        #define IDM_PARAGRAPH     IDM_DEFINITION + 1
                                  
        #define IDM_MAKEABSOLUTE  IDM_PARAGRAPH + 1  
        #define IDM_SENDTOTOP     IDM_MAKEABSOLUTE + 1  
        #define IDM_SENDTOBOTTOM  IDM_SENDTOTOP + 1   
        #define IDM_BRINGTOFRONT  IDM_SENDTOBOTTOM + 1  
        #define IDM_SENDTOBACK    IDM_BRINGTOFRONT + 1  
        #define IDM_ABOVETEXT     IDM_SENDTOBACK + 1   
        #define IDM_BELOWTEXT     IDM_ABOVETEXT + 1  
        #define IDM_LOCKITEM      IDM_BELOWTEXT + 1
                                  
        #define IDM_CONTENTS      IDM_LOCKITEM + 1
        #define IDM_USING         IDM_CONTENTS + 1
        #define IDM_ABOUT         IDM_USING + 1
                                 
        
        
        APPLICA   ICON "PbHTMLEd.ico"
        
        EDIT      ICON "Edit.ico"
        HTML      ICON "Html.ico"
        VIEW      ICON "View.ico"
        SND       ICON "Speaker.ico"
        IMG       ICON "Image.ico"
        
        IDB_NORMAL  BITMAP DISCARDABLE  "TbEditBig0.bmp"
        IDB_HOT     BITMAP DISCARDABLE  "TbEditBig1.bmp"
        
        IDB_MNOR  BITMAP DISCARDABLE "TbEditSmall.bmp"
        IDB_MHOT  BITMAP DISCARDABLE "TbEditSmallH.bmp"
        IDB_MDIS  BITMAP DISCARDABLE "TbEditSmallD.bmp"
        
        
        STRINGTABLE LOADONCALL MOVEABLE
         BEGIN
           100, "[email protected]"
           101, "[email protected]"
           102, "Documentos HTML (*.html,*.htm)|*.html;*[email protected] Documents"
           103, "O arquivo foi modificado! Deseja salvar as alteraçõ[email protected] was modified. Do you want to save it?"
           104, "Informe um nome para gravar o [email protected] a file name to save"  
           105, "Todos os arquivos (*.*)|*.*@All files (*.*)|*.*"
           106, "Arquivos de imagens @Image files "
           107, "(*.jpg,*.gif,*.wmf,*.bmp)|*.jpg;*.gif;*.wmf;*.bmp"
           108, "Arquivos de audio @Audio files "
           109, "(*.wav,*.wma,*.mp3,*.snd,*.au,*.aif,*.aifc)|*.wav;*.wma;*.mp3;*.snd;*.au;*.aif;*.aifc"
           110, "Arquivos MIDI @MIDI files "
           111, "(*.mid,*.rmi,*.midi)|*.mid;*.rmi;*.midi"
           112, "Selecione o arquivo de imagem para pano de [email protected] a file to be used as image background"   
           113, "Selecione o arquivo que deseja [email protected] the file you want to insert"
           114, "Editar|[email protected]|Source"
           115, "Selecione o nome do arquivo [email protected] the Html file"
           116, "Erro ao carregar arquivo [email protected] loading Html file"
           117, "&Utilizar posicionamento [email protected] 1D positioning"
           118, "Som de [email protected] sound"
           119, "Arquivo que contém o som de [email protected] file to be inserted as background"
           120, "Quantidade de execuçõ[email protected] of executions"
           121, "(0 para tocar continuamente)@(0 for continuously)"
           122, "&[email protected]&Cancel"
           123, "O arquivo especificado não [email protected] specified file doesn't exist"
           124, "Selecione o arquivo para som de [email protected] a file to be use as sound background"
           125, "Imagem de pano de [email protected] image"
           126, "Imagem a ser inserida como [email protected] to be inserted as background"
           127, "Posicionar a [email protected] the image..."
           128, "Em todo o [email protected] all"  
           129, "Como cabeç[email protected] a header"
           130, "Na margem [email protected] left margin"
           131, "Na margem [email protected] right margin"
           132, "Como rodapé@As a footer"
        
           150, "&[email protected]&File"
           151, "&[email protected]&Edit"
           152, "&[email protected]&Insert"
           153, "&[email protected]&tting"
           154, "&[email protected]&Positioning"
           155, "A&[email protected]&Help"
           
           // editing toolbar tooltips
           IDC_BOLD,         "Aplica [email protected] bold attribute"
           IDC_ITALIC,       "Aplica itá[email protected] italic attribute"
           IDC_UNDERLINE,    "Aplica [email protected] underline"
           IDC_TXTBACKCOLOR  "Muda cor de fundo do texto [email protected] background text color"
           IDC_INDENT,       "Desloca para a [email protected] selection"
           IDC_OUTDENT,      "Desloca para a [email protected] selection"
           IDC_ORDERLIST,    "Cria lista [email protected] numbered list"
           IDC_UNORDERLIST,  "Cria lista de tó[email protected] bulletled list"
           IDC_JUSTIFYLEFT,  "Alinha para a [email protected] left"
           IDC_JUSTIFYCENTER,"Centraliza seleçã[email protected] center"
           IDC_JUSTIFYRIGHT, "Alinhamento à [email protected] right"
           IDC_UNDO,         "Desfaz última modificaçã[email protected] last action"
           IDC_REDO,         "Refaz modificação [email protected] last undone"
           IDC_IMAGE,        "Insere imagem no [email protected] image in editing area"
           IDC_LINE,         "Insere linha [email protected] horizontal line"
           IDC_HYPERLINK,    "Insere [email protected] hyperlink"
           IDC_UNLINK,       "Retira [email protected] hyperlink"
           IDC_COPY,         "Copiar seleçã[email protected] selection"
           IDC_CUT,          "Recortar seleçã[email protected] selection"
           IDC_PASTE,        "Colar do clipboard para o [email protected] from clipboard"
           
        
           //menus
           IDM_NEW,          "&Novo [email protected] file"
           IDM_OPEN,         "&Abrir arquivo\[email protected]&Open file\tCTRL+O"  
           IDM_SAVE,         "&Salvar\[email protected]&Save\tCTRL+S"
           IDM_SAVEAS,       "Salvar &[email protected] &as..."   
           IDM_PRINT,        "&[email protected]&Print"
           IDM_EXIT,         "&[email protected]&Exit"
           
           IDM_FIND,         "&Procurar\[email protected]&Find\tCTRL+F"
           IDM_UNDO,         "&Desfazer\[email protected]&Undo\tCTRL+Z"
           IDM_REDO,         "&Refazer\[email protected]&Redo\tCTRL+R"
           IDM_COPY,         "Copiar\[email protected]\tCTRL+C"
           IDM_CUT,          "Recortar\[email protected]\tCTRL+X"
           IDM_PASTE,        "Colar\[email protected]\tCTRL+V"
           IDM_TEXTFORECOLOR,"Definir cor do &[email protected] text &forecolor"
           IDM_TEXTBACKCOLOR,"Definir cor de &fundo do [email protected] text &backcolor"
           IDM_BACKCOLOR,    "Definir cor do &pano de [email protected] back&ground color"
           IDM_BACKSOUND,    "Definir o &som de [email protected] background &sound"
           IDM_BACKIMAGE,    "Definir a &imagem de [email protected] background &image"
           IDM_SELALL,       "Selecionar tudo\[email protected] all\tCTRL+A"
           
           IDM_IMAGE,        "&[email protected]&Image"
           IDM_HTML,         "&Arquivo texto/[email protected]&Text/html file"
           IDM_LINE,         "&[email protected]&Line"
           IDM_HYPERLINK,    "&[email protected]&Hyperlink"
           
           // IDM_TABLE,        "Inserir &[email protected] table"
           // IDM_TABINSLINE,   "Inserir &[email protected] row" 
           // IDM_TABINSCOL,    "Inserir &[email protected] column"
           // IDM_TABINSCELL,   "Inserir célul&[email protected] cell"
           // IDM_TABREMLINE,   "&Remover [email protected] row"
           // IDM_TABREMCOL,    "Re&mover [email protected] column"
           // IDM_TABREMCELL,   "Remo&ver cé[email protected] cell"
           // IDM_TABJOINCELLS, "&Juntar cé[email protected] cells"
           // IDM_TABDIVCELLS,  "&Dividir cé[email protected] cells"
        
           // These strings must not be modified - they vary with the language.
           // You must use the *exact* format name. Tip: take look at what your Outlook is using
           // The correct would be retrieving them from DECMD_GETBLOCKFMTNAMES dhtmledit command
           // in DocumentComplete() event of dhtmledit and fill the format menu options.
           // I could not succeed doing this  
           // ----------------------------------------------------
           IDM_NORMAL,       "Normal"
           IDM_FORMATTED,    "[email protected]"
           IDM_ADDRESS,      "Endereç[email protected]"
           IDM_TIT1,         "Título [email protected] 1"
           IDM_TIT2,         "Título [email protected] 2"
           IDM_TIT3,         "Título [email protected] 3"
           IDM_TIT4,         "Título [email protected] 4"
           IDM_TIT5,         "Título [email protected] 5"
           IDM_TIT6,         "Título [email protected] 6"
           IDM_ORDERLIST ,   "Lista [email protected] List"
           IDM_BULLETLIST,   "Lista com [email protected] List"
           IDM_DIRLIST,      "Lista de diretó[email protected] List"
           IDM_MENULIST,     "Lista de [email protected] List"
           IDM_DEFTERM,      "Termo de definiçã[email protected] Term"
           IDM_DEFINITION,   "Definiçã[email protected]"
           IDM_PARAGRAPH,    "Pará[email protected]"
           // ----------------------------------------------------
        
           IDM_MAKEABSOLUTE, "Usar posição &[email protected] &absolute position"
           IDM_SENDTOTOP,    "Enviar para o &[email protected] to to&p"
           IDM_SENDTOBOTTOM, "Enviar para o f&[email protected] to bo&ttom"
           IDM_BRINGTOFRONT, "Trazer para a &[email protected] to &front"
           IDM_SENDTOBACK,   "Enviar para t&rá[email protected] to &back"
           IDM_ABOVETEXT,    "Por &cima do [email protected]&Above text"
           IDM_BELOWTEXT,    "Por &baixo do [email protected]&low text"
           IDM_LOCKITEM,     "B&loquear [email protected]&k element"
        
           IDM_CONTENTS,     "&Conteú[email protected]&Contents"
           IDM_USING,        "&Usando a [email protected]&Using help"   
           IDM_ABOUT,        "&Sobre o [email protected]&About PbHtmlEd..."   
        
         END
          
        
        VS_VERSION_INFO VERSIONINFO
        FILEVERSION 1, 1, 0, 0
        PRODUCTVERSION 1, 1, 0, 0
        FILEOS VOS_WINDOWS16
        FILETYPE VFT_APP
        BEGIN
          BLOCK "StringFileInfo"
          BEGIN
            BLOCK "041604E4"
            BEGIN
              VALUE "CompanyName",      "GAS Informática Ltda\000"
              VALUE "FileDescription",  "PB Html Editor\000"
              VALUE "FileVersion",      "01.10.0000\000"
              VALUE "InternalName",     "PBHtmlEd\000"
              VALUE "OriginalFilename", "PBHTMLED.EXE\000"
              VALUE "LegalCopyright",   "Public Domain - Heber Jorge da Silva 03/2005\000"
              VALUE "LegalTrademarks",  "Public Domain\000"
              VALUE "ProductName",      "PBHtmlEd\000"
              VALUE "ProductVersion",   "01.10.0000\000"
              VALUE "Comments",         "http://www.gasinf.com.br\000"
            End
          End
        End


        ------------------

        Comment


        • #5
          ======== TOOLBARS BMPS and ICONS

          MANY THANKS TO EDWIN B KNOPPERT FOR THIS EXCELLENT UTILITY (BIN2BAS)

          =====================================================================


          Code:
           
          ' File    : Images.zip
          ' Len     : 16124
          ' Created : 03-28-2005 - 16:22:04 using BinBas GUI 2.02
           
          #Compile Exe
           
          Sub BinBas1( T As String )
           
          Dim a&: For a& = 1 To DataCount: T = T & Read$( a& ): Next a&
           
          Data 504B030414000200080000002000879B349A863E0000EA4000000A000000496D616765
          Data 732E7A6970757B75585BDBD726521C8A15A758717727A1B816B702C55D8B4BB0E252DC
          Data 2DC50AC529142F6EA140801629EEEE1048D0E9FDCDCC77EFF7CD9DE48F93B373DEE7D9
          Data 6B9DB5DE257B6F4D55D4672F9090903091E82ABDF9E9843FCEF66323210937202111FC
          Data 19D5B594B776F0D271B1707696E3B674713F7EABFA75510157979D6C845F7104CB23F4
          Data C893A5BA7362567184410F82F719C4A7107C250BFB848C1B451BB4A24356AD695E3245
          Data 1EF74BEE9A36E4F171751BAFDBECE9DEE7E1F2149AF58367EEE9D10BE12D75BE2969D9
          Data C649CB23B725DDD569A17276D6DA11A64184B2D6821344EED1D559BBC0F1EE3C4E8374
          Data 270711378CD5259831C6918847B17EE6137D79981B8DEF3DCD2E253FC9C2D4FFF80EAF
          Data C76D4A3BB27B559BCF9E09F40BB118D036F6E5B5AD71E786C0C01186791C4F8415029F
          Data BC7182D66EECD053C8FFBBFA1946CFE06FE1A8F585E4161EB6AB2FAB26F9924BD3A61B
          Data 7774F2F94772B20AD9EC62B3C64CF5FB938657C21BF8C6D04C6AF2DA63E35C081EF991
          Data B3752116FAC7E601B110F9A0E4820953815C911DE3842270C552BAB984548C7524C137
          Data DE116F86F764B11464D0C16158DD5986D12E95F34E1E6F39D10E7A5760B3EBE779140C
          Data EA44932DD5848184D9E6BE825AD37449DDA1CA181EBECCA9C7E6827ADA37F774C9A780
          Data 02820DD32E7AE1B368598BCFF6C1F2B54F725A2F4B57F1EF380A01147163729DDAC658
          Data AF847EE56FBCF21C1D7B91D350B47556D931ECA8713A492D41B52F2BBD561446E11CA6
          Data 8E178276698C6B338A9972A9BF882FC0F2BA4B336616BFA3474769E52E17F4955F19C7
          Data 93FD66C727017B7993350AB41F3D8A10396B4CA39DD1E7D7019D27C76B9C470B7FF6F2
          Data 08D6CD4EE3009DBBE6C41173425567190F77470D8D19F3EC158FDCE2EBF2608B989566
          Data F4759A56B23B71D6CF90EDA31EE2A38BE03FE5BD496F83B2E7085615BEBF3115DF7FFF
          Data AEC4C05E89C24EC2686DEAE57237C7F56A5F2317D10EF64E0BB98C8829CA9C3FC769F4
          Data F2495437C3453FF671C403AF6C4715B1C168BE8D9549BC9B51A6D54896E2023EF46035
          Data 05982EE3BCC922FDA1CABCE7BE530E4AD9AF733F78E7B58ED7073A89B48EF04800E8CB
          Data 6F9C88CA7E281272032650B750933C0390239CB8ED4341EF289ED5A64E96ADCB8CD399
          Data 3D3D5FED9C4908657AC7A127DC5FCC519A63608050EE4F684C3CE24D9AC7B7BB2DE4E7
          Data 5FB62E96B4667F8DE2BC99D76237901E6C3EDB2BFCB8DE3B0A7B2793278EB6E3BB32A8
          Data F093B5B1EB4AF383FFE1F30D9935CB6F6B7CF13199AC1F9A09A0E8D367353FC8A01697
          Data B3AB7BF6A90EFE38AE763D0672974B5A9D382F5E2AF26DA9027527A002770F5BD8240F
          Data F9C04320640D19F532F6D70BE0797D58F764D93034942FEDAC0CA345D85A87A4ED7B57
          Data F0DDB5FA4620F6A0A94C3CB84985FCD65776D8C8F5EE34CC4EB6F3D0E6D3AB57BF5F6C
          Data 783860D97A1D56B9F19580C88EBF172CAC1166D761DC19ECBF4719EE55E6BA8CBA5B67
          Data F2ABDFFAB6E3DC3045C137D3D2EA6A62392AB2474DE33C2444BA0D73662266DB2446C2
          Data D7672E7C99B819F5AB3E071ACE9BCEC36B9558FC55667AD7EE83822D5190AF7F439DAA
          Data 399B48387A448FB260CF71A999AC64ADF988C8E3CD9E935E30C1FE261CE6DF066B38B4
          Data 324FC0FAEDA3A1674F086CBA885202B20F832EE9562C1540657CABE915C8923E35B518
          Data 830FF581D7717566DD8FB01BA0766344CCAC8BD43752EEFDD37E15618C5B7DC8A00131
          Data 57A484C3B399AC60A3B3F9BD0ABEF1B59339E7A8943AFB5FC5FE4FC661D6513B6D67CA
          Data B21F9C2C72CE83C9B58E0C2D2827EA23C5F2925F6D570C72D2AA663B5716B710860813
          Data F5CA791ACFA0AB12F64AD1C4614A09AA4501D7B5A30EF01D86340A68F152B387AD9FEB
          Data 104DD547960ABFAD870A3E2BA3080E365A6EAC65127975FAA8BE4A9A4D6808AE28F941
          Data 7830C17BBFAE29069668CF1D7487A58DC99E2FA32A68B1EFAA828A229DDDCDFDE533C7
          Data 194173A05F01685D365FAFECDDB32C82B148A9DF2F1385202EE46FBD85B59744DE0E09
          Data CD5E6CFF7E7CA8F7B3EFBDCC47ECBCB8CCA2E15EBD8E0CD19CFAF0504FD4A482AF796F
          Data 1531F135F13386CF507830ADBE6D8AAD66963A9C5BE080C8E6E05ED2244545B920C4F1
          Data CC516E2D55EEA754E25BABCF339FF4B4D10F7605AF75B6C8300879DD2EB0EAE52C8398
          Data C66AA1D8CD29311D53D36E22F4BB44D2E3AF1493DA7873B2A848EAD249194244752776
          Data 136583F44760F1DF32C6BE806ECC1DDFB7F26E34F2B728653EFFC1F1F52251AEBC8F56
          Data 9C369770E1DE9C478AE32134E630D310669A3B95B292DAAB7D1734FFEB62B1604AFB53
          Data 4EFEEFE9DD369A33B61D9E876E5A9A8B6E96BB0781DAD4B744016F1DDB766EEA76C323
          Data 24706AD793445D81D55BF476950304265D572378CE6BABCC930904261E688BF0C07B45
          Data 866CA8D8506C293E38E308D46C97DFF208E999EFAFC3E797F7E462D2FB2CCC42C51B86
          Data 806073083030DA12A0A8EA221F782AEE83EFB58DA9E56BA10CB2C0D847675DC7E8E093
          Data 415FFCD44148990780C333DE9AAFA19381C36DC49BFDBECC1D676B83083850AF927634
          Data CA0B4B3F1FBA67A4B430DC885A20EF729D9DF37FEFE3557B9BEF76EA341D50C1A7F638
          Data FF73DA961CD17A67BA5A1BF1234F971F256F6A6C67D0BF2766A8216D0504ECBCC2AFA2
          Data 5F754F25CA82C478B18328DA1E92096B128C089479D226A7F9E8B59C90B7623A0CD772
          Data 082CF0BBF9317379A64D549549E6E2446220E49497199972540F68153DDE5E4576AF2E
          Data 5DD1217FE8C0E2FC8840361855178E1E05941C81F9A32516DCB006DD7C8225BF9374E4
          Data EA65C14832466AEE0DDB2631A21698FE72F66DB46059BDF9B1E4C4569F516F4F256788
          Data 77411A4D1812C33CAEDA6A72D9FFC769D00E446EAF7BC33301D019DE5D5380AB6FF43D
          Data EC58A5AB7AB89E59F28331F7CA86A41BE3A657FFF59D0596E69121E75423C9FB7E6515
          Data B57728D483D0F01FF14C8DB7DC89350BD4B2E796BECADD8DD7AB83AC4416993C85C4E7
          Data E8EB44A5FE7D455F1348553EBC360996F32C4B35AC3AA3BB58FD4078C69949B7849BDA
          Data 66A5DD079AF39C207BDB5204667B600BAEAD5F85DA76057E9AC40D61D48CB3C066E2ED
          Data 1F5D424148A25D12FF5672CCACD353734FCB26F3D38FC11066BE5256F0F0C24E83BC80
          Data 924BD2D11EFE9AAE7B176856A640D02A8DE92BB0B411F97D87674EE707FE974840BFBD
          Data 76518EC93DC52B70D97E0BD10300143E190F3071EF34BCBFCEB4C855C19565BD508F8F
          Data F0C93347259CF0F95ABA6A5413D2EC7C59D2F8E9532F6788BC0DC17973568A8C9C26E1
          Data EC1C772CD3BEC53DB991014B2C7AE09AF0027ECB635E3B4C16629F215AE22F120E2AD9
          Data BC4D1034ED9A6C67BA97F48C01B33D5683C7410077B11AC5A6B5FCF764B45328E637CF
          Data C67CF1048661465B5456CA4367DFB272C93E1C7215B54D90B89254C9BB2B0A6070B7C1
          Data C5B7A3E7E4EC04316A9EEE0565D213E03A77EB7A5B173B6D53A7FD17856EBD59648571
          Data 57608ECAF0252B606782EB6241EEC632DBD27BD490F09C0088AE9C2BC5221C9F8428C4
          Data 8EC2F91ADCE42EC4017AA7D1E278F9D5AA687236A543D02DF3962E860D5C534FBBC37D
          Data 40BFCF21F8C24E1098B1DE482DDB75E5947709BD16A80A1100D0D2294E05B4E230D010
          Data 3D6ADFDDBBAD2936195111D2E250F413FD225B38516022ECF54EDC60CE5994609CE5CE
          Data 981BBF157F9EB8F366349EE0F547BC1C8E0B42AF073ECF4F8FC4F2DEC91D27D1D0938B
          Data B82442FEF002D338FC672E59971F99B0347DED138588D904528DD8B7F0A61CEF2C128A
          Data 3176E4F4B4FBA37779CE205FCEF05C8744E8D3162BC5819E02FE8D4A2E2B4654906C57
          Data 9748687C0944899ED0AE57814A7EAEF0457212458A9DACE388A270728F7522DE3DA836
          Data FE86D7F94A47369D827B592722FD7D731AEB84AB5455C86A995F53D5A55849EB634065
          Data 5F925CB3BCEB11491D3CB957E46D30CED80550AF35BED1B3E83919E86C64572FDFC5CA
          Data B8FEBBCACEE5C093E67F25BC5C86B6FC1ABBF5B5E4987F125E5D24A4E7FF95F0CA38D8
          Data F1FD27DDCD9372DD1225887442A6B5EC57479F5FEAA136BF1CF7A99D34705F78132116
          Data 1636C13C4F7C85E515FA1CC3DDDA3CB11E8282EADC53061FD08EE57C145EA4C135F173
          Data AD60AB34E40C324DFF750C7CBC879389DDD93F05B784AC1EADBA5D9F92DD9248CC3E4C
          Data E3E630ABFFD45DC26C5E85D5AE3314A98964F4B77C1078DC1B040F331F92B7BF3AEA91
          Data ADF24E823B5252B1330DBCB4BCD7961E3ACE91F4355C43B887F04402F0499893F09A75
          Data 8CB06D05A197AB665D92525283617AA32F3F1FF9DF5FBB5597B4DCAEDB37CD68B8502C
          Data 4739AA0D871581AB1314B983850229F52CF7BD283981BF6D36BDE25E355F6B5B34019F
          Data 51C903528E7F6C5BAE4B82A1991A1549DABED2B5F15B3F1347401BDF4681292A8155B7
          Data BCA8C5B3AC2E248DEED4B5C1B854970ECF3285557DFABB3E13E0B17E93C3834073CB1C
          Data 0136E851675806502894CC6E04899242CB15C202DA6D2C7EA5411B93CAB12C14931A9E
          Data 56AB90FE906EF5D1EA2C865BEEB70B8F045AA5210E9CB30C5E5AE151EB9E8B3757C377
          Data ED167B715A3B366DF50A7C712C04AA15131CA2B1410CA8A52027C73E976E8AD586E391
          Data CC03BCC7ECF08AB720A51C04196FE204A6FBF7645ED8A38154D23AC8476019B32EBF63
          Data 4A955598F2B58362C54DB8192730970B35F0471CD53E2F8BFE2E7A092655EA183F9478
          Data 15A7BA742F167953B0B410E4B5FB7C2828F95993795ED65DC2137923331A0DBF27A4AA
          Data 236EF60C0BA54D973289F527B98FF96E3FE2057111D5A532654E67AB003854A0223FAD
          Data 45B2CC35DABE27B2CC3E05E4713022A0535DDC64974A49F811DF40F18B2E71717460A0
          Data ED47F5F7632C6E6E1D0C9C1F79F23CC2259CE999E011B91EB03DB29B97C0962DE267FC
          Data 39A06D8A338786AD788D60F9FCB5345A32D6F28451100A30475025FB009864A25342CD
          Data 4022DBBB50B5B7AFBD466C87413BA39C2DE94BF59D1BB2C8F91554397ADE0646C9805B
          Data 1FEEA441D2DDFB7ACA83B67FBC89DD6364DF2500B40541C247668EB83669A3416BFD9B
          Data 95F632A96CAF390301D7944C044C164333501BED0FFDE9E669ACA9AFE339CB39AA94DE
          Data BCCCA7A02B9B1D7CF856C81326B2890922253DFB32ABD12386D860FB597BD1F8656097
          Data 33A1129140FCE63198FA2577B097AB814618B5CC90913FBA0890AFB82F911C2DB0A035
          Data 6248E544B3BDB67A6579B906E2C053988398BD74A8F80D9786B0D8BE3883C4A0C37422
          Data 3D17EA4EB75ED9B5313F4DAC52A0FD4E0655C6566E5D86FBA1390F58AB94D5696D13C4
          Data 94174226493E97F4FA7B9524ABF22808183B23BB8EFB3081DB28D6371A13A1AE7CE01E
          Data A8288AD992151316CB02CBFBDFFDEE4330621F516A77ECAD0826603A6BEA975BB13BA2
          Data DB3DB783CD88937B5542657E9E0D9240980E5D94E84631DFC5525405FAEED4470644FA
          Data 044B5BA248C192F1656C5B271A183967C8D372F5836CE7783F1680C5371C4ABC72FE47
          Data 4339B7CA5CA0E0B39291A1D66074A7A0288DBE4D342E760A63447EAD1AB7F867445315
          Data 68C4AE830F1C141FE8C860B844DBBD5D0835B3F207E8F1FFB63DD7FC958BCD32A7916E
          Data 54584FB5D8FDE729F2BEAED1F9AD779DCBC72A40B30DBF8B98A1D4E784C217401E7C16
          Data 03B98F432C7835E0653270A9D6DBAD341052D0504C25C8321CD274779AE5B6C6D35C01
          Data 88B9852CEE5E8A451183267A6FC828C18DBCA3B5A7B3BA7EDA8F0D84754757397B3A96
          Data 6E1B88CEFBCE31CAE2D7F98E18EB9993E39BBAC3761DE3069714FD10C32E12F02757FA
          Data 9FD7A22F6D15E9E218671F8E39E176857E3F624661A613FADB029A5DC11E431EA0E95C
          Data BA7A32520D9CDD1FA32C2DA7E2F6AB6EE8E7CF9E4D3C96733ABF8FAEEB184195F306B0
          Data F9256EE1E3328D5D77C78F751282F14D3337886300773C4BB4D4DE743F2957052D3230
          Data 50ECECB6BA813221103BDEC5B9B59F39DA02F418E57C4E5878C9C9BE6ABC2B64C3FDCF
          Data 5026CCEBE4BC487D7DB0E40EE1D5BC274969AC6E895D498D4C4227BE9A75FA407A4D47
          Data 543F52200E72C518CB9BFC6D82DA1E960B6A4DCA5711AD533944F1AD5B9E89B88571A0
          Data E2D7B3D032B40CE2639FCD4B0662D34F961966CB7ED0835D1B1CD105791A2D0A011C4F
          Data 6BB9717BC0AE54FEE4FAA3A05A563C6769FEBDF125D6976F5E1766DF04FEF8F6D8F3E6
          Data 4F2BEC6D34BA40B61FBB06BB4675609E8E6B92298DD2ABABE056DF382828FF6BDC10E8
          Data C2885716A1BB6E5D946C6B9958C67D2E048AE2F02DF88D7A0992612F732295CC71660C
          Data 6648CD39A841089AC82C77FC62EF0E7CDCAF95DFEC28EDE96EEFFA9322936BD5045FC4
          Data 924376B7785ECF848AC34B058BDDB48165962AA88A5F2348778DFA597CB6A56CE003AC
          Data E70529F711A327876F4F2B2BAAC16150BA5F2AA245E45A3B3FAB6312B77EA63A4493FF
          Data 60612208F204D07FF652CD6249AB419F7A0B5065BF881DAFBCC5FA7E0416B541387F20
          Data 462906E1F02022F841CD9451E48376D780FD8E7CF931BB568F39230C30016B01115313
          Data FA146D26D42F081FE451F1D25DE66BDCEC658E81E3EF9783E5DFF14757598F2515413E
          Data C6B4E0C974EEA2CF11ACC7C77B6EC4B79C022A856AEC27EA67BFF1589EC909809E37BD
          Data 007FA6D4EA31DA635C7E2407514E73C715B3BFF5524D848254C10CC9819C67584DB561
          Data 6906D7467764483FC6FA64CBD86990B74BD81816B0CBA7E09C75DBB9A6D072363D2D13
          Data 4C9272CF57001D99599FCAC2BB29A3CD5009485E49B6C6663662B7FB2B58DF597B54B2
          Data E134F4E7BD128C58BBD2FE658E8702D188F1A5436B1365092924A136823835A6B284AC
          Data 4E46B1178BCB77150BE6870A7E830AF70AAE5DFF7944E8C29086C69CB4787950C8FB76
          Data 866FF27D5399E5089D38E984718CABB941D4409250BB5442DC56F9544FEE75ADEFF743
          Data 5360CB23C6DF39C4D9176FFE33A46988FFF3FFDD34C3FFEF4DB3FF2411A61D89DC8A84
          Data DC0338041798C996100A228661867512E1F723382F20A944460B8A3D44442CAF195E2B
          Data 3EA71693214DF12C5792B68CC8CDE9FAA53B57D361F7B8DCB8B23CEDBB73E51562DA72
          Data B2DFED737F7ACE13023B9718B938BFDE655904039F08D614175781A1B45961E2134CAF
          Data 03FC7B065B2D013DC289AAD86E89F8273D1C617E8257690CC2B26321C6DF443AD7F1EA
          Data F0B69341120F85F403C3BFADA154AEF1666B482D42D12235D1383BE0933C307A1DC22F
          Data 8CA4CD95838FCF9503EFC7DB0438DC5A95742BE287E4533E57EF40FE8732697DF5CE75
          Data A1D0E73D100CC758284440471F0125A8D2F8F972492A4DB1EE65E735CC01C9F362DE15
          Data B70111CAFAF3AB77AFC8EA9141EAF17523F49A0322DC0EEBCCEEF77947B39816450CE3
          Data 3DF02C5F6FEE1A0F05BACA0E0F88F9F311F0394CAF1BD3BB074F3FC523CD83DFA02CE7
          Data 7E8C8FBAC6E8CBE25F1869AD931F18C65DBBB56ADB40843C5E74E0454D5CA4DBA1504F
          Data F4AF3EC1DCF0EF9AF2C77BF28332AF74EA972FD0C51DA5A0DFB0707D3F895566E41189
          Data 5A8DC6809FB9D698A98C0CCBE5650AA100F876E151F93B38D2217BB18BF1204FC1ECAF
          Data A31A5C8103EB1257D8ABAAAFD4F21993C1751ADD6AB28FFA586EF0E19655CB90DC8F57
          Data 56E49F38BEBC24DBA379416E02A53F8BC6D9CD2B4F13FD92994E26D69B14BE01735F9F
          Data 0B101DD2C7EDFE1460F8A469FE0AD6080F1F5E7B9B630B408EA0920DC9849FFF0C4AC1
          Data EFF2D39934623331A9CB31A2A54E8F5F56DD7334DFA372E7C21E29A76E9255CE770635
          Data 9D57ADF3DF7629FB58D36ADFCB96935AF629A941770F2DC61B98ECC4DEBC202374D686
          Data D5B792609711AE3EDB4117BF9BA52649D4731167AD3AB61821ABC25BD6B40ED27EB201
          Data 709F4B190B48A982EAE5522476B3E0EFBB45C9782EBEC7F2F947E15B06965DA1111720
          Data 978580BBE6FAC17686CA252A7EFD3ED5529292E6122751E4CC8C48B6C4ADAD2C627169
          Data 027397B78A32B77623F2237CF9B2047DB58CB46BBAD81E175A446E781FF9BDE88150BC
          Data DD83F567179E724B0BCD0A1128E644BEB9B77692FEFD35741E346B0D52CAFE69F7A76E
          Data 402E63B9DCE8122D5132BC0C5908B1F8D718E8FD9AB68450881FB9F03773B02E1ABB9A
          Data 6175748D6F9FA17B2703F7CFBB68DD0A980CABB44FC29EF17AB709DE1F39E9BD7C3E89
          Data B1534B14EF498C3747D39BC9212D27A784E93DA88230553B8CCFE6EEF103142A9337A9
          Data 810480C826AE73811E456DEB7030163270781E4856C6571D8D0FF5975A32182C265A79
          Data 86DC1200C70FB9D741F8AFEAACE44D3AA400DC8BB4C65C8E6ADC13C50A9C42735BCE85
          Data F4594B7F8658D3081DC45D595392B6FC421DE75B511E1B28BD72CF92ABAD8734BF6398
          Data 1F7D5D6D960CE712B4412CDCAA8FAFEAC4049077FE62124A99ED6BF71E57774FFDC6CA
          Data 76363E4D4DCE60D020A5CE3C71FEA5FFF252FCC3A4E405EEC4B9DBF31AFF15D2ADB72D
          Data 1CB145A69718E82C631DA535BA196A09C6833C39AF3EB49230A7F2C84599D4D9AA8B1A
          Data 11859BE1A70DC0CE58561FBAA4436C50D217CB14F776E909928F39AC3BB458CCB895DC
          Data 3EB44CC978082352FC2DDE944D3905925FC82F7CA2E2E7AFAF0C89C50F6F49B17AE00B
          Data 9979FA142DD2B4155CAD9153E718EB86086DF74C052343D2974B2628D29EA04F270481
          Data BF799739B83F7EA271FD1DAA32093BDBC528D7ED3346CE07138342A36B2E1F1F83ABE2
          Data C2535BB7F24198F722AF8F9A2E90CFAF08202291DA0390798DEADE6B1DBFD9543DE19F
          Data 5CE7919A4C6A3077ED45C3997E79DA2E7840368B0A7F5AEE887069D75F7AD1F654585A
          Data 4814CBDDC55BA64ED3104CD9C50F4311384E4384E8DADBA90D5B46B304AAE14D8E9A6A
          Data 11CD2D067B9127C6167F0BC5B96E01D052912118FBE37806A2F5EB6C8344758864ABA2
          Data AD423D8317A6ABA57D8C7187E831CD4F14EDDC74B3E4C0FCAF5D759920016ABA2CC675
          Data 2BF919B2B38532E59304EB21634930ABB6E754858F80B6E837ABB48CE302B733DAB888
          Data 280223C1569A9FFE60E1358C097B264A66206A2A5BCEABD412842EFEDDFDD14CD137B1
          Data B5B9FE2DFAB199FEED82B3A8BAB5AA0FDA44ABCBCB1964839FB11E23F198451B81386C
          Data 0D9B32771AD6539F165F89791A90A0A0EF5D25455C79F25FBB1CC192ADACF91B503F42
          Data D945E1EAA349EC57E352EFF07D2D187C60675A442DC172174F68A107167BF27F74647F
          Data 1CCE16EFA9566FFDCEC51CED96D88A7C901DAC3165CD172FCE8CA8C27C812E0E1D175F
          Data 4F55E45D9465EA617F678A1A4F5F63470E0B4E3CFA880D30214B7DF0DABF58A41EDF0D
          Data 63341BF1373F75435E630D159A4F873FD45744879B7DDEE4893ED46B330DB08FA18ACB
          Data 9AA1E6E286007ED84F99E9C1C02FDAD38C7F251EB7EB3EFF6D4F897DB550FD8914BE50
          Data 3C3A82C2F9E0A1714123007C0D2D3910A17ACBAC37083A33A04CA7A204056878FE3A49
          Data FC3491B1761930BFAEFA536888B39D66C5ADFBFE4580F2D1CDBE9C94C904197BB8C85E
          Data 2AFCF1B1B0FAC5CB1AA2215CD6877BF986AC2114677CCEEE425423DA77D043606A12A5
          Data 8D96A0D83E6A1C96D80EE1B48954E75405CD4440C6931F48993CF841802E2D50900771
          Data D7DF93AA708CCA6E30CC6ED892322896EBDEE3CEA64B6548A841EDEF1A4537C202E753
          Data 1ABF4F873C03E079094BEEB185BD693CCEF94CE35EB94A35DB9FF7F1742528F5C2BF27
          Data 9AF090E6585210E192B873299DCA2388731B402253C4F66D0996111F62C690CAE5DC6E
          Data CB46D98AB91D8B381DA2491C05284EFF0E982790A379E5653C31524470C2073E648B45
          Data 2C5842156BCC1CA467676F5FE191020F72A68017C3C70D54FC620D021EC5C373B9DFB0
          Data 3CDFC3AE0A772A967D29DE3A4D9DAB4A8D75F313E691321CAC7F7FD82E373EFFA1F5D9
          Data 0DE62E54BA825F1EADEBB8567C56D2F19D7DE87A30569B282D786F05971610AE831F9E
          Data 2A58191DCB6CFB2742EDE1E3639D246481882E14931B9649CB02B0AFF4D1D2F0099FA4
          Data 882D4E82EE1E79051F838D130195D138D36E3E35F0D4557CCF98FC232547869A0FDE12
          Data BCE2C392A4F2A202453F05D75DDEAE86093DFEEC51EBC80A513F734F0C190CD1C0BA3E
          Data 24778F602198ED4F96FFD5AF3A4F93A9BD74E07504D6317A0AD5389AE5C57B1DA28D45
          Data CFC17B3B3CA936AE0A733F1AA3E1DD78AFA73685CA2EBFF03D5BC739A1A115DC16BC58
          Data C6D5435DB2168123AFE5BBD0D421A33C3647BACB6FF94A4968D3BC2729B05A0B3720F3
          Data 6A112F277F9E426C6AD3697C412E590DF0BD5CCCF1B2B051D71BA4851FF8D96ABFC0EB
          Data 701D450B7FCEA886915BEFBD6324DFCE2B378ED85823F6F55FA93D1A43889B7E878D70
          Data 37A2F18FE7B0CEC7F6C291D96B7B1D76D136CC9D454A539E2DC32C643D19E244E9DC98
          Data 9BFEB54EDA153B8BAAE8F8DAEE47505DF4CDF58FA7207194266AFD0A939755E6CBCF13
          Data 26F820C8FB6311133D117E1B239EC8699290E85896DBEDDE1F09EF28F9E459A71CBF91
          Data 78BEB80F209F3770A9FBD57F81DB0782CCDD6330046F0B77756B48BF0C3519C1965496
          Data 527B94E629569C1404DB233F970214094B399408A2350A8C5C179D103E578A471ABE5B
          Data 5F322FD1495E288D618A41340447DCF6713946DC26694D8B5D988DAAC34AD0533E462D
          Data 404DDAF8B958024035467993B7E3FB52E35A79A82D7F9452191D14FCCD75C89585F1F7
          Data 6AD6D9C1BA787CC60095CA722086EF760587207B14B12A4A7A63F24CFF8232D7BBD2F3
          Data 175205B7D1063668A85EB737E60DF25C5441EC7430194A79A01833EE61ECFC85317CE3
          Data E1ECF14DEBAFA16A9A28C04A2DCD4ADCBA81117E79B3FF81CB41945C73D2767683A854
          Data 24E97BE65D19E34FD4B72CAEE43FE48371B5798136D922EA34B7A034A3723E5D80C34B
          Data 9A6E9AC7936516C4D5BCE96FEEB2F7D46ADF1712353CC51F1FB32894B451D46248438C
          Data FA7E81DA69AEE134354BB9AED97460A9DD434D8700B6E22961B49993192953CC514B4F
          Data AC43CAF864968D3804C38BBD28E790CC2B9EF3713C8A8BB9FBA95B7F8D9E16CA68EA9F
          Data 33996BA3DF6262D744EB849C88F3EB8A91C6A1EEBFDA2BC50175D1523FBFA0017E42EE
          Data 8AFEBC5623A21BCF9B4513A234375DFCAC34FEED80EC415FCC3B74F91783378462006B
          Data 2D2A9738CA5FB63D1ED26C456832EFD31B8CA8DF59FAE2B511456953554999C4AF68E3
          Data 67591AFEEAAFDB5FA50530A8B7F0B560DB13FD6CE7E2330548A1C719B5932C6A4B28BC
          Data 4C036DF8DD734C80A5D7CE7E4AA0273D05C5DE92C4DCBA542D6FF974143D632B64DE68
          Data 611286BB28A15B82C3207072F68DDBA55D5AE6030B1D7AA35D867B4247AB61C152F668
          Data CF25BE2CC770FC06A33D49B98A6AFB8EB27279DC0F02C46BC93CFAA8ED4546F8A80F59
          Data 08F2338387069FC06ADAEF5185680C1910D5D6EDC60D591E08A1AB14C17F1470387D9E
          Data 7560E16A708319DC9649F92D5DED2BA3B067B6EA46D2098D704C56BF329A8ACDD99C59
          Data 39DE64FC9927ABAD7DB1452A4B9DEAE31FAB18EC6DAEFC9AB2D80391993C88D8213F80
          Data FECE086865FF0D8C72941ADB1C078ED60718E23CD489F71DDF48C998E0D32A19E015A0
          Data 46A8FA3F1F11810EDCADE801242FFE5A485C0978ACBB0093983FDCECEB6B012847436C
          Data 89F679BD6948EAD6367BEB22000497B892BBC2663CA2B0E079CFD8CF048A23A9E07CDA
          Data B10CE65CFC3053675AE2D749762227532594B25D4A5C20CD10E902F9CEDD76E0E1ED94
          Data D399D1F0B444DECFCDF858E66EF19D183BCBC4D3C925EF23781ACCFD4286467DDDCDD5
          Data 5FCF79B6DF46852DB6C5729E4E543B1F519C551428F2BA81DF53AAAE7B288673A5C4B4
          Data 8F6CAB28D94A345A344232F8577F2CCA70EC93D9E58F00F9FBB1C3752F1791AE753D64
          Data FDADA68C8B595F099BBD78E2CE563D6E8B47468AB3229E5897A4F22085214E97837341
          Data A7064B233A30D29CC017CF690C6723FC80A63E69D7710D14DA5FB49CC629B502123A23
          Data 9ADD3D0E5D481571280A193D8CAB1E47C938A06FD7186A600344ADAA00C8B4445BEFC8
          Data 01333D7CD4475974CEAD1D83D823B133AEE180F3FD8838AAEA687CFEDAF0FB7DEDFAD9
          Data FEBB68B2F0DF9EF465506C51AEA46348340A37F736FB5394E8F7C555776335C0CBABDF
          Data 52FDF8806D0D24E37D77D90237BF7E81E183DFADA3217ABC699E7C5A2206F031C261D5
          Data 3F05573E6A539CEFD2253B38F709F5EF2A7546DF963FA07800C8F76F9D6EDEFF14A98B
          Data 52AE87A20418674674D1F31E54A88B187E18F3C11D41066724D3EDFC2B58349F4E4802
          Data 51C0D218E614747AA168D3656F7D919BD7121164C3AF82634BB719FDCECC1958BFAAC5
          Data FE82CAFE7EF308BFFC61B6B581F3743F017C3A83BADD5FE23CC4617C1EF636FCDAD2B9
          Data 0D4DB97B087ECF64D8BDCD65003D7EA0339AE7DA3F2B711FBA94913412941F2E927823
          Data 615F24D49E04776D3BF9E298A35CC6D74D3DE21768912FC160EF1F1852477C27A91B11
          Data EC5A5F4855F6497153F4F16173F8E6747593B84A2D38B34178429DDD177080AFE8A468
          Data 7C0AD7AD39F6B34C16CB9779B1B55156E0A416576661281664A7C1D16FDEBC48E77FE7
          Data 297FE67ACB666874153B253CC43BD1BFDE0348095261DB14C0CA48620534543B805135
          Data 566DE70D6C690508BE355FA918395B7BECC9E8D77333E91A5EB09E63F378CAA196711E
          Data A45A60297E5928A709D303157F292F67D9447915FA5146B7391DC3A4C5E89A82154DCB
          Data A3AC238A552C7F2BF61ABFC3ADFCAB59A3E7999C868AFF328B6F18FBCE07CF8231F816
          Data 2EFB6EC4CFC2B64291A1F2E188B89FFA8BD2DFE09C593A95D7B17C207FFF75BB068DAB
          Data 17A6516A4748C5EA2A6CDB693B84B805F06AFAD1245712DE6A372A2736FF15212915B0
          Data 0299D62436E860121F6BC441F967FB4ACCEB9F2A42137D637A39C6564AA684ED5D1AB8
          Data CB878787F1385C9EE4E8CDD8699DDC971D04835C27C5607216E6F3298CF1584B9C599B
          Data 769EA6EE73CA2F557107761977DA1327EC6F378951CA74B1B5A6C84FE8EC32CE7FF369
          Data 52C1755F1671DC6D65B4B4B46C9E8F00E43FAB9D6C108B868FB6DD68E9AB7882B7DC0F
          Data B816CA710BB28DAA8BB70EEDA49BBE064FE77B9DB066FC967B219219AE0EFFE5F970C4
          Data 956AE910F4FB17C7D77E44FA05AC51968DD93780078C9BF43E4EADED1217C4AFDA8648
          Data 679A20066C6F7E1860AA3AC30A0E835A332EAE563898A6A9BAE20A0E197BFD909A7A27
          Data 4FA1F99BA5F6F9BBCA4092D9B7DFE53F1DC8A6073517E3B54BAB0298DA83E2D43E1223
          Data 833BD317DFA87BD5B1EFB2036CEE6C01FA2549267749AE22DF4B5BD93F0B330F99BDB4
          Data 9CA34AA7AFACCBF286A549D8A4F79B147FF9CE9EDA4B6AFA86A58A4B14878E09236769
          Data F5F092C96F33E7E573261430E4162B3FD04C12566FB6E7A9AB752AA0A4B4B8F005FDAD
          Data 2FDD61089EFB81047210268076D95C8739A6727E9D955B4EE9B91D08E6C9A67F7A7292
          Data 0BD28FABB9C17253A7D7F80540EC085CB3C9F94B9CD2C104623D81E0553606B9511684
          Data AF42AFBD3D18125679D5165B5931F2EB3522503708135E3D95AD46A0BEB1D456721639
          Data 0B6848F861EB64B2D7F8EBD512681671F4E61C2BF80C7104D09F16A5F7AC730D7C6667
          Data 0224347EAA64BB13D44A199B814E654D7E0CA1D2BBFE423C9CC1EBE840327546341674
          Data F13A6DB08DDF53D4D71F9C87905CF1B2A93B210E426082C3D41263A3F9DC63CC7E88AE
          Data 7B9EAEAC6505A11B5580F92D850022EF98DB46BFD81CF4901E351BE5AEA6C91DD6C441
          Data 0BC07DA9006F8D9BA9205B9D186817446A8E50EDA4DC6685C594C006AC9C435472AB99
          Data FE2A56E78065F4281AFEEC4D97C2EDD2D5B7FEBA5BFAD190AEA6CB1BB04DB14D93A84B
          Data C29383AED4940A583DC38E047CAB960B4AADC47A492F970640CDB9873FEC53F9F5CBC3
          Data 5ECF681801A99FF3BD8153879FF270E7AD8AA5FAA5026C62120E4467F7A9A6E6AE4A4A
          Data 5D15D3009E72E1976A7F4CF539B88425F7CA01F0FA4130E716
           
          End Sub
           
          Sub BinBas2( T As String )
           
          Dim a&: For a& = 1 To DataCount: T = T & Read$( a& ): Next a&
           
          Data 2BF3F45467D5AED0FA22B1DF81D1882E8E7127A80D7B0B78395027A30B3D0DA3DD17F5
          Data 9ED1A068F8A0E161B13CE1F38E9ECB1DA0F1C75C9CA37FDDE42DD8A9795D858C32109E
          Data 9E554C5087F3C8710465AA327DB8E98EB7E402879BE9DF82F6B0F3CEB18A351E716E30
          Data CA9FF38B6DA913DBFA938BB6D23D3D105ECF01AC80D3E71C0839726FC895B8FB1B0E33
          Data 6854B8545941BE86FA0BD1704521AD8F02CA4DD376EA238FAD31B7E3538B01EF29732D
          Data FCA0B7B10919D8BAE7B138C3CFCF1BD84196F9A8657CF423BD13E93903BE8308536E93
          Data A5D6EB58D7BE4584DEFEFBC2772F4D64BA0BA615442A3E4FEC9600BF6FC9CA785DA97C
          Data D3B8D28AA93DF1CCDF94CB045EBBA95A5DC93DB9023C5568976A98B97346A84F628943
          Data 14644E9C4AB46616C993E0825933D0AF50458997F232B3BF4B5700843091E246A92089
          Data 7880A7A8D054BE461BB618F8F30F3BA25DFF98A50CAE04178FA6B4C6FB62A8FB4E2D8E
          Data 131968A1537B67984EFEF3B32F4042E56666D3E47766FDE530A617643F2A70C8EAAC62
          Data 03A7D6A6BE10CE387B04F36CE2C60C01CA918D167757563F7C1E2E5F2E87103F24DF7E
          Data 11D067674E1AB6D294C13956222BFD811611D0B2E44EF25CB12BF820CBFA0C3B43F4E5
          Data 895827D9472A7C56FD8D314212B0A87147A5462624DA70AE1C42F0E00E56D26207D05F
          Data EAC9E3FD3124212BBD3FEAA19CD9F63375232C9E051B4F7E9E9D8F1050D6BDCB9F103B
          Data 6D14728FF906B25D7DD536F93D26284AC0D7D470F18818AB4C12C5525BC59E694AE350
          Data C090077ED443415C736344132153BB91B68A91B1CA1AD9FFF81AA6C302F2A0A527AE2B
          Data 2949E2D7CA1D767D0CF2727A91A85D4F267731D57A5EF014DC885FCEFCF6ACCD720BB4
          Data E058DC93E3C4287604EE2DF796F34EC962AF8CE516569DB0F3573563666D519C64B637
          Data FDA0637BCD07E341828B3608730050DE92173315D7881EB364AF7A636B99CA4772B846
          Data 9076783281DB4AF7EAF20EEEBA3CA73E5E6A8D77DAB30304F31037DD91B9B6D52E3669
          Data 3FFA58AE5F8A1EDB5582473EC531385A1FD03824CF5D3B0439448E7D4E348B1160CE95
          Data BCDD30DD7B2BBAEDDE76E4308E907B77427C6CB2F173225618921E0129E82674090A30
          Data F3A1B66FF1D99A2892F632CD9F536A9731F153B96850F0C5712A8068A471CC3619AF78
          Data 64DCD3FE9D5C08567AF35334AAF22A3FFFD77DA34AFFB707CE2C46028821A3DB2254B2
          Data 281D4FD6DFAA56F28B7CC3BC44C6AB3C2CF70AF68A808E0F6BDAB6042BCAFA55D33AE0
          Data 19513267D8970BD8928B81DECD95D793A2D9DCA9F8E3C420F7E2D3EF0387E3D3E0A799
          Data 40A58B99EBCBAAE35D3720067CF01A2100B739617D306418208BA917E5CEC2C7727A5E
          Data 3764A7B19611EA82D7A6336F79866829F7E9C713E914EEB9844F77BEFE1054A0EEE8DA
          Data 4A2A3BAAFC449D35DB4F71D97177F1734D8896A79E816CA00FFBBDB1C3B651025CE366
          Data 648CA2881F0A248D4F6B71F9D64E4C8C121A89BAE20A9F46C6CCBA7CBDF6F65120A2CD
          Data 026FA9775912A1857C0273A04B9432A591F8487FCD28B3364A700D3D5E20FE7876B21C
          Data ECF215E69A9BE5311FE542C4BC9D22E040AEFD420F89387E0A1AEEDCA265D93301F144
          Data 458E8344F084A7DD9B3CB2A4F8DAC976E851B1A01E83134B575412CB1C1A8943E1BEDB
          Data 6A3B5323654717E2FCFCDA3848FEC2CBEE0B467D6A0B173D7856E3CFB46E2A7B451ECC
          Data D11CBFF3B2F8850AF06FE449CCAD79B6A583612942D4C15613E7246263764837D78C66
          Data C7DE6AFA082D4E246F65EA35DA6C65E70E977982CDE46EBD3E2A1F8F95F457D0996EA0
          Data 34D013A427293167E57ED12B0397ADCB00BAAB6C2385F0B29AE00F6F01E7FA01CD96F0
          Data C8997E0135FDC8A8C15CBB42C4337307DC4BA3F5F08E0E8D8BA46A1F181F1EB88FAF0A
          Data FA51986C5F92598877324AC42A2DCC526C584502D54933E6369D24787F03349052A146
          Data 1E9BEB9F3436524CA3AF5439CFC467DDE2FC30D97B621FCF2E32CF2553E12FACDC70C3
          Data 81DE1440AE68B7EFF09DB3411260A3F976B12F19EA1D759CB0930A7AB61A0FA0755268
          Data 1CC0507F9643CE7D1E24A599BF651C05F08F02A32B7F0CBE6FB0BA924EF3AE8C166852
          Data 76CA3863A60580FCFCFCB27962A389375026619D184F01CF46B754759FFC2BED18F38E
          Data E678D1768D8E82604E5F59AD586E525BBFDBF67D427423515747BF06FDA837269145F1
          Data 8C84544EF3E56379F5FB935369F65AD9694FA479BC8BF78DF99E22C6823AA31425E7A1
          Data 624D122AF84505E2BB61609B24646909FDA6583AFD66411CD8EE59F1293100906B0C93
          Data 3CB5FFF1EA2F01099E87E76E95C1EA752B5D7064017314CD02B9978891DFD4DB8DA366
          Data 3F56A7124C08A9372588D81048C0D7CF4E92AD23F14DBF5C70944954B49404B4DA251E
          Data AEEF30527C55F14BAB79B370B00E7CDAAE1B151691DDCBD9A4AE5F939CCCC816DD69C6
          Data 783A10B396814BA5AB1C37A69F3088A5CFBBCC58A73DC4397C8C6572705701D56ABEA7
          Data BAC4DFDC6AF74D734BA3AA98AB34900A293287B9FBCBA552447E96A283CDF6E162A49F
          Data F636701D7A8F70CDA8F5B4543B15E093D816EEAEE38E3340D7C89F3C94A03F1B2EF689
          Data 1633D577A5DB76863F60A60166588B8E884B495BB0692721ECAE46983C912A2B944FF7
          Data 3721CC90F1D26111C659049FE41CC439F1E0CE22B29B63A098C8E818D3DE14AD89928D
          Data CB3A7AAB335A8ED12D4A60CCDB69BFD78FC03B34B50457CE7C6457BCDF47C11340FBA9
          Data 25F1187762F7D4DE5D56657A33A3B2E3ED869398DF97DBFB67415D5613F6A9F8CFF805
          Data 3D35297DA44CEC5001C1F7D97BC5348905C43A4C9D243D35B50BB5373737C67AD5A757
          Data 99243D77210378A1E8551AD11F6C094A0837C44235BAE2BA8491C04E47D9FDB9004411
          Data 6DE59660BF3E32255835707CF160FD3E2CBAE770FDB6F35D8054C26EAC80D556AEF0E5
          Data 414D24C51B2BF1F5A8C25D54533C43C6FEE258C071DAE5534532A4221681A5E128881F
          Data BAC3C763792F930D3B90252F2AC03C72C7BA9ADD29B97C8648D6EAE464A7D596EAD425
          Data BA93B3464EC19FCA0455D8C62EB13BA2CCDEEF96B3153ACB123C473DA3B7199F187B53
          Data DCCC5F4674704F67E68FB4382735FBF3FA458CACFC1E2B066835043AEA66F8E8C0BE5C
          Data 0E4EC20D127C6273B09EED09FEB5E5B2107ACAF8AA40A9E2FE19C1D24B8777F0AD6C90
          Data 3B9C4DF06B2D4536CCFD07C1CE1F89DE88963E218DFB8546AB87F8FADA650C6872ACBF
          Data C5BD699A279056A270776BAAB2EC8B922D905BEFEDFE4AEF470771D7093B00BEBF6B53
          Data 588037E71ECD7D7A693FCF5E04450AA052F3E887F14ED0A6750F32F1219C3AA630BBC9
          Data FF786C85FBE77C0EC1C523099B50E59DCA10857A448F60096B15C8B23811C50879F1F5
          Data AB477EEAE844A8953E86F6574CC7C0AD8802291B26A7EBA0C8BB57655ACDE3449F808D
          Data 17A4FCF43B1AB78BA4056624A94918C5BBA68D6E4D26F8D0AC818F36CA872FCB090F91
          Data 176B53BB396EFDDFA07CA19972AEC2FC4D9F4AF721EADE833C60E944D851E58516B33E
          Data 7A6462D058C3D06BE9EFCAE8736DA0C1300A3FDC99EE12ADDDE129C9CA906FF436D319
          Data 508D975AD1CDBCD674903A913879E1C95BDD82FEDDA243BA9F3515D1378B1A6E612A09
          Data 0FA7FB4A0C775DFB1967FAE8E52AA2FAE97F75B5BBE421004726137BA324B3173FB4CE
          Data 90C9A2E101B8D349DE5228C2567103312CD12F5D9E292D941A3DB35D819B45276B6D34
          Data 2FE507B4323D45AF1ECD69261A2C7D13E7829256D3B8E20114C40C5C9A678C312E9B98
          Data 38FE686ADF085B16371A147A8A32AB6ECB72E64067D7FF41F03DA8D285C36BA6E74AF2
          Data 7AFB7B6AC8022793B6338B6C5FB0708C69E3E5ABFBAB47AABE530D93237E4102E09D82
          Data 13CC9D2DD6C581D9061EE525F36380501F57968A549F77572AC4E9E88D1B410EC605B5
          Data B84F70B0FBFB1A1AFDD22E8693B8C29A34E7417B2F93DD0B128C2683DB2C1AD0536DCD
          Data 56602EC5530948EDE3C2DA0906045336BCCE8F94FE5774553671EE8930957D90022501
          Data 5E579E584DF4CD75790B03CD802EFED361888412C3EFAD2285A4F3F11B0716EF5F2D03
          Data 5CC417B6ADBBB80A52B83293F6AFBE1311DB72B869A098245B474D38026255139B5730
          Data 4BAB3EC6E49B27C4B6DFE2D6B7CEDB3D417E97AA623E3C9CE9E3DB0D00513ACF6EFAC9
          Data 47BFC6E6F77729C26B9294993DBBB6740490ADA6DE1A6E03097F39B4EC981171526F82
          Data 21AB1E1F608068DB0DB0948DF25CB3BA60CAE1E2B2A4FB1653DF12FBBD5AC2F722F483
          Data 3F259556E86C3FEE0179E3A6D74C19714CAC72610030017132264B124F70645D1FB143
          Data 5FCD654BD19E5455789FBD99F8F943401A6EAD27220E55E08CFC71B3823AE9D4E9D77D
          Data DD459D70EBDD6BFEBEC9358E42794C3BFE58B1A27DD763BFCC0513745EA2B15F1BC7FB
          Data 11D8A94A8D8E4CEFBD33713693035A525BF93C99EEFBF1073B8D6BBED326CEA73E7B87
          Data AE669684B490BF01B121FE68975A68B94D59D1F5C7AF4227D5188037E2DDFE31DBCD5B
          Data C971C641983534C137872F571F7CEAA25B9C66A063FD5928A722CD7EA51EB50BCE552D
          Data 00E69C3144AAC6E2B3D013D1768F796951FF44A8FA3BACEA9CD7973AF663116229AE36
          Data 2F6AB25E0A90C34D465BD0A7646BDD8C98A83FDD8F121C34F4C39719B912265AE694A1
          Data FAF21F5134B4F10DAA3C98052D72337D82A5E9E01F773E211A308B6C69AAE7FABEB518
          Data A3C508557D7D5B1AC5DC23C876BA50A1F7FEB800E566287288FA2CE8697BD60DFE3888
          Data 8B7BB9EBF125C4B35313751DDD57238DB028B2A8778E6897BE3464397FD2ABC5A7532F
          Data 38C15B9F25434B32626FB67F103B6BA07EAEDF183AE7A0286CCB11652C458D1392A58F
          Data FF83B1ACA29F3AD77E8737C8464B32D9DAF27BE5C7987214F87BEA030AF932BCE81088
          Data 4A7F0400241943E9E6B619209A7A9E1AE0C7116E6623457DB8C1D69272FDB57C9297D8
          Data 6B85F1E64D80ADE02276B6AD606623888CCE67923C8DF803A424BFAE413CA1E8B26DCF
          Data B9C36A2D9C75553C98B3FED607682BE32F66C2F18E178178EDD9F5B817D84CAE4439FE
          Data 344C54B93B8F2F232F1E66FC1BC4717CA0FAB9A878DB9989F666D78C1FEBAD4A698B11
          Data 1A9DA6102B468E9E3A9B9B5EEAE2D85E14A8366FC40EF24444BB5763255192730EA4AC
          Data FBB9372D3426A5AE802D22986A20194F900D951EC352F7E5981DB0787C2EA96D160B93
          Data 7E2AAC2D6291A9515136F176A3E9AA83B9D3B7588ACEF5AB9FADCE8A95C089B414E65F
          Data 3852D5D1BE2F3E2698A621008ED6937C106A0854BC057EDDB6B67CEC8D30B9B295E18E
          Data 32924AB80841763F588F11F1EB645EE25F102828B561EE08929196998BC98010A1DAF2
          Data 6FF8260E0253EE0945B180FE96F0FA941E969F0D5CD4A9A5795DB4C1014FE351DAF43F
          Data BACB7FD4A5FF78B50224EFF6214CB66AA4E770D8D11C54CB9B0881215F248C5B8A8D31
          Data 4B334D83BEC63176F243C73246B1582F979EC3BEF19EF645BDE694F9C2B761AB4E7B61
          Data 5298A99101F52646702280E3E08F804DDABDE3889046FA9A69E2E282DB080E315500EF
          Data BAAB1FE644CB98B2D7728D217134422200BB39EAFC5268AE7F9F8098A9E1764947F97E
          Data E7C44276641167EA2D5FFED4A8B911BD084736A9B77D353DC47BC5B616074110CC5815
          Data 2F32A9C65C90FC89B5E8B90AA2F0230ECC1DC26BADA03794AB81594A9399DAB15737D6
          Data 650F87B92B3675D090AC13AAB075EA4A1B49EE18EC52D386467922935C323BD57FFD76
          Data 61B60D6469C2131F587FA01A7D5A9514C382DF5CB543DF9DF307EF8108703ED10A91BB
          Data 0BBA5C757EFDC31B3687B7A7AB4F8CA80866291776557FCB2E2BAAF9019675155B12BA
          Data 34C98F8473736309EF4776DBF7F7D21EB3E01EDBA679D0F690C6B09AF6FA37417D420D
          Data 884139AD0EFACF7071F5EAD8FE7B94A0815769497AA1FA834C84E38C5903BEEE2C58D5
          Data 34B6A77165D31AA70C3D5730CC4F5275B3E6C7F38AB9BF7452D5AF9DB23F0073BC85E8
          Data 6CD41E8DF9240788A5AA15873DEBA25F2326DAD7D149EA19A24BB65ABA9213B18D96E2
          Data D21900F69CC145B0454FB14DAEB4453D2BFF4C8665EE147CA4BB9C2B8A7C4AF2922021
          Data D15C4A5F85DA1DC52868AE86F227D3BA89687C9FADD54D0146F19922EB89B36F03EDF9
          Data 6B4EFD1C9A9EEFB6F3D8C6CF80DA616F49BA1F04B359AB54B9A26642E4D6AD6B47F92E
          Data D8876AD3081E279DB6F1F3B5C57A681354D33F94D13C0F939EC9CF9EB68BE4E54A2A80
          Data D8C91A82D2ABEE0FDDFDBEADBA7331FB2A3EE6E66E69E4E77160426F841EF1442489F4
          Data A1437A8F551FC4C558580E3CA2A1D48F7E79923E94C348DF365E3ABDDBAE4500FF2E3B
          Data 7D0DEDF9E1D26793ED7FEE00C87F8D2021FD5574723B58B9797F6CC0EEE325887A9A14
          Data 7D81C3FCBC76619C6F6DBE37AE2BD350F3D78CD6197D44A291E57E76F4A488BB178115
          Data F7FEC6DAD3EA326DD726664F6724019D3A056FF195BAF5465E5874412F50AF48538F6F
          Data 24E29E37AAD68455942C5C2D468165C686D6508B59C07ABD88C44D152C8FA74A37C57E
          Data 29ED454742C8CB86992EAA8A82BE1F1BFA248914428E1CDC3BD306713FEEE1C923BD13
          Data 9B4CC009A20A5DC56FD6555DCB66096021C9FDD59C4473B654ECC7E5D8E9E9042482A3
          Data FC2D9FE91FF934DFDCEE39FF433E7B2F17E7BFE42B886BC00BE5C57D0624C223F952A1
          Data C52EAE3FC65CBD81CCD0A0F2967D530493E043540BD0AE1BF55915F9AB0A3E2429075B
          Data FE6C54CA6EACAEF4EF2997CF33F1182CAD8B5734977B2D0776BFBC99B98C672BDBE7E2
          Data 29E36C099A99113328F858A38F53FBD049FB84FF3EFD6C95EAEF19097FF1E61FE2FA5A
          Data 56F17F6684F5E7AAEC626167F31F956BF03DFFA3724F62C688E4CA376AB83158D9ECCB
          Data D906E7E192454E06C2CD2A2F1BB7B8243F99B1FA2CA8702E156CE607C5127DB2145647
          Data 1DAC41796329331A5951CFF16EA83BA68C605346C5D563C29ACD936DEC524645F9ED2C
          Data 26D7107254F20B74F01827AEA0C91C1A5EEBA3F475EF72E0F33BDD0E8CA0EB3991C05B
          Data B0414E154B83866BEE9E71B10FF55C20318A9B4DEF82B628B0089F540E2A724A66DFBD
          Data 6EB0688B56F0F00F05FFAEF0E6E7209E9F2DFC3FE2E0FCB9EAB8DB5838D978702BCB6A
          Data 782749FC110837EAA9420917F7193A3983AEC290CA775C11E5E18436F93A822F561801
          Data 8CD7C5948BCA84B870D860522752BF634DE4C838120B7D876EED113AD5B13A9CE5351E
          Data BD758C4A6CBF20845B1B552BAA229D11A47AF983B9D131EDEBCB5466AB75CEA58FB131
          Data 6DE51A8FE4172098DA76BE4CB5C96958E77A70294D2137613CEA3B3BEEF61AC59761B9
          Data 731850A7D55EF963AE894B67B22FD010BF7FACEDC0FED849C7163753F63FEC44DFC1C6
          Data F73F2F25518AA88FEE454496F25069DAE8C234A0B07789F1ADA1E1BCAA85C5704685F6
          Data 7B021C1C76E5E83BF3A173BBAF49DBE1682B48AC99B394C51F51F465DEA60AD568EE0A
          Data 448BE5489AAB85BD209B10D34E4DC7D0664F4E55FA4CFB8DED3029BEF7F3AE79C3CDCD
          Data FE1EFE96A814A0F5F215A3E2CCA0ABD394309F694017FEAE9F94F2AAF8357D7A70D81D
          Data 955ED7B392AE8F14DDA7BA5EB23C61647FCFFE8BB12DFFF36B4260EB9F990B3F4342C2
          Data FD33AA69A9A4ABAE266FFD970465A9BD8E8BD27F3CF99C1DEBB323272C5DBA77B46CAB
          Data 62AD0447FF0B14C6D1EA36A51A2BA3BAEC941825F38E7EAD84FB70AD8446E6FB366B1A
          Data 8D89237F410AA73136B9B67855C16F046CBCDA8750DABEF752B2A280F84CC192201D11
          Data 8403A75B68ABD6C3B226CADF281804C4C763BC37417FC91EDBA85FD5EAD7F3D7CF2F8B
          Data 86ADB13CA1450A3FC38D3953278DE488EE044AD9B319BDE4CF84651639D02EA44818D4
          Data 82483817E6D8477622E922CB423FBBFFA0EEBC1D730F36E13E73415AF2BE8374A2B2E4
          Data 956AC169E0C1B6A975C1311D3EED707FA42DB349B3EF791641999F9382FD35C2D41E06
          Data 0E0A3748AF0DEF576F9AA06AEB25A6C155C14DA8B701D6BB73DCA791B9F82D6802240A
          Data FDEBC260589C6425361172BE971672B81C925D817E28A2A4672F07490A993504C5EB3B
          Data F324EC3BBAB42AA1231257DDC34B3AB4F29F949FF03E0BF5A884AF0AF51463D9BFC3F0
          Data 100CDB5012FAD444191A825AB9DA8D520972EA6CC8C3D8519E9034C39B0F3E70BFBE8E
          Data 699C8BBAB4DAB827E8E46F35D191F48B385E315FCA19589F5A2A2497F061C3C16793E0
          Data 4BEFF0623A32994FEA7B8719384ADE6D6D61643861E2A2309DE0A76ED07E6AA6A98A8C
          Data F202E9FF7FB0FC7F7FE8909AC390FEE598F93FD1FF764AE76FF439F6FF3CB3F34FECBF
          Data EDCEFD1B2B44FCFFECD5FD27F8DF164DFF062FD2FFCF25D47F62FFAD27FA375694FDFF
          Data ED90FE13FD6FA1ED6F749DE8DF81EE9FA87F0B187FA392C4FE0E1FFF44FD1BA9FF8DA2
          Data 17FF07C5FF13F66FE4F937EC4CFCBF51E93F81FF46577F035B24FE26AF7FA2FE8D26FE
          Data 46794BFE77D2D0544543FFEB3F9C3FDF2014242403C05F77FF0B504B01020000140002
          Data 00080000002000879B349A863E0000EA4000000A000000000000000000000000000000
          Data 0000496D616765732E7A6970504B0506000000000100010038000000AE3E00000000
           
          End Sub
           
          Function PbMain
           
              Dim a As Long, FO As Long, T As String
           
              FO = FreeFile: Open "Images.zip" For Output As #FO
           
              If Err Then
          #If %Def( %PB_CC32 )
                  StdOut "Error:" & Str$( Err ) & ", Press any key.."
                  WaitKey$
                  Exit Function
          #Else
                  MsgBox "Error:" & Str$( Err ), 16, "Images.zip"
                  Exit Function
          #EndIf
              End If
           
              BinBas1 T: BinBas2 T
           
              For a = 1 To Len( T ) Step 2: Print #FO, Chr$( Val( "&H" & Mid$( T, a , 2 ) ) ); : Next a
           
              Close #FO
           
          End Function

          ------------------

          Comment


          • #6
            please, any comments here:
            http://www.powerbasic.com/support/pb...ad.php?t=14051

            regards,


            ------------------

            Comment


            • #7
              'MISSING INCLUDE FILE
              'Save as DhtmlEdit.inc

              Code:
              ' ********************************************************************************************
              ' OnEvent Functions 
              ' Code generated by the TypeLib Viewer v. 2.00 (c) 2003-2004 by José Roca
              ' Date: 14 mar 2005   Time: 15:14:07
              ' ********************************************************************************************
              
              ' ********************************************************************************************
              ' Variants can hold any kind of numeric values. When returning one of these values you can
              ' assign them directly, e.g. @pvapi[1][email protected] = -1, but when you need to assign an string
              ' or a variant you need to declare a variable of the appropiate kind and pass his address with
              ' VARPTR. Strings must be converted to unicode with UCODE$. You have to manipulate the variant
              ' using pointers because when you assign a value to a byref variant with PB, the variant loses
              ' his byref flag and PB doesn't provide a way to set it.
              ' ********************************************************************************************
              
              ' ********************************************************************************************
              ' _DHTMLEditEvents dispatch interface
              ' IID = {588D5040-CF28-11D1-8CD3-00A0C959BC0A}
              ' Help string = Event interface for DHTMLEdit control
              ' Attributes = 4096 [&H1000]  [Dispatchable]
              ' Number of functions = 16
              ' ********************************************************************************************
              
              ' ********************************************************************************************
              ' ProgIDs (Program identifiers)
              ' ********************************************************************************************
              
              $PROGID_DEGetBlockFmtNamesParamDEGetBlockFmtNamesParam1 = "DEGetBlockFmtNamesParam.DEGetBlockFmtNamesParam.1"
              $PROGID_DEInsertTableParamDEInsertTableParam1 = "DEInsertTableParam.DEInsertTableParam.1"
              $PROGID_DHTMLEditDHTMLEdit1 = "DHTMLEdit.DHTMLEdit.1"
              $PROGID_DHTMLSafeDHTMLSafe1 = "DHTMLSafe.DHTMLSafe.1"
              
              ' ********************************************************************************************
              ' ClsIDs (Class identifiers)
              ' ********************************************************************************************
              
              $CLSID_DEGetBlockFmtNamesParam = GuId$("{8D91090E-B955-11D1-ADC5-006008A5848C}")
              $CLSID_DEInsertTableParam = GuId$("{47B0DFC7-B7A3-11D1-ADC5-006008A5848C}")
              $CLSID_DHTMLEdit = GuId$("{2D360200-FFF5-11D1-8D03-00A0C959BC0A}")
              $CLSID_DHTMLSafe = GuId$("{2D360201-FFF5-11D1-8D03-00A0C959BC0A}")
              
              ' ********************************************************************************************
              ' IIDs (Interface identifiers)
              ' ********************************************************************************************
              
              $IID_IDEGetBlockFmtNamesParam = GuId$("{8D91090D-B955-11D1-ADC5-006008A5848C}")
              $IID_IDEInsertTableParam = GuId$("{47B0DFC6-B7A3-11D1-ADC5-006008A5848C}")
              $IID_IDHTMLEdit = GuId$("{CE04B591-2B1F-11D2-8D1E-00A0C959BC0A}")
              $IID_IDHTMLSafe = GuId$("{CE04B590-2B1F-11D2-8D1E-00A0C959BC0A}")
              $IID__DHTMLEditEvents = GuId$("{588D5040-CF28-11D1-8CD3-00A0C959BC0A}")
              $IID__DHTMLSafeEvents = GuId$("{D1FC78E8-B380-11D1-ADC5-006008A5848C}")
              
              ' ********************************************************************************************
              ' DHTMLEDITCMDID enum
              ' IID: {B23B8AA2-A8B4-11D1-ADC2-006008A5848C}
              ' Documentation string: Constants for DHTMLEdit commands
              ' ********************************************************************************************
              
              %DECMD_BOLD                                             = 5000         ' &H00001388
              %DECMD_COPY                                             = 5002         ' &H0000138A
              %DECMD_CUT                                              = 5003         ' &H0000138B
              %DECMD_DELETE                                           = 5004         ' &H0000138C
              %DECMD_DELETECELLS                                      = 5005         ' &H0000138D
              %DECMD_DELETECOLS                                       = 5006         ' &H0000138E
              %DECMD_DELETEROWS                                       = 5007         ' &H0000138F
              %DECMD_FINDTEXT                                         = 5008         ' &H00001390
              %DECMD_FONT                                             = 5009         ' &H00001391
              %DECMD_GETBACKCOLOR                                     = 5010         ' &H00001392
              %DECMD_GETBLOCKFMT                                      = 5011         ' &H00001393
              %DECMD_GETBLOCKFMTNAMES                                 = 5012         ' &H00001394
              %DECMD_GETFONTNAME                                      = 5013         ' &H00001395
              %DECMD_GETFONTSIZE                                      = 5014         ' &H00001396
              %DECMD_GETFORECOLOR                                     = 5015         ' &H00001397
              %DECMD_HYPERLINK                                        = 5016         ' &H00001398
              %DECMD_IMAGE                                            = 5017         ' &H00001399
              %DECMD_INDENT                                           = 5018         ' &H0000139A
              %DECMD_INSERTCELL                                       = 5019         ' &H0000139B
              %DECMD_INSERTCOL                                        = 5020         ' &H0000139C
              %DECMD_INSERTROW                                        = 5021         ' &H0000139D
              %DECMD_INSERTTABLE                                      = 5022         ' &H0000139E
              %DECMD_ITALIC                                           = 5023         ' &H0000139F
              %DECMD_JUSTIFYCENTER                                    = 5024         ' &H000013A0
              %DECMD_JUSTIFYLEFT                                      = 5025         ' &H000013A1
              %DECMD_JUSTIFYRIGHT                                     = 5026         ' &H000013A2
              %DECMD_LOCK_ELEMENT                                     = 5027         ' &H000013A3
              %DECMD_MAKE_ABSOLUTE                                    = 5028         ' &H000013A4
              %DECMD_MERGECELLS                                       = 5029         ' &H000013A5
              %DECMD_ORDERLIST                                        = 5030         ' &H000013A6
              %DECMD_OUTDENT                                          = 5031         ' &H000013A7
              %DECMD_PASTE                                            = 5032         ' &H000013A8
              %DECMD_REDO                                             = 5033         ' &H000013A9
              %DECMD_REMOVEFORMAT                                     = 5034         ' &H000013AA
              %DECMD_SELECTALL                                        = 5035         ' &H000013AB
              %DECMD_SEND_BACKWARD                                    = 5036         ' &H000013AC
              %DECMD_BRING_FORWARD                                    = 5037         ' &H000013AD
              %DECMD_SEND_BELOW_TEXT                                  = 5038         ' &H000013AE
              %DECMD_BRING_ABOVE_TEXT                                 = 5039         ' &H000013AF
              %DECMD_SEND_TO_BACK                                     = 5040         ' &H000013B0
              %DECMD_BRING_TO_FRONT                                   = 5041         ' &H000013B1
              %DECMD_SETBACKCOLOR                                     = 5042         ' &H000013B2
              %DECMD_SETBLOCKFMT                                      = 5043         ' &H000013B3
              %DECMD_SETFONTNAME                                      = 5044         ' &H000013B4
              %DECMD_SETFONTSIZE                                      = 5045         ' &H000013B5
              %DECMD_SETFORECOLOR                                     = 5046         ' &H000013B6
              %DECMD_SPLITCELL                                        = 5047         ' &H000013B7
              %DECMD_UNDERLINE                                        = 5048         ' &H000013B8
              %DECMD_UNDO                                             = 5049         ' &H000013B9
              %DECMD_UNLINK                                           = 5050         ' &H000013BA
              %DECMD_UNORDERLIST                                      = 5051         ' &H000013BB
              %DECMD_PROPERTIES                                       = 5052         ' &H000013BC
              
              ' ********************************************************************************************
              ' DHTMLEDITCMDF enum
              ' IID: {BF82426A-B961-11D1-ADC5-006008A5848C}
              ' Documentation string: Constants for DHTMLEdit QueryStatus
              ' ********************************************************************************************
              
              %DECMDF_NOTSUPPORTED                                    = 0            ' &H00000000
              %DECMDF_DISABLED                                        = 1            ' &H00000001
              %DECMDF_ENABLED                                         = 3            ' &H00000003
              %DECMDF_LATCHED                                         = 7            ' &H00000007
              %DECMDF_NINCHED                                         = 11           ' &H0000000B
              
              ' ********************************************************************************************
              ' DHTMLEDITAPPEARANCE enum
              ' IID: {7179FC44-B2E4-11D1-ADC5-006008A5848C}
              ' Documentation string: Constants for DHTMLEdit appearance
              ' ********************************************************************************************
              
              %DEAPPEARANCE_FLAT                                      = 0            ' &H00000000
              %DEAPPEARANCE_3D                                        = 1            ' &H00000001
              
              ' ********************************************************************************************
              ' OLECMDEXECOPT enum
              ' ********************************************************************************************
              
              %OLECMDEXECOPT_DODEFAULT                                = 0            ' &H00000000
              %OLECMDEXECOPT_PROMPTUSER                               = 1            ' &H00000001
              %OLECMDEXECOPT_DONTPROMPTUSER                           = 2            ' &H00000002
              %OLECMDEXECOPT_SHOWHELP                                 = 3            ' &H00000003
              
              Global FlagNewDoc As Long
              
              
              ' ********************************************************************************************
              ' EXCEPINFO structure
              ' ********************************************************************************************
              Type DHTMLEditEvents_EXCEPINFO
                 wCode As Word               ' An error code describing the error.
                 wReserved As Word           ' Reserved
                 bstrSource As Dword         ' Source of the exception.
                 bstrDescription As Dword    ' Textual description of the error.
                 bstrHelpFile As Dword       ' Help file path.
                 dwHelpContext As Dword      ' Help context ID.
                 pvReserved As Dword         ' Reserved.
                 pfnDeferredFillIn As Dword  ' Pointer to function that fills in Help and description info.
                 scode As Dword              ' An error code describing the error.
              End Type
              ' ********************************************************************************************
              
              
              Interface Dispatch DEGetBlockFmtNamesParam
                  Member Get Names<&H00000001>() As Variant
                  Member Let Names<&H00000001>()   'Parameter Type As Variant
              End Interface
              
              ' ********************************************************************************************
              ' [get_]Names property
              ' Interface name = IDEGetBlockFmtNamesParam
              ' Help string = property Names
              ' VTable offset = 28
              ' DispID = 1 [&H00000001]
              ' ********************************************************************************************
              Function IDEGetBlockFmtNamesParam_get_Names ( _
                  Byval pthis As Dword Ptr _                          ' %VT_DISPATCH <dispinterface>
                , Byref pVal As Variant _                             ' *%VT_VARIANT <VARIANT> [out]
                  ) As Long                                           ' %VT_HRESULT <LONG>
              
                  If IsFalse pthis Then Function = -1 : Exit Function
                  Local HRESULT As Long
                  Call Dword @@pthis[7] Using IDEGetBlockFmtNamesParam_get_Names(pthis, pVal) To HRESULT
                  Function = HRESULT
              
              End Function
              
              'get HTML part of edit window
              Function GetHtmlStream() As String
               Local v As Variant 
               Object Get oOcx.DocumentHTML To v
               Function = Variant$(v)
              End Function
              
              
              ' ********************************************************************************************
              ' Returns a pointer to a specified interface on an object to which a client currently holds an
              ' interface pointer.
              ' ********************************************************************************************
              Function DHTMLEditEvents_IUnknown_QueryInterface (Byval pthis As Dword Ptr, _
                 Byref riid As GuId, Byref ppvObj As Dword) As Long
                 Local HRESULT As Long
                 Call Dword @@pthis[0] Using DHTMLEditEvents_IUnknown_QueryInterface(pthis, riid, ppvObj) To HRESULT
                 Function = HRESULT
              End Function
              
              ' ********************************************************************************************
              ' Decrements the reference count for the calling interface on a object. If the reference count
              ' on the object falls to 0, the object is freed from memory.
              ' ********************************************************************************************
              Function DHTMLEditEvents_IUnknown_Release (Byval pthis As Dword Ptr) As Dword
                 Local DWRESULT As Dword
                 Call Dword @@pthis[2] Using DHTMLEditEvents_IUnknown_Release(pthis) To DWRESULT
                 Function = DWRESULT
              End Function
              
              ' ********************************************************************************************
              ' IConnectionPointContainer::FindConnectionPoint
              ' Returns a pointer to the IConnectionPoint interface of a connection point for a specified IID,
              ' if that IID describes a supported outgoing interface.
              ' ********************************************************************************************
              Function DHTMLEditEvents_IConnectionPointContainer_FindConnectionPoint ( _
                 Byval pthis As Dword Ptr, Byref riid As GuId, Byref ppCP As Dword) As Long
                 Local HRESULT As Long
                 Call Dword @@pthis[4] Using DHTMLEditEvents_IConnectionPointContainer_FindConnectionPoint(pthis, riid, ppCP) To HRESULT
                 Function = HRESULT
              End Function
              
              ' ********************************************************************************************
              ' IConnectionPoint::Advise
              ' Establishes a connection between the connection point object and the client's sink.
              ' ********************************************************************************************
              Function DHTMLEditEvents_IConnectionPoint_Advise (Byval pthis As Dword Ptr, _
                 Byval pUnkSink As Dword, Byref pdwCookie As Dword) As Long
                 Local HRESULT As Long
                 Call Dword @@pthis[5] Using DHTMLEditEvents_IConnectionPoint_Advise(pthis, pUnkSink, pdwCookie) To HRESULT
                 Function = HRESULT
              End Function
              
              ' ********************************************************************************************
              ' IConnectionPoint::Unadvise
              ' Terminates an advisory connection previously established through IConnectionPoint_Advise.
              ' The dwCookie parameter identifies the connection to terminate.
              ' ********************************************************************************************
              Function DHTMLEditEvents_IConnectionPoint_Unadvise (Byval pthis As Dword Ptr, Byval dwCookie As Dword) As Long
                 Local HRESULT As Long
                 Call Dword @@pthis[6] Using DHTMLEditEvents_IConnectionPoint_Unadvise(pthis, dwCookie) To HRESULT
                 Function = HRESULT
              End Function
              
              ' ********************************************************************************************
              ' IDispatch virtual table
              ' ********************************************************************************************
              Type DHTMLEditEvents_IDispatchVtbl
                 QueryInterface As Dword     ' Returns pointers to supported interfaces
                 AddRef As Dword             ' Increments reference count
                 Release As Dword            ' Decrements reference count
                 GetTypeInfoCount As Dword   ' Retrieves the number of type descriptions
                 GetTypeInfo As Dword        ' Retrieves a description of object's programmable interface
                 GetIDsOfNames As Dword      ' Maps name of method or property to DispId
                 Invoke As Dword             ' Calls one of the object's methods, or gets/sets one of its properties
                 pVtblAddr As Dword          ' Address of the virtual table
                 cRef As Dword               ' Reference counter
                 pthis As Dword              ' IUnknown or IDispatch of the control that fires the events
              End Type
              
              ' ********************************************************************************************
              ' UI4 AddRef()
              ' Increments the reference counter.
              ' ********************************************************************************************
              Function DHTMLEditEvents_AddRef (Byval pCookie As DHTMLEditEvents_IDispatchVtbl Ptr) As Dword
                 Incr @@pCookie.cRef
                 Function = @@pCookie.cRef
              End Function
              ' ********************************************************************************************
              
              ' ********************************************************************************************
              ' HRESULT QueryInterface([in] *GUID riid, [out] **VOID ppvObj)
              ' Returns the IUnknown of our class and increments the reference counter.
              ' ********************************************************************************************
              Function DHTMLEditEvents_QueryInterface (Byval pCookie As DHTMLEditEvents_IDispatchVtbl Ptr, _
                 Byref riid As GuId, Byref ppvObj As Dword) As Long
                 ppvObj = pCookie
                 DHTMLEditEvents_AddRef pCookie
                 Function = %S_OK
              End Function
              
              ' ********************************************************************************************
              ' UI4 Release()
              ' Releases our class if there is only a reference to him and decrements the reference counter.
              ' ********************************************************************************************
              Function DHTMLEditEvents_Release (Byval pCookie As DHTMLEditEvents_IDispatchVtbl Ptr) As Dword
                 Local pVtblAddr As Dword
                 If @@pCookie.cRef = 1 Then
                    pVtblAddr = @@pCookie.pVtblAddr
                    If IsFalse HeapFree(GetProcessHeap(), 0, Byval pVtblAddr) Then
                       Function = @@pCookie.cRef
                       Exit Function
                    End If
                 End If
                 Decr @@pCookie.cRef
                 Function = @@pCookie.cRef
              End Function
              
              ' ********************************************************************************************
              ' HRESULT GetTypeInfoCount([out] *UINT pctinfo)
              ' ********************************************************************************************
              Function DHTMLEditEvents_GetTypeInfoCount (Byval pCookie As DHTMLEditEvents_IDispatchVtbl Ptr, Byref pctInfo As Dword) As Long
                 Function = %E_NOTIMPL
              End Function
              
              ' ********************************************************************************************
              ' HRESULT GetTypeInfo([in] UINT itinfo, [in] UI4 lcid, [out] **VOID pptinfo)
              ' ********************************************************************************************
              Function DHTMLEditEvents_GetTypeInfo (Byval pCookie As DHTMLEditEvents_IDispatchVtbl Ptr, _
                 Byval itinfo As Dword, Byval lcid As Dword, Byref pptinfo As Dword) As Long
                 Function = %E_NOTIMPL
              End Function
              
              ' ********************************************************************************************
              ' HRESULT GetIDsOfNames([in] *GUID riid, [in] **I1 rgszNames, [in] UINT cNames, [in] UI4 lcid, [out] *I4 rgdispid)
              ' ********************************************************************************************
              Function DHTMLEditEvents_GetIDsOfNames ( Byval pCookie As DHTMLEditEvents_IDispatchVtbl Ptr, _
                 Byref riid As GuId, Byval rgszNames As Dword, Byval cNames As Dword, Byval lcid As Dword, Byref rgdispid As Long) As Long
                 Function = %E_NOTIMPL
              End Function
              
              ' ********************************************************************************************
              ' Builds the IDispatch Virtual Table
              ' ********************************************************************************************
              Function DHTMLEditEvents_BuildVtbl (Byval pthis As Dword) As Dword
              
                 Local pVtbl As DHTMLEditEvents_IDispatchVtbl Ptr
                 Local pUnk As DHTMLEditEvents_IDispatchVtbl Ptr
              
                 pVtbl = HeapAlloc(GetProcessHeap(), %HEAP_ZERO_MEMORY, SizeOf(@pVtbl))
                 If pVtbl = 0 Then Exit Function
              
                 @pVtbl.QueryInterface   = CodePtr(DHTMLEditEvents_QueryInterface)
                 @pVtbl.AddRef           = CodePtr(DHTMLEditEvents_AddRef)
                 @pVtbl.Release          = CodePtr(DHTMLEditEvents_Release)
                 @pVtbl.GetTypeInfoCount = CodePtr(DHTMLEditEvents_GetTypeInfoCount)
                 @pVtbl.GetTypeInfo      = CodePtr(DHTMLEditEvents_GetTypeInfo)
                 @pVtbl.GetIDsOfNames    = CodePtr(DHTMLEditEvents_GetIDsOfNames)
                 @pVtbl.Invoke           = CodePtr(DHTMLEditEvents_Invoke)
                 @pVtbl.pVtblAddr        = pVtbl
                 @pVtbl.pthis            = pthis
              
                 pUnk = VarPtr(@pVtbl.pVtblAddr)
                 Function = pUnk
              
              End Function
              
              ' ********************************************************************************************
              ' Establishes a connection between the connection point object and the client's sink.
              ' Returns a token that uniquely identifies this connection.
              ' ********************************************************************************************
              Function DHTMLEditEvents_ConnectEvents (Byval pthis As Dword, Byref pdwCookie As Dword) As Long
              
                 Local HRESULT As Long                 ' HRESULT code
                 Local pCPC As Dword                   ' IConnectionPointContainer
                 Local pCP As Dword                    ' IConnectionPoint
                 Local IID_CPC As GuId                 ' IID_IConnectionPointContainer
                 Local IID_CP As GuId                  ' Events dispinterface
                 Local dwCookie As Dword               ' Returned token
                 Local pUnkSink As Dword               ' IUnknown of the class
              
                 IID_CPC = GuId$("{B196B284-BAB4-101A-B69C-00AA00341D07}")
                 IID_CP  = GuId$("{588D5040-CF28-11D1-8CD3-00A0C959BC0A}")
              
                 If pthis = 0 Then Function = -1 : Exit Function
                 HRESULT = DHTMLEditEvents_IUnknown_QueryInterface(pthis, IID_CPC, pCPC)
                 If HRESULT <> %S_OK Then Function = HRESULT : Exit Function
              
                 HRESULT = DHTMLEditEvents_IConnectionPointContainer_FindConnectionPoint(pCPC, IID_CP, pCP)
                 DHTMLEditEvents_IUnknown_Release pCPC
                 If HRESULT <> %S_OK Then Function = HRESULT : Exit Function
              
                 pUnkSink = DHTMLEditEvents_BuildVtbl(pthis)
                 If IsTrue pUnkSink Then HRESULT = DHTMLEditEvents_IConnectionPoint_Advise(pCP, pUnkSink, dwCookie)
                 DHTMLEditEvents_IUnknown_Release pCP
                 pdwCookie = dwCookie
                 Function = HRESULT
              
              End Function
              ' ********************************************************************************************
              
              ' ********************************************************************************************
              ' Releases the events connection identified with the cookie returned by the ConnectEvents function
              ' ********************************************************************************************
              
              Function DHTMLEditEvents_DisconnectEvents (Byval pthis As Dword, Byval dwCookie As Dword) As Long
              
                 Local HRESULT As Long                 ' HRESULT code
                 Local pCPC As Dword                   ' IConnectionPointContainer
                 Local pCP As Dword                    ' IConnectionPoint
                 Local IID_CPC As GuId                 ' IID_IConnectionPointContainer
                 Local IID_CP As GuId                  ' ConnectionEvents dispinterface
              
                 IID_CPC = GuId$("{B196B284-BAB4-101A-B69C-00AA00341D07}")
                 IID_CP  = GuId$("{588D5040-CF28-11D1-8CD3-00A0C959BC0A}")
              
                 If pthis = 0 Then Function = -1 : Exit Function
                 HRESULT = DHTMLEditEvents_IUnknown_QueryInterface(pthis, IID_CPC, pCPC)
                 If HRESULT <> %S_OK Then Function = HRESULT : Exit Function
              
                 HRESULT = DHTMLEditEvents_IConnectionPointContainer_FindConnectionPoint(pCPC, IID_CP, pCP)
                 DHTMLEditEvents_IUnknown_Release pCPC
                 If HRESULT <> %S_OK Then Function = HRESULT : Exit Function
              
                 HRESULT = DHTMLEditEvents_IConnectionPoint_Unadvise(pCP, dwCookie)
                 DHTMLEditEvents_IUnknown_Release pCP
                 Function = HRESULT
              
              End Function
              ' ********************************************************************************************
              
              ' ********************************************************************************************
              ' Function name: DocumentComplete
              ' Dispatch interface name: _DHTMLEditEvents
              ' Member identifier: &H00000001 (1)
              ' ********************************************************************************************
              Function DHTMLEditEvents_DocumentComplete(Byval pCookie As DHTMLEditEvents_IDispatchVtbl Ptr, Byref pdispparams As DispParams) As Long
               Local x As String, k As String, v As Variant
              
              '  ===========================================================================================
              '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
              '  ===========================================================================================
                 Local pthis As Dword
                 pthis = @@pCookie.pthis
              '  ===========================================================================================
               'put default style
               If IsFalse FlagNewDoc Then
                x = GetHtmlStream()
                k = "BODY {MARGIN-TOP: 1em; MARGIN-BOTTOM: 1em; MARGIN-LEFT: 1em; MARGIN-BOTTOM: 1em;}"
                Replace "</HEAD>" With "<STYLE>" + $CrLf + k + $CrLf + "P {MARGIN:0}" + $CrLf + "</STYLE>" + $CrLf + "</HEAD>" In x
                v = x
                Object Let oOcx.DocumentHTML = v
                FlagNewDoc = %TRUE
               End If
              
              '  ===== COULD NOT GET THE FORMATNAMES to fill Formatting menu!!!
              '  (USED STRING CONSTANTS TO FILL MENU but the vary with locale)
              '  Local v As Variant, v1 As Variant, v2 As Variant, i As Long, v3 As Variant, x As String
              '  v = %DECMD_GETBLOCKFMTNAMES
              '  v1 = %OLECMDEXECOPT_DONTPROMPTUSER
              '  v2 = oFmt
              '  Object Call oOcx.ExecCommand(v, v1, v2)
                
                Function = %S_OK
              
              End Function
              ' ********************************************************************************************
              
              'QUERYSTATUS WRAPPER
              Function EditQuery(Byval Cmd As Long) As Long
               Local v As Variant, v1 As Variant
               v = Cmd
               Object Call oOcx.QueryStatus(v) To v1
               Function = Variant#(v1) 
              End Function
              
              
              Sub UpdateFontCombos()
               Local v As Variant, v1 As Variant, vR As Variant
               Local Stat As Long, i As Long
               Local x As String 
               
               Stat = EditQuery(%DECMD_GETFONTNAME)
               
               If Stat = %DECMDF_ENABLED Or Stat = %DECMDF_LATCHED Then
                v = %DECMD_GETFONTNAME
                v1 = %OLECMDEXECOPT_DONTPROMPTUSER
                Object Call oOcx.ExecCommand(v, v1) To vR
                x = Variant$(vR)
                i = SendMessage(hComboFN, %CB_FINDSTRINGEXACT, - 1, StrPtr(x))
                If i = %CB_ERR Then
                 SendMessage hComboFN, %CB_SETCURSEL, 0, 0
                Else
                 SendMessage hComboFN, %CB_SETCURSEL, i, 0
                End If
                Control Enable hRebar, %ID_CBOFONTNAME
               Else
                SendMessage hComboFN, %CB_SETCURSEL, - 1, 0
                If Stat = %DECMDF_NINCHED Then
                 Control Enable hRebar, %ID_CBOFONTNAME
                Else
                 Control Disable hRebar, %ID_CBOFONTNAME
                 'treat line object
                 SendMessage hToolbarEdit, %TB_ENABLEBUTTON, %IDC_LINE, MakLng(0, 0)
                 Menu Set State hMenu, Bycmd %IDM_LINE, %MF_DISABLED
                End If
               End If
              
               'fontsize
               Stat = EditQuery(%DECMD_GETFONTSIZE)
               If Stat = %DECMDF_ENABLED Or Stat = %DECMDF_LATCHED Then
                v = %DECMD_GETFONTSIZE
                v1 = %OLECMDEXECOPT_DONTPROMPTUSER
                Object Call oOcx.ExecCommand(v, V1) To vR
                i = Variant#(vR)
                If i > 0 And i < 8 Then
                 SendMessage hComboFS, %CB_SETCURSEL, i - 1, 0
                Else
                 SendMessage hComboFS, %CB_SETCURSEL, - 1, 0
                End If   
                Control Enable hRebar, %ID_CBOFONTSIZE
               Else
                SendMessage hComboFS, %CB_SETCURSEL, - 1, 0
                If Stat = %DECMDF_NINCHED Then
                 Control Enable hRebar, %ID_CBOFONTSIZE
                Else
                 Control Disable hRebar, %ID_CBOFONTSIZE
                End If
               End If
              End Sub
              
              'Adjust button status
              'enable/disable/lift/press edit buttons
              Sub AdjustEditButtonAndMenu(Byval MCmd As Long, Byval BCmd As Long, Byval Effect As Long)
               Local Stat As Long
               Stat = EditQuery(Effect)
               If Stat >= %DECMDF_ENABLED Then
                SendMessage hToolbarEdit, %TB_ENABLEBUTTON, bcmd, MakLng(1, 0)
                If MCmd <> 0 Then Menu Set State hMenu, Bycmd MCmd, %MF_ENABLED
               Else
                SendMessage hToolbarEdit, %TB_ENABLEBUTTON, bcmd, MakLng(0, 0)
                If MCmd <> 0 Then Menu Set State hMenu, Bycmd MCmd, %MF_DISABLED
               End If
              
               If Stat = %DECMDF_LATCHED Then
                SendMessage hToolbarEdit, %TB_CHECKBUTTON, bcmd, MakLng(1, 0)
               Else
                SendMessage hToolbarEdit, %TB_CHECKBUTTON, bcmd, MakLng(0, 0)
               End If
              
              End Sub
              
              ' ********************************************************************************************
              ' Function name: DisplayChanged
              ' Dispatch interface name: _DHTMLEditEvents
              ' Member identifier: &H00000002 (2)
              ' ********************************************************************************************
              Function DHTMLEditEvents_DisplayChanged (Byval pCookie As DHTMLEditEvents_IDispatchVtbl Ptr, Byref pdispparams As DispParams) As Long 
               'Retrieve the IUnknown or IDispatch of the control that has fired the event.
               Local pthis As Dword
               Local vvar As Variant, v As Variant, v1 As Variant 
              
               pthis = @@pCookie.pthis
              
               'AdjustbuttonAndMenu   menu, button, command
               AdjustEditButtonAndMenu 0, %IDC_BOLD, %DECMD_BOLD
               AdjustEditButtonAndMenu 0, %IDC_ITALIC, %DECMD_ITALIC
               AdjustEditButtonAndMenu 0, %IDC_UNDERLINE, %DECMD_UNDERLINE
               AdjustEditButtonAndMenu 0, %IDC_INDENT, %DECMD_INDENT
               AdjustEditButtonAndMenu 0, %IDC_OUTDENT, %DECMD_OUTDENT
               AdjustEditButtonAndMenu 0, %IDC_ORDERLIST, %DECMD_ORDERLIST
               AdjustEditButtonAndMenu 0, %IDC_UNORDERLIST, %DECMD_UNORDERLIST
               AdjustEditButtonAndMenu 0, %IDC_JUSTIFYLEFT, %DECMD_JUSTIFYLEFT
               AdjustEditButtonAndMenu 0, %IDC_JUSTIFYCENTER, %DECMD_JUSTIFYCENTER
               AdjustEditButtonAndMenu 0, %IDC_JUSTIFYRIGHT, %DECMD_JUSTIFYRIGHT
               AdjustEditButtonAndMenu 0, %IDC_TXTBACKCOLOR, %DECMD_SETBACKCOLOR
                               
               AdjustEditButtonAndMenu %IDM_UNDO, %IDC_UNDO, %DECMD_UNDO
               AdjustEditButtonAndMenu %IDM_REDO, %IDC_REDO, %DECMD_REDO
               AdjustEditButtonAndMenu %IDM_IMAGE, %IDC_IMAGE, %DECMD_IMAGE
               AdjustEditButtonAndMenu %IDM_LINE, %IDC_LINE, %DECMD_IMAGE  'use image status for line
                               
               AdjustEditButtonAndMenu %IDM_HYPERLINK, %IDC_HYPERLINK, %DECMD_HYPERLINK
               AdjustEditButtonAndMenu 0, %IDC_UNLINK, %DECMD_UNLINK
                               
               AdjustEditButtonAndMenu %IDM_COPY, %IDC_COPY, %DECMD_COPY
               AdjustEditButtonAndMenu %IDM_CUT, %IDC_CUT, %DECMD_CUT
               AdjustEditButtonAndMenu %IDM_PASTE, %IDC_PASTE, %DECMD_PASTE
              
               Call UpdateTbMainAndMenus()
               Call UpdateFontCombos()
              
               Function = %S_OK
              
              End Function
              
              
              ' ********************************************************************************************
              ' Function name: ShowContextMenu
              ' Dispatch interface name: _DHTMLEditEvents
              ' Member identifier: &H00000003 (3)
              ' ********************************************************************************************
              Function DHTMLEditEvents_ShowContextMenu (Byval pCookie As DHTMLEditEvents_IDispatchVtbl Ptr, Byref pdispparams As DispParams) As Long 
              
              '  ===========================================================================================
              '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
              '  ===========================================================================================
                 Local pthis As Dword
                 pthis = @@pCookie.pthis
              '  ===========================================================================================
              
              '  ===========================================================================================
              '  Parameters in DISPPARAMS are zero based and in reverse order
              '  ===========================================================================================
                 Local pv As Variant Ptr
                 pv = pdispparams.VariantArgs
              '  -------------------------------------------------------------------------------------------
              '  *** xPos - VarType: %VT_I4 <LONG> - Attributes: &H1 -  [in] ***
              '  -------------------------------------------------------------------------------------------
                 Local xPos As Long
                 xPos = Variant#(@pv[1])
              '  -------------------------------------------------------------------------------------------
              '  *** yPos - VarType: %VT_I4 <LONG> - Attributes: &H1 -  [in] ***
              '  -------------------------------------------------------------------------------------------
                 Local yPos As Long
                 yPos = Variant#(@pv[0])
              '  -------------------------------------------------------------------------------------------
              
              '  ===========================================================================================
              '  *** Put your code here ***
              '  ===========================================================================================
              
                 Function = %S_OK
              
              End Function
              ' ********************************************************************************************
              
              ' ********************************************************************************************
              ' Function name: ContextMenuAction
              ' Dispatch interface name: _DHTMLEditEvents
              ' Member identifier: &H00000004 (4)
              ' ********************************************************************************************
              Function DHTMLEditEvents_ContextMenuAction (Byval pCookie As DHTMLEditEvents_IDispatchVtbl Ptr, Byref pdispparams As DispParams) As Long 
              
              '  ===========================================================================================
              '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
              '  ===========================================================================================
                 Local pthis As Dword
                 pthis = @@pCookie.pthis
              '  ===========================================================================================
              
              '  ===========================================================================================
              '  Parameters in DISPPARAMS are zero based and in reverse order
              '  ===========================================================================================
                 Local pv As Variant Ptr
                 pv = pdispparams.VariantArgs
              '  -------------------------------------------------------------------------------------------
              '  *** itemIndex - VarType: %VT_I4 <LONG> - Attributes: &H1 -  [in] ***
              '  -------------------------------------------------------------------------------------------
                 Local itemIndex As Long
                 itemIndex = Variant#(@pv[0])
              '  -------------------------------------------------------------------------------------------
              
              '  ===========================================================================================
              '  *** Put your code here ***
              '  ===========================================================================================
              
                 Function = %S_OK
              
              End Function
              ' ********************************************************************************************
              
              ' ********************************************************************************************
              ' Function name: onmousedown
              ' Dispatch interface name: _DHTMLEditEvents
              ' Member identifier: &H00000005 (5)
              ' ********************************************************************************************
              Function DHTMLEditEvents_onmousedown (Byval pCookie As DHTMLEditEvents_IDispatchVtbl Ptr, Byref pdispparams As DispParams) As Long 
              
              '  ===========================================================================================
              '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
              '  ===========================================================================================
                 Local pthis As Dword
                 pthis = @@pCookie.pthis
              '  ===========================================================================================
              
              '  ===========================================================================================
              '  *** Put your code here ***
              '  ===========================================================================================
              
                 Function = %S_OK
              
              End Function
              ' ********************************************************************************************
              
              ' ********************************************************************************************
              ' Function name: onmousemove
              ' Dispatch interface name: _DHTMLEditEvents
              ' Member identifier: &H00000006 (6)
              ' ********************************************************************************************
              Function DHTMLEditEvents_onmousemove (Byval pCookie As DHTMLEditEvents_IDispatchVtbl Ptr, Byref pdispparams As DispParams) As Long 
              
              '  ===========================================================================================
              '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
              '  ===========================================================================================
                 Local pthis As Dword
                 pthis = @@pCookie.pthis
              '  ===========================================================================================
              
              '  ===========================================================================================
              '  *** Put your code here ***
              '  ===========================================================================================
              
                 Function = %S_OK
              
              End Function
              ' ********************************************************************************************
              
              ' ********************************************************************************************
              ' Function name: onmouseup
              ' Dispatch interface name: _DHTMLEditEvents
              ' Member identifier: &H00000007 (7)
              ' ********************************************************************************************
              Function DHTMLEditEvents_onmouseup (Byval pCookie As DHTMLEditEvents_IDispatchVtbl Ptr, Byref pdispparams As DispParams) As Long 
              
              '  ===========================================================================================
              '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
              '  ===========================================================================================
                 Local pthis As Dword
                 pthis = @@pCookie.pthis
              '  ===========================================================================================
              
              '  ===========================================================================================
              '  *** Put your code here ***
              '  ===========================================================================================
              
                 Function = %S_OK
              
              End Function
              ' ********************************************************************************************
              
              ' ********************************************************************************************
              ' Function name: onmouseout
              ' Dispatch interface name: _DHTMLEditEvents
              ' Member identifier: &H00000008 (8)
              ' ********************************************************************************************
              Function DHTMLEditEvents_onmouseout (Byval pCookie As DHTMLEditEvents_IDispatchVtbl Ptr, Byref pdispparams As DispParams) As Long 
              
              '  ===========================================================================================
              '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
              '  ===========================================================================================
                 Local pthis As Dword
                 pthis = @@pCookie.pthis
              '  ===========================================================================================
              
              '  ===========================================================================================
              '  *** Put your code here ***
              '  ===========================================================================================
              
                 Function = %S_OK
              
              End Function
              ' ********************************************************************************************
              
              ' ********************************************************************************************
              ' Function name: onmouseover
              ' Dispatch interface name: _DHTMLEditEvents
              ' Member identifier: &H00000009 (9)
              ' ********************************************************************************************
              Function DHTMLEditEvents_onmouseover (Byval pCookie As DHTMLEditEvents_IDispatchVtbl Ptr, Byref pdispparams As DispParams) As Long 
              
              '  ===========================================================================================
              '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
              '  ===========================================================================================
                 Local pthis As Dword
                 pthis = @@pCookie.pthis
              '  ===========================================================================================
              
              '  ===========================================================================================
              '  *** Put your code here ***
              '  ===========================================================================================
              
                 Function = %S_OK
              
              End Function
              ' ********************************************************************************************
              
              ' ********************************************************************************************
              ' Function name: onclick
              ' Dispatch interface name: _DHTMLEditEvents
              ' Member identifier: &H0000000A (10)
              ' ********************************************************************************************
              Function DHTMLEditEvents_onclick (Byval pCookie As DHTMLEditEvents_IDispatchVtbl Ptr, Byref pdispparams As DispParams) As Long 
              
              '  ===========================================================================================
              '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
              '  ===========================================================================================
                 Local pthis As Dword
                 pthis = @@pCookie.pthis
              '  ===========================================================================================
              
              
                 Function = %S_OK
              
              End Function
              ' ********************************************************************************************
              
              ' ********************************************************************************************
              ' Function name: ondblclick
              ' Dispatch interface name: _DHTMLEditEvents
              ' Member identifier: &H0000000B (11)
              ' ********************************************************************************************
              Function DHTMLEditEvents_ondblclick (Byval pCookie As DHTMLEditEvents_IDispatchVtbl Ptr, Byref pdispparams As DispParams) As Long 
              
              '  ===========================================================================================
              '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
              '  ===========================================================================================
                 Local pthis As Dword
                 pthis = @@pCookie.pthis
              '  ===========================================================================================
              
              '  ===========================================================================================
              '  *** Put your code here ***
              '  ===========================================================================================
              
                 Function = %S_OK
              
              End Function
              ' ********************************************************************************************
              
              ' ********************************************************************************************
              ' Function name: onkeydown
              ' Dispatch interface name: _DHTMLEditEvents
              ' Member identifier: &H0000000C (12)
              ' ********************************************************************************************
              Function DHTMLEditEvents_onkeydown (Byval pCookie As DHTMLEditEvents_IDispatchVtbl Ptr, Byref pdispparams As DispParams) As Long 
              
              '  ===========================================================================================
              '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
              '  ===========================================================================================
                 Local pthis As Dword
                 pthis = @@pCookie.pthis
              '  ===========================================================================================
              
              '  ===========================================================================================
              '  *** Put your code here ***
              '  ===========================================================================================
              
                 Function = %S_OK
              
              End Function
              ' ********************************************************************************************
              
              ' ********************************************************************************************
              ' Function name: onkeypress
              ' Dispatch interface name: _DHTMLEditEvents
              ' Member identifier: &H0000000D (13)
              ' ********************************************************************************************
              Function DHTMLEditEvents_onkeypress (Byval pCookie As DHTMLEditEvents_IDispatchVtbl Ptr, Byref pdispparams As DispParams) As Long 
              
              '  ===========================================================================================
              '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
              '  ===========================================================================================
                 Local pthis As Dword
                 pthis = @@pCookie.pthis
              '  ===========================================================================================
              
              '  ===========================================================================================
              '  *** Put your code here ***
              '  ===========================================================================================
              
               '  NotDirtyYet = %FALSE
              
                 Function = %S_OK
              
              End Function
              ' ********************************************************************************************
              
              ' ********************************************************************************************
              ' Function name: onkeyup
              ' Dispatch interface name: _DHTMLEditEvents
              ' Member identifier: &H0000000E (14)
              ' ********************************************************************************************
              Function DHTMLEditEvents_onkeyup (Byval pCookie As DHTMLEditEvents_IDispatchVtbl Ptr, Byref pdispparams As DispParams) As Long 
              
              '  ===========================================================================================
              '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
              '  ===========================================================================================
                 Local pthis As Dword
                 pthis = @@pCookie.pthis
              '  ===========================================================================================
              
              '  ===========================================================================================
              '  *** Put your code here ***
              '  ===========================================================================================
              
                 Function = %S_OK
              
              End Function
              ' ********************************************************************************************
              
              ' ********************************************************************************************
              ' Function name: onblur
              ' Dispatch interface name: _DHTMLEditEvents
              ' Member identifier: &H0000000F (15)
              ' ********************************************************************************************
              Function DHTMLEditEvents_onblur (Byval pCookie As DHTMLEditEvents_IDispatchVtbl Ptr, Byref pdispparams As DispParams) As Long 
              
              '  ===========================================================================================
              '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
              '  ===========================================================================================
                 Local pthis As Dword
                 pthis = @@pCookie.pthis
              '  ===========================================================================================
              
              '  ===========================================================================================
              '  *** Put your code here ***
              '  ===========================================================================================
              
                 Function = %S_OK
              
              End Function
              ' ********************************************************************************************
              
              ' ********************************************************************************************
              ' Function name: onreadystatechange
              ' Dispatch interface name: _DHTMLEditEvents
              ' Member identifier: &H00000010 (16)
              ' ********************************************************************************************
              Function DHTMLEditEvents_onreadystatechange (Byval pCookie As DHTMLEditEvents_IDispatchVtbl Ptr, Byref pdispparams As DispParams) As Long 
              
              '  ===========================================================================================
              '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
              '  ===========================================================================================
                 Local pthis As Dword
                 pthis = @@pCookie.pthis
              '  ===========================================================================================
              
              '  ===========================================================================================
              '  *** Put your code here ***
              '  ===========================================================================================
                 Function = %S_OK
              
              End Function
              ' ********************************************************************************************
              
              
              ' ********************************************************************************************
              ' HRESULT Invoke([in] I4 dispidMember, [in] *GUID riid, [in] UI4 lcid, [in] UI2 wFlags, [in] *DISPPARAMS pdispparams, [out] *VARIANT pvarResult, [out] *EXCEPINFO pexcepinfo, [out] *UINT puArgErr)
              ' ********************************************************************************************
              Function DHTMLEditEvents_Invoke (Byval pCookie As DHTMLEditEvents_IDispatchVtbl Ptr, Byval dispidMember As Long, Byref riid As GuId, _
                 Byval lcid As Dword, Byval wFlags As Word, Byref pdispparams As DispParams, Byref pvarResult As Variant, _
                 Byref pexcepinfo As DHTMLEditEvents_EXCEPINFO, Byref puArgErr As Dword) As Long
              
                 Function = %S_OK
              
                 If VarPtr(pdispparams) Then
              
                    Select Case As Long dispidMember
                       Case &H00000001  ' (1)  ' // DocumentComplete
                          Function = DHTMLEditEvents_DocumentComplete(pCookie, pdispparams)
                       Case &H00000002  ' (2)  ' // DisplayChanged
                          Function = DHTMLEditEvents_DisplayChanged(pCookie, pdispparams)
                       Case &H00000003  ' (3)  ' // ShowContextMenu
                          Function = DHTMLEditEvents_ShowContextMenu(pCookie, pdispparams)
                       Case &H00000004  ' (4)  ' // ContextMenuAction
                          Function = DHTMLEditEvents_ContextMenuAction(pCookie, pdispparams)
                       Case &H00000005  ' (5)  ' // onmousedown
                          Function = DHTMLEditEvents_onmousedown(pCookie, pdispparams)
                       Case &H00000006  ' (6)  ' // onmousemove
                          Function = DHTMLEditEvents_onmousemove(pCookie, pdispparams)
                       Case &H00000007  ' (7)  ' // onmouseup
                          Function = DHTMLEditEvents_onmouseup(pCookie, pdispparams)
                       Case &H00000008  ' (8)  ' // onmouseout
                          Function = DHTMLEditEvents_onmouseout(pCookie, pdispparams)
                       Case &H00000009  ' (9)  ' // onmouseover
                          Function = DHTMLEditEvents_onmouseover(pCookie, pdispparams)
                       Case &H0000000A  ' (10)  ' // onclick
                          Function = DHTMLEditEvents_onclick(pCookie, pdispparams)
                       Case &H0000000B  ' (11)  ' // ondblclick
                          Function = DHTMLEditEvents_ondblclick(pCookie, pdispparams)
                       Case &H0000000C  ' (12)  ' // onkeydown
                          Function = DHTMLEditEvents_onkeydown(pCookie, pdispparams)
                       Case &H0000000D  ' (13)  ' // onkeypress
                          Function = DHTMLEditEvents_onkeypress(pCookie, pdispparams)
                       Case &H0000000E  ' (14)  ' // onkeyup
                          Function = DHTMLEditEvents_onkeyup(pCookie, pdispparams)
                       Case &H0000000F  ' (15)  ' // onblur
                          Function = DHTMLEditEvents_onblur(pCookie, pdispparams)
                       Case &H00000010  ' (16)  ' // onreadystatechange
                          Function = DHTMLEditEvents_onreadystatechange(pCookie, pdispparams)
              
                    End Select
              
                 End If
              
              End Function

              ------------------


              [This message has been edited by Heber Jorge da Silva (edited March 29, 2005).]

              Comment


              • #8
                Broken link so I added this:
                http://www.dotysoftware.com/html/original.zip

                PbHtmled.exe is 321024 bytes. UPX'ed it is 56320 bytes.
                https://duckduckgo.com instead of google

                Comment


                • #9
                  Originally posted by Mike Doty View Post
                  Broken link so I added this:
                  http://www.dotysoftware.com/html/original.zip

                  PbHtmled.exe is 321024 bytes. UPX'ed it is 56320 bytes.
                  Is there a link to this example code that is currently active?

                  Comment


                  • #10
                    Sorry, I can't find the code.
                    https://duckduckgo.com instead of google

                    Comment


                    • #11
                      I have a copy of this code - assume it is OK to post the zip? Still needs some work on it but it is a very good basis for some further work.

                      Iain Johnstone
                      Attached Files
                      “None but those who have experienced them can conceive of the enticements of science” - Mary Shelley

                      Comment

                      Working...
                      X