Source language: Translate to:

New Skeleton for PowerBasic Plugin

Questions about NeoBook PlugIns

Moderator: Neosoft Support

New Skeleton for PowerBasic Plugin

Postby David de Argentina » Sat Aug 28, 2010 4:33 am

Hi all,

If you are interested on create NeoBook Plugins using PowerBasic, this skeleton improves the provided on the NeoBook SDK.

* Supports Dialogs on Edit Time
* Supports nbInterface features
* Supports up 10 parameters per function

Code:
Code: Select all
'PowerBasic Skeleton for NeoBook Plugin SDK
'(c) 2010, David de Argentina
'Program is free, and you use it at your own risk
'Good Luck !


'---------------------------------------------------
'Compiler Directives.
'The syntax of this sample compiles with PB9 - Change as your need
 
#COMPILE DLL "NeoPlugin"   'Plugin Name.dll You must rename it as .nbp before install into NeoBook
#INCLUDE "Win32Api.inc"    'Usually used. Change or add another as you need
#RESOURCE "Plugin.pbr"     'Main icon, images, etc.


'---------------------------------------------------
'Variables Initialization
$PLUGIN_TITLE   = "NeoPlugin 1.03"      'Title that appairs on the NeoBook Plugin List
$PLUGIN_AUTHOR  = "My Name"             'your name
$PLUGIN_INFO    = "My First Plugin"     'Info that appairs on the Neobook Plugin dialog


' Enumerations
%ACTIONPARAM_NONE     = 0
%ACTIONPARAM_ALPHA    = 1   ' May contain alpha, numeric, punctuation, etc.
%ACTIONPARAM_ALPHASP  = 2   ' Contains aplha text that can be spell checked.
%ACTIONPARAM_NUMERIC  = 3   ' Must be numeric value 0..9
%ACTIONPARAM_MIXED    = 4   ' May be either numeric or alpha. May contain math expression
%ACTIONPARAM_FILENAME = 5   ' Parameter is a file name
%ACTIONPARAM_VARIABLE = 6   ' Parameter is a variable name
%ACTIONPARAM_DATAFILE = 7   ' Parameter is data file - if not a variable then should be localized
%MaxActionParams      = 10  ' Maximum number of parameters per action


'Call dWord functions variables
GLOBAL nbGetVar     AS DWORD
GLOBAL nbSetVar     AS DWORD
GLOBAL nbPlayAction AS DWORD
GLOBAL nbInterface  AS DWORD
GLOBAL nbAddFile    AS DWORD
GLOBAL nbAddAction  AS DWORD
GLOBAL nbWinHandle  AS DWORD


'Variable to handle parameters (max 10)
GLOBAL pzPar1       AS ASCIIZ PTR
GLOBAL pzPar2       AS ASCIIZ PTR
GLOBAL pzPar3       AS ASCIIZ PTR
GLOBAL pzPar4       AS ASCIIZ PTR
GLOBAL pzPar5       AS ASCIIZ PTR
GLOBAL pzPar6       AS ASCIIZ PTR
GLOBAL pzPar7       AS ASCIIZ PTR
GLOBAL pzPar8       AS ASCIIZ PTR
GLOBAL pp1          AS STRING
GLOBAL pp2          AS STRING
GLOBAL pp3          AS STRING
GLOBAL pp4          AS STRING
GLOBAL pp5          AS STRING
GLOBAL pp6          AS STRING
GLOBAL pp7          AS STRING
GLOBAL pp8          AS STRING


'more variables (for design time)
GLOBAL estado       AS STRING  'Status variable, but reserved word...
GLOBAL zData        AS ASCIIZ * 64
GLOBAL zz           AS ASCIIZ PTR
GLOBAL dwData       AS DWORD
GLOBAL hDlg         AS LONG
GLOBAL hDlgEdit     AS LONG
GLOBAL MyArray()    AS STRING


' more variables (for execution time)
' put your own Global variables here
GLOBAL MyVar      AS STRING
GLOBAL Vuelta     AS STRING
' Global MyString   as String
' etc

'---------------------------------------------------


