Step by Step use in VB6

[Top]  [Chapter]  [Previous]  [Next]

1) create a new project




2) add TextDynamic to the component palette


vb_install_component select "Components..." and then TextDynamic: clip0113


3) click on the added component and draw a rectangle on the form to create a control





4) When using the OCX, the path of the DLL must be specified in property DLLName.




By default the string {please_change_this} is used - that tells the OCX to load the DLL which was installed by the TextDynamic setup script. You need to change that property! It is possible to change this property when the form has been already loaded. Please make sure you use the same setting in all the editor boxes you use in your application. So using a registry reference is the best way to do it.


Once the name was applied it should not be changed anymore. It is possible to read the name from the registry: Specify the path to the registry key (type string) proceeded by {hkcu} to use HKEY_CURRENT_USER, or {hklm} to use HKEY_LOCAL_MACHINE.



"{hkcu}Software\MyCompany\TextDynamic\path" will load the name from the string property path under HKEY_CURRENT_USER\Software\MyCompany\TextDynamic.


Optionally: Initialize the InitScriptXML property by clicking right on the control and select "Poperties" from the context menu. The popup for click on the button [>>] and select "Create Template" from the list. Close the form.


5) now add code to resize the control dynamically with the parent form


Private Sub Form_Resize()

 WPDLLInt1.Left = 0

 WPDLLInt1.Top = 0

 WPDLLInt1.Width = Me.ScaleWidth

 WPDLLInt1.Height = Me.ScaleHeight

End Sub


Start the application and you should get



6) now please add code to tell the control the destination of the engine DLL. This is not required in the demo since it is loaded from the registry, but for an application you distribute you need to modify the property DLLName.



7) When you are using the licensed version you need to set your license information using the method EditorStart.


Private Sub Form_Load()

  ' required by registered version:



  ' Here we load the PCC file which contains the layout for the toolbar

  ' and also the images

  WPDLLInt1.SetLayout "buttons.pcc", "default", "", "main", "main"


  ' In SetEditorMode we select tghe editor style (single, double,..) and

  ' certain BITS for the GUI. We also activate table and premium features

  WPDLLInt1.SetEditorMode 0, 2, 2 + 4 + 8 + 16 + 64 + 128 + 256 + 1024, 0


  ' a local object variable

  Dim Memo As IWPMemo


  ' we need this interface

  Set Memo = WPDLLInt1.Memo


  ' no auto zoom

  Memo.AutoZoom = wpAutoZoomOff


  ' Switch off Paragraph Symbol

  Memo.SetBProp wpViewOptions, 29, -1


  ' Load a text

  Memo.LoadFromFile "Test.rtf", False, ""



  WPDLLInt1.wpaProcess "Open", ""

End Sub


If you get the message "License Information is missing" and the object is displayed as red box, please copy the *.LIC file from the TextDynamic/System folder to the folder with the OCX. The LIC file may not be distributed, but it is required to use the OCX in the designer.



8) You can modify the property InitScripXML to change layout of the editor or to load a different PCC file. Instead of using the property InitScriptXML use the method SetLayout and SetEditorMode in the event Form.OnLoad.















[stepbystepuseinvb6.htm]    Copyright © 2007 by WPCubed GmbH