VB6 - First Application

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

a) Start a new application

 

clip0046

 

b) add a menu and a WPDLLInt1 object (how to install)

 

clip0047

 

c) add an event handler to initialize the editor. Please see the description about SetEditorMode and SetLayout.

 

Private Sub Form_Load()

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

 

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

 

 WPDLLInt1.Memo.AutoZoom = wpAutoZoomOff

End Sub

 

In case no toolbar is displayed when you start the application it is most likely that the PCC file has not been  found. In this case the application wll beep when started (MessageBeep API) .

If this is not the case and you have selected the propper bits for the GUI mode please check the parameters, and compare to the XML tags used in the WPCubed PackageFile Manager:

 

  clip0049

 

d) add an event handler to resize the editor to fill the window

 

Private Sub Form_Resize()

 WPDLLInt1.Left = 0

 WPDLLInt1.Top = 0

 WPDLLInt1.Width = ScaleWidth - 2

 WPDLLInt1.Height = ScaleHeight - 2

End Sub

 

e) We now attach 3 actions to the menu:

 

Private Sub LoadMen_Click()

 WPDLLInt1.wpaProcess "open", ""

End Sub

 

Private Sub SaveMen_Click()

 WPDLLInt1.wpaProcess "save", ""

End Sub

 

Private Sub CloseMen_Click()

 ReadyToClose = True

 Unload Me

End Sub

 

 

This is not required for the demo - but for a released application set the property DLLName to tell the engine the location of the DLL.

 

clip0035

 

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) preceeded by {hkcu} to use HKEY_CURRENT_USER, or {hklm} to use HKEY_LOCAL_MACHINE.

 

Example:

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

 

Note: The key Software\WPCubed\TextDynamic\path is created by the WPToolsDLL setup script and must not be used in your application. We use it our example projects only when the property DLLName has its default value "{please_change_this}";

 


[firstvbapplication.htm]    Copyright © 2007 by WPCubed GmbH