' declares for NeoBook Compatibilities
DECLARE SUB AddActionProcType(BYVAL IDNum AS LONG, BYREF zName AS ASCIIZ, BYREF Hint AS ASCIIZ, BYREF Params AS ASCIIZ) ', ByVal NumParams As Byte)
DECLARE SUB AddFileProcType(BYREF s AS ASCIIZ, BYVAL AddFlag AS LONG)
DECLARE SUB GetVarProcType(BYREF VarName AS ASCIIZ, BYREF Value AS ASCIIZ)
DECLARE SUB SetVarProcType(BYREF VarName AS ASCIIZ, BYREF Value AS ASCIIZ)
DECLARE SUB PlayActionProcType(BYREF s AS ASCIIZ)
DECLARE FUNCTION InterfaceProcType(BYVAL InterfaceID AS LONG, BYREF zData AS ASCIIZ) AS LONG
DECLARE SUB dllHandlerProcType(BYVAL Reason AS LONG)


'---------------------------------------------------
' Your Declares goes here
' Declare Function OtherFunction alias "OtherFunction" Lib "LibName" (param1 as long, etc) as long


'---------------------------------------------------
' NeoBook SDK Functions
'---------------------------------------------------
SUB FreeStr(BYREF S AS DWORD)
  IF S <> %NULL THEN GlobalFree S
  S = %NULL
END SUB

SUB SetStr(BYREF Dest AS DWORD, BYVAL SOURCE AS STRING)
  FreeStr Dest
  IF LEN(SOURCE) THEN
     Dest = GlobalAlloc(%GPTR, LEN(SOURCE) + 1)
     POKE$ Dest, SOURCE
  END IF
END SUB

SUB xnbAddAction(BYVAL IDNum AS LONG, zName AS ASCIIZ, zHint AS ASCIIZ, Params AS ASCIIZ, BYVAL NumParams AS BYTE)
  ASM push eax
  ASM xor eax,eax
  ASM mov al, NumParams
  ASM push eax
  ASM push eax
  CALL DWORD nbAddAction USING AddActionProcType(IDNum, zName, zHint, Params)
  ASM pop eax
END SUB

SUB SetVariable(BYVAL Variable$,BYVAL vuelta$)
   CALL DWORD nbSetVar USING SetVarProcType(BYCOPY variable$, BYCOPY vuelta$)
END SUB

SUB PlayScript(BYVAL Script$)
    CALL DWORD nbPlayAction USING PlayActionProcType(BYCOPY Script$)
END SUB
'---------------------------------------------------
' End NeoBook SDK initialization Functions -
' The following functions are added by David de Argentina
' If you could improve this function, please let me know about. Thanks
'---------------------------------------------------


'---------------------------------------------------
' ae_sendVariable:
' Purpose: get a NeoBook Variable value
' Example:
' StringVar = ae_sendVariable "[var1]"
FUNCTION ae_SendVariable(a AS ASCIIZ) AS STRING
vuelta = a
END FUNCTION
'---------------------------------------------------


'---------------------------------------------------
' Get_handle
' Purpose: get the handle of a NeoBook Object
' example
' LongVar = Get_Handle "Rectangle1"
FUNCTION Get_Handle (sname AS STRING) AS LONG
playscript "GetObjectHandle " + $DQ + sname + CHR$(34,32,34) + "[LB_Object.Handle]" + $DQ
PlayScript "ae_sendvariable "+CHR$(34)+"[LB_Object.Handle]"+CHR$(34)
FUNCTION = VAL(vuelta)
END FUNCTION
'---------------------------------------------------



'---------------------------------------------------
' Get_nbInterface
' Purpose: get the nbInterface using NeoBook SDK
' example
' StringVar = Get_Interface (14)
FUNCTION Get_nbInterface (ID AS LONG) AS STRING
CALL DWORD nbInterface USING InterfaceProcType (BYVAL ID, BYREF zData )
zz = VARPTR(zData)
FUNCTION = @@zz
END FUNCTION

'PBMain (or WinMain) Function - Does Nothing.

FUNCTION PBMAIN() AS LONG
END FUNCTION



'---------------------------------------------------

' Our First Function of the plugin.
' you could do everything in this.
' on the sample, function will launch a MsgBox with some data received as parameters.

