short comeback

please, can anybody help to fix this powerbasic dll example "input.bas" ? I tried to compile it but without success, line 28 may be a problem. I want to understand the dll handling for thinbasic too. I was working at an project during my training course (with freebasic and thinbasic for one of our programming course as viewing how to create message boxes examples). Now I would like to understand how to do this one on pb

I have bought last week-end powerbasic 9.1 and have had a short look at this interesting tool. now my first question. would be great to get any help. I have in mind to create new things for thinbasic too, my novel is going up to the end now and I am very proud of it to finish the book until end of october, so there will be more time for thinbasic.

powerbasic code:

[code=thinbasic]'
' Example DLL to display a modal dialog and return a value to the calling
' application.
'
' Requires PB/DLL v1.10 or later to compile.
'

$COMPILE DLL

$INCLUDE "WIN32API.INC"

DECLARE FUNCTION InputDlgProc(BYVAL hDlg AS INTEGER, _
BYVAL wMsg AS INTEGER, _
BYVAL wParam AS INTEGER, _
BYVAL lParam AS LONG) AS INTEGER


GLOBAL DlgAddr AS DWORD
GLOBAL hCurInstance AS WORD

GLOBAL gText AS ASCIIZ * 255
GLOBAL gCaption AS ASCIIZ * 255
GLOBAL gDefault AS ASCIIZ * 255

FUNCTION LIBMAIN (BYVAL hInstance AS LONG, _
BYVAL wDataSeg AS DWORD, _
BYVAL wHeapSize AS DWORD, _
lpszCmdLine AS ASCIIZ) EXPORT AS INTEGER ' ??? mistake here?

'Save the instance handle of the DLL
hCurInstance = hInstance

'Remember! We have to return a "one" to indicate successful
' initialization
LIBMAIN = 1 'success!

END FUNCTION


FUNCTION InputBox(TEXT AS ASCIIZ PTR, _
Caption AS ASCIIZ PTR, _
DEFAULT AS ASCIIZ PTR) EXPORT AS INTEGER

' Get the address of the dialog callback
DlgAddr = MakeProcInstance(CODEPTR(InputDlgProc), hCurInstance)

' If pointers are non-null, set default values for dialog
IF TEXT THEN
gText = @TEXT
ELSE
gText = "Enter Text"
END IF

IF Caption THEN
gCaption = @Caption
ELSE
gCaption = "INPUT BOX"
END IF

IF DEFAULT THEN
gDefault = @DEFAULT
ELSE
gDefault = ""
END IF

' Pop up the modal dialog and get return value
FUNCTION = DialogBox(hCurInstance, "INPUTBOX", 0, DlgAddr)

' If default buffer was passed, return the input text
IF DEFAULT THEN
@DEFAULT = gDefault
END IF

END FUNCTION


' **
' ** Generic routine to center any window given its handle.
' **
SUB CenterWindow(BYVAL hWnd AS WORD)

DIM WndRect AS RECT
DIM x AS INTEGER
DIM y AS INTEGER

GetWindowRect hWnd, WndRect

x = (GetSystemMetrics(%SM_CXSCREEN)-(WndRect.nRight-WndRect.nLeft))\2
y = (GetSystemMetrics(%SM_CYSCREEN)-(WndRect.nBottom-WndRect.nTop+GetSystemMetrics(%SM_CYCAPTION)))\2

SetWindowPos hWnd, %NULL, x, y, 0, 0, %SWP_NOSIZE OR %SWP_NOZORDER

END SUB


FUNCTION InputDlgProc(BYVAL hDlg AS INTEGER, _
BYVAL wMsg AS INTEGER, _
BYVAL wParam AS INTEGER, _
BYVAL lParam AS LONG) EXPORT AS INTEGER

' See INPUTBOX.RC script for details on the dialog itself

SELECT CASE wMsg
CASE %WM_INITDIALOG

'Center the window
CenterWindow hDlg

'Assign the initial values to the dialog
SetWindowText GetDlgItem(hDlg, 101), gText
SetWindowText GetDlgItem(hDlg, 102), gDefault
SetWindowText hDlg, gCaption

FUNCTION = 1
EXIT FUNCTION

CASE %WM_COMMAND
SELECT CASE wParam
CASE 103, %IDOK
'When the "OK" button is pressed, get the edit box value
' and end the dialog
GetWindowText GetDlgItem(hDlg, 102), gDefault, 255
EndDialog hDlg, 1
FUNCTION = 1
EXIT FUNCTION
'When the "CANCEL" button is pressed, or escape is pressed, or
' the dialog is closed, end the dialog
CASE 104, %IDCANCEL
EndDialog hDlg, 0
FUNCTION = 1
EXIT FUNCTION
END SELECT
END SELECT

END FUNCTION[/code]

thanks in advance, lionheart