Blog PlanningPME

Easy-to-use resource scheduling software

Plug in creation

Steps to create your plugin

Now that you know why having a plug in in PlanningPME, here are the technical steps to follow.

1 – Register the PlanningPME.dll
C:\windows\system32\regsvr32.dll PlanningPME.dll

2 – Create the plugin with Visual Basic
Choose the name of your object : here : Project1

plug in project

Choose the name of your class
Here : Projet1.plugin

plug in class

Register the dll PlanningPME in your project

plug in register

Insert your code
Const BN_CLICKED = 0
Const WM_COMMAND = 273

Option Explicit

Implements PlanningPMEPlugin

Private Sub PlanningPMEPlugin_InitializeControls(ByVal Controls As PlanningPMEControls)

    Dim Control As PlanningPMEControl
    Set Control = New PlanningPMEControl
    Control.Caption = "My Button update Task"
    Control.ID = 5000
    Control.x = 350
    Control.y = 50
    Control.Height = 20
    Control.Width = 150
    Control.Type = PpControlPushButton
    Control.When = PpWhenUpdate
    Control.Destination = PpDestinationDoTask
    Controls.Add Control
End Sub

Private Sub PlanningPMEPlugin_OnEvent(ByVal Context As PlanningPMEContext)
    If Context.Context = PpContextMessage Then
        If Context.Loword = 5000 And Context.message = WM_COMMAND And Context.Hiword = BN_CLICKED Then
            MsgBox "BN_CLICKED task Key = " & Context.Key
        End If
    End If
    If Context.Context = PpContextTrigger Then
        If Context.When = PpWhenInsert Then
            MsgBox "Trigger Insert task Key = " & Context.Key
        End If
        If Context.When = PpWhenUpdate Then
            MsgBox "Trigger Update task Key = " & Context.Key
        End If
    End If
End Sub

Compile your project
3 – Register your plugin
C:\windows\system32\regsvr32.dll plugin.dll
4 – Indicate in the PlanningPME register database (HKEY_LOCAL_MACHINE) the name of your plugin

Name : Plugin and Value : Projet1.plugin

5 – Launch PlanningPME
A new button in the task window will appear

plug in button

Pingbacks and trackbacks (1)+

Add comment