FUNCTION My_Function (d1 AS ASCIIZ,d2 AS ASCIIZ,d3 AS ASCIIZ,d4 AS ASCIIZ) EXPORT AS LONG
LOCAL par1 AS STRING, par2 AS LONG, par3 AS STRING, par4 AS LONG  'some local vars
par1 = D1         'for example, the user name
par2 = VAL(D2)    'for example, the user age
par3 = D3       'for example, the description
par4 = VAL(D4)    'for example, the valuation

MSGBOX    "Name: " & par1 & $CRLF & _
      "Age:  " & STR$(par2) & $CRLF & _
      "Description: " & par3 & $CRLF & _
      "Valuation: " & STR$(par4)
END FUNCTION

'It's all !!! End of our first function
'---------------------------------------------------



'---------------------------------------------------
' Now, we need do the dialogs and CallBack Functions to be appair on the DESIGN TIME
' the first function is the CallBack of the DESIGN TIME Dialog
' you could customize as you need
'---------------------------------------------------

CALLBACK FUNCTION DlgProc_F2() AS LONG
SELECT CASE CBMSG
   CASE %WM_COMMAND
    SELECT CASE CBCTL
      CASE 100                          ' Ok Button
        CONTROL GET TEXT hDlgEdit, 120 TO pp1   ' get the edited parameters (we use 4 on this sample)
        CONTROL GET TEXT hDlgEdit, 121 TO pp2
        CONTROL GET TEXT hDlgEdit, 122 TO pp3
         CONTROL GET TEXT hDlgEdit, 123 TO pp4
        estado = "Ok"                     'Ok button is pressed, Status is Ok (end Edition Dialog)
         DIALOG END hDlgEdit
       
      CASE 5130    'this object does not exist. is only for demonstration
        ' this "Virtual" button was pressed. Some possibilities:
        ' Sammples asumes pp2 variable for the return value and inputbox 120 to store value
        '
        'a) Button calls for the Object Selector dialog
         pp2 = get_nbInterface (1)
         CONTROL SET TEXT hDlgEdit, 120, pp2
         CONTROL SET FOCUS hDlgEdit, 100
       
         'b) Button calls for the Action Editor dialog
        pp2 = get_nbInterface (2)
         CONTROL SET TEXT hDlgEdit, 120, pp2
         CONTROL SET FOCUS hDlgEdit, 100
       
         'c) Button Calls for the Object Selector dialog and only allow Rectangle objects to be selected.
        pp2 = get_nbInterface (8)
         CONTROL SET TEXT hDlgEdit, 120, pp2
         CONTROL SET FOCUS hDlgEdit, 100
       
         'd) Button Calls for the NeoBook's color palette and allow the user to select a color.
        pp2 = get_nbInterface (10)
         CONTROL SET TEXT hDlgEdit, 120, pp2
         CONTROL SET FOCUS hDlgEdit, 100
       
         'e) Button Calls for NeoBook 5's Variable Selector dialog
        pp2 = get_nbInterface (14)
         CONTROL SET TEXT hDlgEdit, 120, pp2
         CONTROL SET FOCUS hDlgEdit, 100
       
      CASE 130  ' Search Neobook Variables for the name
        pp2 = get_nbInterface (14)
        CONTROL SET TEXT hDlgEdit, 120, pp2
        CONTROL SET FOCUS hDlgEdit, 100
      CASE 134
      pp2 = get_nbInterface (14)
        CONTROL SET TEXT hDlgEdit, 124, pp2
        CONTROL SET FOCUS hDlgEdit, 100
      CASE 136
      pp2 = get_nbInterface (1)
        CONTROL SET TEXT hDlgEdit, 126, pp2
        CONTROL SET FOCUS hDlgEdit, 100
    END SELECT
  CASE %WM_NOTIFY
END SELECT
END FUNCTION

'---------------------------------------------------
' this is the dialog that will appair on screen each time the function is called from NeoBook on DESIGN TIME
'---------------------------------------------------
FUNCTION nbEditAction ALIAS "_nbEditAction@8" (BYVAL IDNum AS LONG, BYVAL pParams AS DWORD PTR) EXPORT AS BYTE
LOCAL i AS LONG
SELECT CASE IDNum
   CASE 1  ' used for the ae_getVariable Function. you could erase if you don't need
    ' function does not show any dialog, only sets itself as true
    FUNCTION = %True
   CASE 2
    pzPar1 = @pParams[0]
    pzPar2 = @pParams[1]
    pzPar3 = @pParams[2]
    pzPar4 = @pParams[3]
   
   
    ' Sometimes we will need some NeoBook values
    '(you must process each list via Parse$(List,delim,item) and charge an array with the data)
    '
    'a)to get the List of Page Titles
    '   Local MyVar as string
    '   MyVar = get_nbInterface (3)
    '
    'b)to get the List of Functions in the Function Library
    '  (you must process the list via Parse$(List,delim,item) and charge an array with the data)
    '   Local MyVar as string
    '   MyVar = get_nbInterface (4)
    '
    'c)to get the List of Subroutines in the Publication's Subroutine Action
    '  (you must process the list via Parse$(List,delim,item) and charge an array with the data)
    '   Local MyVar as string
    '   MyVar = get_nbInterface (5)
    '
    '
    '  Sample how to parse the data
    '   REDIM MyArray(1 TO PARSECOUNT(MyVar,CHR$(13,10))) AS STRING
    '   FOR i = 1 TO PARSECOUNT(MyVar,CHR$(13,10))
    '     MyArray(i) = PARSE$(MyVar,CHR$(13,10),i)
    '   NEXT
   
   
    ' on this sample, we put the age on a array and display it
    DIM Ages () AS STRING
    REDIM Ages (20 TO 60)
    FOR i = 20 TO 60
      Ages(i) = STR$(i)
    NEXT
   
   
    'Now, we create de Design time dialog
    '
    DIALOG FONT "Arial", 8, 0, 0
    DIALOG NEW PIXELS, 0, "NeoPlugin Edit Dialog",300,300,260,260, %WS_SYSMENU TO hDlgEdit
    CONTROL ADD IMAGEX, hDlgEdit, 10, "#1", 0, 0, 260, 260,,  'Dialog background image
   
    CONTROL ADD LABEL,    hDlgEdit, 110,      "User Name ", 20, 10,120, 20
    CONTROL ADD TEXTBOX,  hDlgEdit, 120,                "", 20, 30,200, 20,, %WS_EX_CLIENTEDGE
    CONTROL ADD BUTTON,   hDlgEdit, 130,             "···",220, 30, 20, 20
    CONTROL SET TEXT      hDlgEdit, 120, @PzPar1
    CONTROL SET COLOR     hDlgEdit, 110, -1, -2
   
    CONTROL ADD LABEL,    hDlgEdit, 111,           "Age: ", 20, 60,220, 20
    CONTROL ADD COMBOBOX, hDlgEdit, 121,            Ages(), 20, 77,220, 20,, %WS_EX_CLIENTEDGE
    CONTROL SET TEXT      hDlgEdit, 121, @PzPar2
    CONTROL SET COLOR     hDlgEdit, 111, -1, -2
   
    CONTROL ADD LABEL,    hDlgEdit, 112,     "Description", 20,110,120, 20
    CONTROL ADD TEXTBOX,  hDlgEdit, 122,                "", 20,130,200, 20,, %WS_EX_CLIENTEDGE
    CONTROL SET TEXT      hDlgEdit, 122, @PzPar3
    CONTROL SET COLOR     hDlgEdit, 112, -1, -2
   
    CONTROL ADD LABEL,    hDlgEdit, 113,           "Value", 20,160,180, 20
    CONTROL ADD TEXTBOX,  hDlgEdit, 123,                "", 20,180,200, 20,, %WS_EX_CLIENTEDGE
    CONTROL SET TEXT      hDlgEdit, 123, @PzPar4
    CONTROL SET COLOR     hDlgEdit, 113, -1, -2
   
    CONTROL ADD BUTTON,   hDlgEdit, 100,                 "Done", 90,220,100,24
    DIALOG SHOW MODAL hDlgEdit CALL DlgProc_F2
   
    IF estado = "Ok" THEN
      SetStr @pParams[0], pp1
      SetStr @pParams[1], pp2
      SetStr @pParams[2], pp3
      SetStr @pParams[3], pp4
      SetStr @pParams[4], pp5
      SetStr @pParams[4], pp5
      SetStr @pParams[5], pp6
      SetStr @pParams[6], pp7
    END IF
    FUNCTION = %True
   CASE ELSE: FUNCTION = %FALSE
END SELECT
END FUNCTION


' This Function is called each time program starts *** EXECUTION TIME ***
FUNCTION nbExecAction ALIAS "_nbExecAction@8" (BYVAL IDNum AS LONG, BYVAL Pars AS DWORD PTR) EXPORT AS BYTE
LOCAL pPar1 AS ASCIIZ PTR, pPar2 AS ASCIIZ PTR, pPar3 AS ASCIIZ PTR, pPar4 AS ASCIIZ PTR, pPar5 AS ASCIIZ PTR, pPar6 AS ASCIIZ PTR, pPar7 AS ASCIIZ PTR, pPar8 AS ASCIIZ PTR
SELECT CASE IDNum
   CASE 1               'ae_sendVariable used
    pPar1 = @Pars[0]  'Use only one params
    ae_sendVariable BYCOPY @pPar1
    FUNCTION = %True
   CASE 2              'Our Function: uses 4 parameters
    pPar1 = @Pars[0]
    pPar2 = @Pars[1]
    pPar3 = @Pars[2]
    pPar4 = @Pars[3]
    My_Function BYCOPY @pPar1,BYCOPY @pPar2,BYCOPY @pPar3,BYCOPY @pPar4
    FUNCTION = %True
   CASE ELSE: FUNCTION = %FALSE
END SELECT
END FUNCTION

'*********************************************************
' *****  Following function may not be modificate ********
'*********************************************************
SUB nbInitPlugIn ALIAS "_nbInitPlugIn@16" (BYVAL WinHandle AS DWORD, _
                                           BYREF PlugInTitle AS DWORD, _
                                           BYREF PlugInPublisher AS DWORD, _
                                           BYREF PlugInHint AS DWORD) EXPORT
  nbWinHandle = WinHandle
  SetStr PlugInTitle, $PLUGIN_TITLE
  SetStr PlugInPublisher, $PLUGIN_AUTHOR
  SetStr PlugInHint, $PLUGIN_INFO
END SUB

'*********************************************************
' *****  Following function may not be modificate ********
'*********************************************************
SUB nbRegisterScriptProcessor ALIAS "_nbRegisterScriptProcessor@4" (BYVAL PlayActionProc AS DWORD) EXPORT
  '***************************** Do Not MODIFY ********************************
  nbPlayAction = PlayActionProc
  '****************************************************************************
END SUB

'*********************************************************
' *****  Following function may not be modificate ********
'*********************************************************
SUB nbMessage ALIAS "_nbMessage@8" (BYVAL MsgCode AS LONG, BYVAL Reserved AS LONG) EXPORT
  SELECT CASE MsgCode
         CASE 01:   ' Don't care
         CASE 02:   ' Don't care
         CASE 03:   ' Don't care
         CASE 04:   ' Don't care
         CASE 05:   ' Don't care
         CASE 06:   ' Don't care
         CASE 07:   ' Don't care
         CASE 08:   ' Don't care
         CASE 09:   ' Don't care
         CASE 10:   ' Don't care
  END SELECT
END SUB

'*********************************************************
' *****  Following function may not be modificate ********
'*********************************************************
SUB nbRegisterInterfaceAccess ALIAS "_nbRegisterInterfaceAccess@4" (BYVAL InterfaceProc AS DWORD) EXPORT
  '***************************** Do Not MODIFY ********************************
  nbInterface = InterfaceProc
  '****************************************************************************
END SUB

'*********************************************************
' Use this function if you want add Registration Keys ****
'*********************************************************
FUNCTION VerifyRegCode(BYVAL CODE AS ASCIIZ PTR) AS LONG
  FUNCTION = %True
END FUNCTION

'*********************************************************
' Use this function if you want add Registration Keys ****
'*********************************************************
FUNCTION GetRegCode(BYREF CodeStr AS ASCIIZ) AS LONG
  CodeStr = "ABC123"
  FUNCTION = %True
END FUNCTION

'*********************************************************
' Use this function if you want add Registration Keys ****
'*********************************************************
FUNCTION nbVerifyLicense(BYREF CODE AS ASCIIZ) AS BYTE
  DIM CodeStr AS ASCIIZ * 256
  IF LEN(CODE) = 0 THEN ' empty parameter
      IF GetRegCode(CodeStr) THEN
          SetStr VARPTR(CODE), CodeStr
          FUNCTION = %TRUE
      END IF
  ELSE
      FUNCTION = VerifyRegCode(VARPTR(CODE))
  END IF
END FUNCTION


'*********************************************************
' This Function Register Plugin Functions              ***
'*********************************************************
SUB nbRegisterPlugIn ALIAS "_nbRegisterPlugIn@16" (BYVAL AddActionProc AS DWORD, _
                                                   BYVAL AddFileProc AS DWORD, _
                                                   BYVAL VarGetFunc AS DWORD, _
                                                   BYVAL VarSetFunc AS DWORD) EXPORT
  '***************************** Do Not MODIFY ********************************
  nbGetVar      = VarGetFunc
  nbSetVar      = VarSetFunc
  nbAddAction   = AddActionProc
  nbAddFile     = AddFileProc
  '****************************************************************************

  '******************* Enter your Plug-In's actions below *******************
  'Usage:
  'xnbAddAction ID, Function_Name, Description, Param_Type, Num_Of_Params
  '
  'Where:
  'xnbAddAction is the Function. Allways goes.
  'ID = Numerical identificator of the function. The same number of nbEditAction or nbExecAction Functions
  'Function_Name: The name of your function. On Sample: "My_Function"
  'Description: Is the description of each function.
  'Param_Type: We use allways String variables. String Variables are Type 1.
  '            We must set CHR$(1,1,1,etc) (one "1" for each parameter).
  '            On Sample: CHR$(1,1,1,1) means 4 String parameters
  'Num_Of_Params: The number of params. On Sample 4.

  xnbAddAction 1, "ae_sendvariable", "*** INTERNAL USE ONLY *** DONT CALL" , CHR$(1), 1

  xnbAddAction 2, "My_Function", "My First function goes here " _
                 + CHR$(13,10) + "My_Function " + CHR$(34)+ "User Name"+CHR$(34,32,34)+"Age"_
                 + CHR$(34,32,34)+"Description"+CHR$(34,32,34)+"Valuation"+CHR$(34), CHR$(1,1,1,1), 4

END SUB

'*********************************************************
' *****  Following function may not be modificate ********
'*********************************************************
FUNCTION LIBMAIN(BYVAL hInstance AS DWORD, _
                 BYVAL Reason    AS LONG, _
                 BYVAL Reserved  AS LONG) AS LONG
  IF (Reason = %DLL_PROCESS_DETACH) THEN
  END IF
  FUNCTION = %True
END FUNCTION


I hope it will be usefull for NeoBookers...

Greetings from Buenos Aires,
David de Argentina
User avatar
David de Argentina
 
Posts: 1553
Joined: Mon Apr 04, 2005 4:13 pm
Location: Buenos Aires, Argentina

Postby David de Argentina » Sat Aug 28, 2010 1:48 pm

Update Program.

Now, The Edit Dialog has a new relationship with the parent window.

where said:

DIALOG NEW PIXELS, 0, "NeoPlugin Edit Dialog",300,300,260,260, %WS_SYSMENU TO hDlgEdit

Must say:

DIALOG NEW PIXELS, GetActiveWindow, "NeoPlugin Edit Dialog",150,20,260,260, %WS_SYSMENU TO hDlgEdit

Edit: this link does not work anymore...See last post

Enjoy it !

David de Argentina
Last edited by David de Argentina on Fri Sep 03, 2010 2:43 pm, edited 2 times in total.
User avatar
David de Argentina
 
Posts: 1553
Joined: Mon Apr 04, 2005 4:13 pm
Location: Buenos Aires, Argentina

Postby Neosoft Support » Mon Aug 30, 2010 10:05 am

David thank you for creating this. Would it be OK to include your version in the official NeoBook plug-in SDK?
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby David de Argentina » Mon Aug 30, 2010 1:02 pm

Thanks Dave,

I will be happy for this.

Greetings from Buenos Aires,
David de Argentina
User avatar
David de Argentina
 
Posts: 1553
Joined: Mon Apr 04, 2005 4:13 pm
Location: Buenos Aires, Argentina

Postby Neosoft Support » Mon Aug 30, 2010 3:05 pm

Great! Thank you.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby andybrock » Thu Sep 02, 2010 6:51 am

What version of Powerbasic do you need to write plugins using this?

Andy
User avatar
andybrock
 
Posts: 181
Joined: Mon Apr 20, 2009 1:38 pm
Location: Somerset, UK

Postby David de Argentina » Thu Sep 02, 2010 11:20 am

PBWin 7 or newer
User avatar
David de Argentina
 
Posts: 1553
Joined: Mon Apr 04, 2005 4:13 pm
Location: Buenos Aires, Argentina

Postby David de Argentina » Thu Sep 02, 2010 7:28 pm

Skeleton updated.

* nbSetVar & nbGetVar works properly (see SetVariable & GetVariable functions)

* GetObjectHandle works properly (nbInterface 7)

* nbInterface works properly (for non-Data and Data Interfaces)

* Program recoded to work with PBWin 7 or newer.

All files needed (Skeleton.BAS, NeoPlugin.NBP, Plugin.PBR and My_Plugin.PUB) are available at:

Edit: this link does not work anymore... See last post

Enjoy it !
David de Argentina

PS: Dave:

I didn't find the way to activate the "optional" functions like nbAbout and nbVerifyLicense.

I declared both functions with "Alias" and Export flag, but nothing happens when plugin is loaded into NeoBook...

Any ideas ?

Thanks in advance,
David de Argentina
Last edited by David de Argentina on Fri Sep 03, 2010 2:43 pm, edited 2 times in total.
User avatar
David de Argentina
 
Posts: 1553
Joined: Mon Apr 04, 2005 4:13 pm
Location: Buenos Aires, Argentina

Postby Neosoft Support » Fri Sep 03, 2010 10:23 am

It's been a long time since I used Basic, but I think you would do something like this:

FUNCTION nbVerifyLicense ALIAS "_nbVerifyLicense@4" (BYREF CODE AS ASCIIZ) EXPORT AS BYTE

SUB nbAbout ALIAS "_nbAbout@0" () EXPORT
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby David de Argentina » Fri Sep 03, 2010 2:40 pm

Skeleton Updated.

Now, nbAbout & nbVerifyLicense are operative (Thanks Dave !!!)

In fact, all functions you need for create Free, Share or Comercial plugins are available and works fine.

You need re-download the files at:

http://www.mediafire.com/file/594429n7b ... Plugin.zip

Thanks again,

David de Argentina
User avatar
David de Argentina
 
Posts: 1553
Joined: Mon Apr 04, 2005 4:13 pm
Location: Buenos Aires, Argentina

Postby Tony Kroos » Wed Jan 04, 2012 2:53 am

David de Argentina wrote:In fact, all functions you need for create Free, Share or Comercial plugins are available and works fine.
Would you check that again? just can not get nbVerifyLicense to work (
Tony Kroos
 
Posts: 402
Joined: Thu Oct 15, 2009 3:43 pm

Postby David de Argentina » Fri Feb 03, 2012 9:30 am

Replace the nbVerifyLicense with this one:

Code: Select all
FUNCTION nbVerifyLicense ALIAS "_nbVerifyLicense@4" (BYREF CODE AS ASCIIZ) EXPORT AS BYTE
  DIM CodeStr AS ASCIIZ * 256
  IF LEN(CODE) = 0 THEN ' empty parameter
      IF GetRegCode(CodeStr) THEN
          SetStr VARPTR(CODE), CodeStr
          FUNCTION = %True
      END IF
  ELSE
      FUNCTION = VerifyRegCode(VARPTR(CODE))
  END IF
END FUNCTION


or comment this function in order to set another registration way.

Last update (see my previous post) has the correct function

Greetings from Buenos Aires,
David de Argentina
User avatar
David de Argentina
 
Posts: 1553
Joined: Mon Apr 04, 2005 4:13 pm
Location: Buenos Aires, Argentina


Return to PlugIn Discussions

Who is online

Users browsing this forum: No registered users and 1 guest