Programming for Users

P R O F A N ²   6.0

THE easy programming language
for Windows 3.x and Windows 95/NT

Translation based on the original manual Profan² 6.0
and the english manual version of Profan² 3.3e from 
Mike Knueppel
 by
Markus Vedder-Kemnitzer
Melker Strasse 22
D-91567 Herrieden
Germany
email: k-m.kemnitzer@t-online.de

Thanks for the wonderful help of
Chris Smith Iowa/USA
tvs@netins.net

Part 3: Reference

Overview System Variables

!Input

$dbLUpdate
$dbFName
$dbFType
$DosVer
$Drive
$GetInput
$GetText
$Input
$ProfVer
$SysPath
$WinPath
$WinVer

%BitsPixel
%BmpX
%BmpY
%Button
%dbDeleted
%dbEoF
%dbFCount
%dbFDecs
%dbFLen
%dbFNumber
%dbHeader
%dbMemo
%dbRecSize
%dbVersion
%DDEWin
%Desktop
%Error
%ErrNumber
%Font
%GetCount
%GetCurSel
%GetFocus
%GetInputState
%HDC
%HDC2
%HINstance
%HWnd
%Input
%IOResult
%Key
%LFN
%MaxX
%MaxY
%MCIError
%MenuItem
%Message
%MouseKey
%MousePressed
%MouseX
%MouseY
%MWnd (see %Message)
%ParCount
%PCount
%PeekMessage
%ScanKey
%wmPaint
%wmTimer
%Win32
%WinTop
%WinBottom
%WinRight
%WinLeft

&BmpCol
&dbRecCount
&dbRecNo
&GetTickCount
&Input
&LParam (see %Message)
&SQLCount
&WParam (see %Message)

Overview of Functions

@!
@$
@%
@&

@Abs
@Add$
@Add
@AddChoice
@AddString
@And
@AnsiToOem$
@ArcTan

@BlockRead
@Bin$
@Byte

@Char$
@ChooseDir$
@Chr$
@CloseCom
@ComError
@Control
@Cos
@Cot
@CreateButton
@CreateCheckBox
@CreateChoiceBox
@CreateDefButton
@CreateDialog
@CreateEdit
@CreateExtDialog
@CreateGroupBox
@CreateHScroll
@CreateIcon
@CreateListBox
@CreateMultiEdit
@CreateRadioButton
@CreateText
@CreateSortedListBox
@CreateVScroll
@CreateWindow
@CToD$

@Date$
@dbAppendBlank
@dbClose
@dbDelete
@dbFind
@dbGet$
@dbGetField$
@dbGetMemo
@dbGo
@dbIndex
@dbOpen
@dbPack
@dbPut
@dbPutField
@dbPutMemo
@dbPutRec
@dbSeek
@dbUndelete
@dbUse
@Del$
@DeleteChoice
@DeleteString
@DestroyWindow
@DiskFree
@DiskSize
@Div&
@Div
@DToC$

@EditBox
@Eof
@Equ$
@Equ
@Exp
@ExtString$

@FilePos
@FileSize
@FindFirst$
@FindNext$
@FindWindow
@Format$

@GetActiveWindow
@GetBValue
@GetByte
@GetCheck
@GetClip$
@GetCount
@GetCurSel
@GetDir$
@GetEnv$
@GetFAttr
@GetFDate$
@GetFileSize
@GetFocus
@GetGValue
@GetHandle
@GetKey$
@GetLine$
@GetLineCount
@GetPixel
@GetRValue
@GetString$
@GetText$
@GetUsage
@GT
@GT$

@Height
@Hex$ (see @Bin$)

@IconCount
@If
@Inkey$
@Inp
@InpB
@Input$
@Ins$
@InsertString
@InStr
@Int

@KeyIn

@Left$
@Len
@Lg
@List!
@List$
@List%
@List&
@ListBox$
@ListBoxItem$
@Ln
@LoadFile$
@Long
@LongName$
@Lower$
@LT
@LT$

@MCISend$
@MenuItem
@MessageBox
@Mid$
@MkStr$
@Mod
@Mouse
@MoveListToChoice
@MoveListToEdit
@MoveListToList
@Mul

@NEq
@NEq$
@Not

@Oct$ (see @Bin$)
@OemToAnsi$
@Or
@Ord
@OpenCom

@Par$
@Pi
@Pow
@PostMessage
@Pwd$

@ReadCom
@ReadIni$
@Right$
@RGB
@Rnd
@Round

@SaveFile$
@ScanKey
@SelectString
@SendKey
@SendMessage
@SendString
@SetActiveWindow
@SetBit
@SetCom
@SetComExt
@SetFocus
@ShortName$
@ShowWindow
@Sin
@Space$
@SQLInit
@Sqr
@Sqrt
@Str$
@String$
@Sub
@SubStr$

@Tan
@TestBit
@Time$
@TMouse
@Translate$
@Trim$

@Upper$
@UseDLL

@Val

@Width
@WinExec
@WinExecWait
@Word
@WriteCom

@Xor

Overview Commands

´(Apostrophe)

Add
AddFiles
AddFonts
AddString
AddWindows
Append
AppendMenu
AppendMenuBar
Arc
Assign

Beep
BlockWrite
Byte

Case
CaseNot
Char
CharSet
CheckMenu
ChDir
Chord
ClearClip
ClearList
ClipLoadBMP
Close
CloseRW
Cls
Color
Copy
CopyBmp
CopyBmpToMem
CopySizedBmp
CreateMenu

DbCreate
DbCreateIndex
DDELink
DDEExecute
DDETerminate
Dec
Decimals
Declare
Def
Dim
Dim!
Dim$
Dim%
Dim&
Dispose
DrawIcon
DrawExtBmp
DrawExtIcon
DrawLibIcon
DrawSizedExtBmp
DrawSysIcon
DrawText

Ellipse
Else
ElseIf
EnableMenu
EnableWindow
EndIf
End
EndPaint
EndPrint
EndProc
EndSub
EndWhile
Erase
ExitWindows

FileMode
Fill
Font
FreeDLL

GetMessage
GoSub ... Return
GoTo

If ... ElseIf ... Else ... EndIf
IfNot ... Else ... EndIf
Inc
Input
Input#
InsertMenu

KillTimer

Let
Line
LineTo
ListBoxItem$
List!
List$
List%
List&
LoadBmp
LoadSizedBmp
Locate
Long

MCLS
MCopyBmp
MCopySizedBmp
MessageBox
MkDir
MoveTo
Music

NextPage
NumWidth

Orientation
OpenRW
OutP
OutPB

Parameters
PassWord
Pie
Play
PlaySound
PopUp
Print
Print#
Proc ... EndProc
PutByte
PutClip

Randomize
ReadText
Rectangle
Rem
RemoveMenu
Rename
RePaint
Reset
Return
Rewrite
RmDir
RoundRect
Run

SaveBmp
SaveBmpToClip
ScreenCopy
Seek
Separator
SetAutoPaint
SetCheck
SetDialogFont
SetErrorLevel
SetFAttr
SetLFN
SetMenuItem
SetPixel
SetScrollPos
SetScrollRange
SetText
SetTimer ... KillTimer
SetTrueColor
SetWindowPos
ShellShowCursor
ShowMin
ShowMax
ShowNormal
Sound
String

SQLDone
SQLExec
SQLSetNull
SQLSetDel
StartPaint ... EndPaint
StartPrint ... EndPrint
String
StrWidth
Sub
SubPopUp

TBox
TextColor
TraceOn
TraceOff
TrackMenu

UseBrush
UseCursor
UseExtCursur
UseExtMenu
UseFont
UseIcon
UsePen

WaitInput
WaitKey
WaitMouse
WaitScan
While ... EndWhile
WhileNot ... EndWhile
WinCopy
Window
WindowStyle
WindowTitle
WinHelp
Word
WriteIni

1. System Variables

System variables give information about conditions of the system, e.g. current mouse position, disk drives, etc.

There are four types of system variables:

 	$Name 		- The result type is a String
 	%Name 		- The result type is an Integer
 	&Name 		- The result type is a LongInt
 	!Name 		- The result type is a Float

!Input

The latest Float-Value entered with INPUT.

$dbFName

Name of the current field. Includes only uppercase-chars,  then ´_´-sign and max. 10 chars.

$dbFType

Type of the current database field:

C = Character (String)
N = Numeric
L = Logic
M = Memo
D = Date

$dbLUpdate

Date of the last database change. Format is DD.MM.YY

$DOSVer

Evaluates the DOS-Version (e.g. "5.0" )

$Drive

Evaluates the current drive  (without path)

$GetInput

The last text given with @Input$.

$GetText

The latest text chosen in a listbox (@ListBox$).

$Input

The latest string entered with INPUT.

$ProfVer

The current PROFAN² version in the format “X.YY-ZZ“. Means X as main version number, YY as sub version number and ZZ as a bit-value (16 = Windows 3.x- Version / 32 = Windows95/NT-Version).
For PROFAN² 5.0 under Windows 3.x the result is e.g. “5.0-16”.

$SysPath

Evaluates the Windows system path  (e.g. "C:\WINDOWS\SYSTEM" )

$WinPath

Evaluates the Windows path (e.g. "C:\WINDOWS" )

$WinVer

Evaluates the Windows version (e.g. "3.10")

%BmpX

Width of the last loaded or saved picture (after using LOADBMP, LOADSIZEDBMP, MLOADBMP, SAVEBMP)

%BmpY

Height of the last loaded or saved picture (after using LOADBMP, LOADSIZEDBMP, MLOADBMP, SAVEBMP)

%BitsPixel

The color resolution of the current driver in bits per pixel:

	 1 =   2 colors
	 4 =  16 colors
	 8 = 256 colors
	16 = 64k colors (HighColor)
	24 = 16M colors (TrueColor)

%Button

The button pressed in a message box or in pre-defined dialog:

	1 -	OK
	2 -	Cancel
	3 -	Abort
	4 -	Retry
	5 -	Ignore
	6 -	Yes
	7 -	No

Pre-defined dialogs return 1 for "OK" or 2 for "Cancel".

%dbDeleted

Delete marker of  the current record:

1 = Record is marked as deleted
0 = Record is NOT marked as deleted

%dbEoF

End-Of-File-Sign of the current database table

1 = End of database table is not reached
0 = ... is not yet reached

%dbFCount

Total number of fields in the actual database record.

%dbFDecs

Decimals of the current database field.

Decimals of the current database field. This value is only important for numeric fields.

%dbFLen

Length of current field. In numeric fields, the length includes the decimal point. To express a 6 digit US$ value with two decimals, the length of the field has to be 9.

%dbFNumber

Number of the current field.

%dbHeader

Header length of the active database table.

%dbMemo

Evaluates whether the opened dBase table includes MEMO-fields or not. PROFAN² supports only the memo format of dBase-III.

%dbRecSize

Record length of the current database table.

%DDEWin

This system variable contains the handle of the DDE-server, if a DDE-communication was created successful, otherwise it is 0. Should the DDE-server be terminated during the connection, the value of %DDEWin is NOT changed!. This is not done before DDETERMINATE.

%DeskTop

Handle of the background window.

%Error

The latest error that occurred. Like %IOResult, %Error will be set to zero, after it is read.

Error values:

	0 -	no error
	1 -	warning
	2 -	error

%ErrNumber

Contains the number of the last error. %ERRNUMBER will reset when it is read.

%Font

This system variable contains the handle of a font set with USEFONT. It can be used to change the font of a window object (Button, ListBox, etc.) with the help of @SendMessage().

%GetCount

Number of entries in the PROFAN² listbox.
NOTE: The first entry is number 0. So the real count of entries is %GetCount + 1.

Example:

ClearList
AddFiles "C:\WINDOWS\*.EXE"
Print @ADD (%GetCount,1);" EXE-Files"

%GetCurSel

Number/Index of the actual chosen entry in a listbox (see %GetCount).

%GetFocus

Handle of the active window object. In contrast to @GetActiveWindow() evaluates %GetFocus the handle of the actual button, listbox, editbox,... GetActiveWindow() evaluates the handle of the active (main)window.

Pressing F1 , using WAITINPUT, while the focus is in a dialog box or on a dialog object, %GetFocus contains the negative (!) value of the handle.

see also: @GetFocus

%GetInputState

The current input state: In case of any mouse move or keystroke the result is <> 0!
This system variable is important for programming screen savers.

see also: %MousePressed

%HDC

Display context of the (PROFAN²) main window. This system variable is a help when calling API functions, that need this value.

%HDC2

Display context of copy of the (PROFAN²) main window. (Windows takes this copy to repaint the main window, if it is necessary).

%HInstance

The instance handle of the actual running PROFAN² program. Used with function and commands that reach resources in other programs or DLLs. You get the instance handle of other programs as the result of @WinExec() or @UseDLL(). With %HINSTNCE it is possible to read resources (strings, icons, bitmaps, dialogs) out of the running PROFAN² program. (Interpreter or Runtime!)

Example:

 Let Dlg% = @CreateExtDialog(%HInstance,%HWnd,"FileOpen")

Calls the file loading dialog from the running program. Inside the interpreter, this is PROFAN.EXE, inside the finished EXE file, the linked program itself.) It is possible to change these resources BEFORE linking under PROFAN², e.g. with the help of Borland´s "Resource Workshop". This adds many possibilities for PROFAN² programs!

@GetUsage() evaluates the number of program starts. In this way, starting a program twice or more can be prevented.

Example:

 IF @Gt(@GetUsage(%HInstance),1)
   @MessageBox("The program runs already!","INFO",0)
 END
 ENDIF

WARNING: The function @GetUsage (corresponding to the API function GetModuleUsage) exits only  - Microsoft knows why - in Windows 16-Bit. PROFAN² 32-Bit uses a trick to call this function, because most of the 16-Bit API’s are included in Windows 95. Under Windows NT, @GetUsage() will produce an error message.

%HWnd

Handle of the (main) window in a PROFAN² program.

%Input

Last integer value given with INPUT.

%IOResult

After a file operation or directory search this variable contains one of the following error values:

	0 -	no error occurred
	2 -	file not found
	3 -	path not found
	5 -	access denied (Read Only?)
	12 -	invalid file mode
	15 -	invalid drive number
	16 -	directory cannot be removed (still files in directory?)
	17 -	RENAME not allowed with different drive number (see also Rename)
	18 -	No further entry (at @FindFirst/@FindNext)
	100 -	error during read from disk
	101 -	error during write on disk
	102 -	file number is not assigned to file (see also Assign)
	103 -	file not open (Reset, Rewrite or Append missing)
	104 -	file not opened for read (Reset missing)
	105 -	file not opened for write (Rewrite or Append missing)
	106 -	wrong format (using Input #N,..)

%Key

The ANSI-Code of the key pressed last. To use after the commands WAITKEY and WAITINPUT:

WaitInput
If @Equ(Key,90)
   Print "You pressed 'Z'"
EndIf

Except on keystrokes WAITKEY and WAITINPUT react also on following events and fill %Key in this way:

1	An entry in a listbox or in a ChoiceBox (ComboBox) was chosen
2	In a dialog box or dialog window the system menu was clicked, double-clicked
	or entered “Close“
4	The window sized was changed
5	During the focus was on a dialog object, F1 was pressed
13	Enter was pressed in a one-line editbox or in a listbox
255	A button, checkbox or radio button was pressed

%LFN

This system variable evaluates whether long filenames are used or not. Normally %LFN  finds out automatically if Windows 95 (%LFN = 1) or Windows 3.x (%LFN = 0) is running, but %LFN can be set with SetLFN.

INFORMATION: In PROFAN² 32-Bit the system variable %LFN always contains the value 1!

%MaxX

Horizontal resolution of the screen.

%MaxY

Vertical resolution of the screen.

%MCIError

The latest error occurred during an MCI string sent to control a multimedia driver (e.g. CD, sound card, MIDI device).  Easier to understand are the messages returned from @MCISend$ (in the country language).

%MenuItem

The identifier of the menu choice chosen last. If the Copyright character is clicked, the value will be 254; if no menu choice is clicked, the value will be 0. The numbers 1 to 253 and 255 to 32767 force no reaction and can be used by the programmer.

%Message - &WParam - &LParam - %Mwnd

The number of the latest windows message. This system variable is especially for usage together with GETMESSAGE and the system variable %PeekMessage. It is also useful after other WAIT-commands or inside a While/Wend-structure without (!) some of these commands.
Possible specific message information will be found in &LPARAM and &WPARAM. %MWND contains the handle of the window, that gets the message. See also: %PeekMessage

%MouseKey

The latest mouse button pressed:

	0 - 	no mouse button pressed
	1 - 	left mouse button
	2 - 	right mouse button

%MouseX and %MouseY contains the current mouse position.

%MousePressed

Contains, which key is pressed in the moment. To read %MousePressed will reset it.
Result: See %MOUSEKEY

%MouseX

The current mouse X-position. Usage especially after WAITMOUSE and WAITINPUT.

%MouseY

The current mouse Y-position. Usage especially after WAITMOUSE and WAITINPUT.

%ParCount

The total number of parameters transferred with the command line. In interpreter mode,  parameter 0 is the interpreter. In run-time mode, the run-time module, and in an EXE  file it is the EXE file.
Interpreter and run-time mode parameter 1 contains the executed program. Because an  EXE file might also act as a run-time module, the parameter can be the name of the  PRC file or a string starting with one of the following characters: ! " # $ % & ' ( ) * + , - . /
For further information see also @PAR$.

%PCount

Contains the total number of transferred parameters of the last procedure call (PROC). This is useful to write a procedure that can be called with a variable counting of parameters. Reading %PCount should be done at the beginning of a procedure.

%PeekMessage

This system variable contains information a message is given. If not result is 0, if there is a message the system variables %Message, &WParam, &LParam and %Mwnd will contain correspondingly. The message only will be read, but is NOT deleted out of the message queue! This is only done, when calling GETMESSAGE.

%ScanKey

The scancode (virtual code) of the latest pressed key.
Important scan codes:

	16 -	Shift
	17 -	Ctrl
	27 -	Esc
	33 -	PgUp
	34 -	PdDn
	35 -	End
	36 -	Home
	37 -	Left
	38 -	Up
	39 -	Right
	40 -	Down
	45 -	Ins
	46 -	Del
	112 -	F1
	... -	...
	123 -	F12

%Win32

This system variable is under PROFAN²-16Bit always 0, under Windows 95 or NT 1. Using %Win32 it is easy to differentiate between 16 and 32 bit, which may be necessary when getting messages or calling API and DLL functions.

	IF %Win32
	  <Code for 32 Bit>
	ELSE
	  <Code for 16 Bit>
	ENDIF

%wmPaint

This system variable will be set to 1 if  the event wm_Paint is used. The message wm_Paint is always sent, when a window - for whatever reason - complete or partly must be drawn new. This happens e.g. every time, another window covers a window or the window was resized. This message is an event and must be used with a WAITINPUT command.

wm_Paint is only given, if the automatically new-draw-mechanism is set off with SetAutoPaint. %wm_Paint is set to zero when it is read. Because it is possible to get %wm_Paint parallel to other messages, %wm_Paint should be checked in its own IF-structure.

Example:

	CLS
	SetAutoPaint 0
	< ... Here will be created e.g. a new menu, etc. ...>
	WhileNot %ProgEnd
	  WaitInput
	  If %wmPaint
	    <.. drawing window new ..>
	  EndIf
	  If ...
	    <... other checkings ..>
 	  Endif
	EndWhile

%wmTimer

wm_Timer will be given as soon as the timer is set with SETTIMER and the program has (!) a main window. This event ends a WAITINPUT. %wmTimer contains 1 until it is read. Reading will reset it to zero.

%WinTop

The y-coordinate of the upper window border.

%WinBottom

The y-coordinate of the lower window border.

%WinLeft

The x-coordinate of the left window border.

%WinRight

The x-coordinate of the right window border.

&BmpCol

Number of colors of the latest picture loaded with LOADBMP or LOADSIZEDBMP.

&dbRecCount

Number of records in the active database table.

&dbRecNo

Number of the active record.

&GetTickCount

This system variable contains the count of milliseconds, going since Windows was started.

Information: The internal timer will be 0 again after 49 days (If Windows is not be exited before the 49th day). 
&GetTickCount makes it possible to create a time-measure that is easier, when compared with the @Time$ function.

&Input

The latest longint value entered with INPUT.

&SQLCount

The number of data sets processed by the last SQL command. If &SQLCount has value 1, an error  occurred.

2. Functions

A function returns a value that normally depends on the function parameters. Everywhere in PROFAN², variables and constants (literals) can be set, also functions are allowed. The returned value should be the same and expected variable type.

All function names in PROFAN² normally start with a @. Some users believe the @ makes the code easier to read, because functions can be identified immediately, some programmers believe writing the @-sign is long-winded. 

Starting with PROFAN² 4.0 functions need @ no more. When running the interpreter this could force slower speeds. The performance of compiled programs will not be adversely affected.

Functions ending with a "$" return a string; the other functions return a numeric value. In a few cases compare functions - returning 1 or 0 - which end with a "$" to clarify that strings are the same.

If the return value of a function is not required, an assignment can be left out. In this case the function will be used as a command. Parentheses are still mandatory.

Example:

  @LISTBOX$("That’s the new list ",0)

In this case the listbox will be shown only for viewing. The result can be read with the system variable  $GETTEXT.

@!(N)

N : Integer (0 ... 8)

Result: Float

The N-te transferred parameter in a self defined function (or procedure) as float.

@$(N)

N : Integer (0 ... 8)

Result: String

The N-te transferred parameter in a self defined function (or procedure) as string.

@%(N)

N : Integer (0 ... 8)

Result: Integer

The N-te transferred parameter in a self defined function (or procedure) as integer.

@&(N)

N : Integer (0 ... 8)

Result: LongInt

The N-te transferred parameter in a self defined function (or procedure) as longint.

The 0. parameter is used after calling a procedure or sub-program with RETURN <value>  the return value. 

@Abs(N)

N : Value

Result: Value

Absolute value of the number N.

@Add$(S1,S2)

S1 : String
S2 : String

Result: String

Adding two strings S1 and S2. S2 will be added to S1.

@Add(N1,N2)

N1 : Value
N2 : Value

Result: Value

The sum N1 and N2.

See also: @Add$

@AddChoice(N,S)

N: Integer - handle of a choicebox
S: String - string to add

Result: Integer - success

The string S will be added to the choicebox with handle N and included in sorted order.

@AddString(N,S)

N: Integer - handle of a listbox
S: String - string to add

Result: Integer - success

The string S will be added to the listbox with handle N. If it is a sorted listbox the string is included in sorted order.

@And(N1,N2)

N1 : Value
N2 : Value

Result: Value

The values of N1 and N2 will be linked with the AND function.
The result is 0 if one or both values are 0.

Compare: @OR, @NOT

@AnsiToOem$(S)

S : String

Result: String

The string S will be transformed from ANSI code to ASCII code (OEM). This transformation concerns mostly European special chars. ASCII code is used under DOS, ANSI code under Windows.

@ArcTan(N)

N : Value (Angle in radian measure)

Result : Float 

The arc tangents of angle N.

@Bin$(N) - @Oct$(N) - @Hex$(N)	

N : Integer or LongInt - Value to transform

With these functions integer values (integer and longint) can be transformed in showmode of another numeric base systems. BIN means binary representation, OCT is octal and HEX hexadecimal representation. @Bin$(10) will return “1010“, @Oct$(10) =“12“ and @Hex$(10)= "A".

@BlockRead(#N,B,N1,N2)

#N : File number
B  : Area variable (Must be DECLAREd and DIMensioned before)
N1 : LongInt - Address inside the area variable (offset)
N2 : LongInt - Number of bytes

Result: LongInt - real read bytes

Out of the file - opened with OPENRW and the file number #N - a maximum of N2 bytes (starting at the file position pointer) will be read and copied into the area variable B, stored at address N1. When reaching the end of file before reading N2 bytes the @BlockRead() returns exactly the number of the real read bytes. In PROFAN²-16Bit only up to 65520 bytes can be read.

Example:

Declare B#,Count%
Dim B#,500
Assign #1,"TEST.DAT"
OpenRW #1
Let Count% = @BlockRead(#1,B#,0,500)
CloseRW #1
Print @Str$(Count%);" bytes read!"

@Byte(V,A)

V: Area variable (Must be DECLAREd and DIMensioned before)
A: LongInt - Address inside the area variable (offset)

Result: Integer - Value

This function returns the value of the byte at address (offset) A in the area variable V. If A is out of the value set before with DIM, an error message occurs.

@ChooseDir$(S)

S : String - Title of the dialog box

Result : String - selected path

The function calls the dialog for directory selection. This dialog is similar to SAVE-Dialog except that no file name can be entered. The return value is the selected path:

Let Path$ = @ChooseDir$("Select directory:")
ChDir Path$

Note: The dialog itself does not change the path, but returns the current and selected path. If it is canceled with "Cancel", the return value is empty!

@Chr$(N)

N : Value (0 .. 255)

Result: String (1 char)

The char with ANSI code N.

@CloseCom(N)

N:: Integer - Handle of the serial port

Result: Integer - error code

The serial port will be closed. In case of an error the result is negative,  otherwise 0 is returned.

@ComError(N)

N: Integer - Handle of the serial port

Result: Integer - error status

The function evaluates the last error value and the actual status on the given serial port. Occurs an error, Windows will block the serial port until this error is removed by calling @COMERROR.  Because of this, @COMERROR should be called after every usage of @READCOM or @WRITECOM !

The return value can be a combination of these values:

$0001 -	Overflow in the reception-waiting-queue. Whether space is not enough or transmission was 	not stopped after getting the end-of-file sign
$0002 -	A char is not read timely by the hardware. The char is lost.
$0004 -	The hardware found a parity error.
$0008 -	The hardware found a framing error.
$0010 -	The hardware found an event to cancel.
$0020 -	Clear-to-send-interruption (time out).
$0040 -	Data-set-ready-interruption
$0080 -	Receive-line-signal-detect- interruption
$0100 -	The sending-waiting-queue is full.
$0200 -	A timeout occurs during the communication with the parallel port.
$0400 -	An I/O-error occurs trying to communicate with the parallel port.
$0800 -	The parallel port was not selected.
$1000 -	Machine at the parallel port sends out-of-paper.
$8000 -	The wanted mode is not supported or parameter H% is incorrect.

@Control(S1,S2,N1,X,Y,DX,DY,N2,N3,N4)

S1 :	Class name (must be known by Windows)
S2 :	Title
N1:	Style
X,Y :	left upper edge of the control
DX,DY :	Size of the control
N2 :	parent window
N3 :	Window with menus: menu handle
      	Dialog objects: number of the dialog object
       	(If more objects are created by @Control, every object should get another value)
N4 :	Instance of the program (normally. %HINSTANCE)

Result : Integer - Handle of the created dialog object

Closer information about the parameters will be found in the Windows literature, explaining the API function "CreateWindow". The order and meaning of the parameters are the same. With this function any registered (known by Windows) dialog objects, which class name and possible style values are known, can be created. Next to controls, stored in DLLs, also Windows standard controls can be used and signed with style characteristics, PROFAN² does not support. Centered and/or right formatted text is not a problem any more (Class: "STATIC", Style $50000001 or $50000002).

Here are the class names of the most important standard controls and the values of the most important styles:

Class names: BUTTON, COMBOBOX, EDIT (one- or multiline, depends on style), LISTBOX, MDICLIENT, SCROLLBAR, STATIC (text or icon, depends on style).

General Window Styles:

  ws_Overlapped   = $00000000
  ws_Popup        = $80000000
  ws_Child        = $40000000
  ws_Minimize     = $20000000
  ws_Visible      = $10000000
  ws_Disabled     = $08000000
  ws_ClipSiblings = $04000000
  ws_ClipChildren = $02000000
  ws_Maximize     = $01000000
  ws_Caption      = $00C00000    { ws_Border + ws_DlgFrame }
  ws_Border       = $00800000
  ws_DlgFrame     = $00400000
  ws_VScroll      = $00200000
  ws_HScroll      = $00100000
  ws_SysMenu      = $00080000
  ws_ThickFrame   = $00040000
  ws_Group        = $00020000
  ws_TabStop      = $00010000  
  ws_MinimizeBox  = $00020000
  ws_MaximizeBox  = $00010000

Edit-Control Styles:

  es_Left         = $0000
  es_Center       = $0001
  es_Right        = $0002
  es_MultiLine    = $0004
  es_UpperCase    = $0008
  es_LowerCase    = $0010
  es_Password     = $0020
  es_AutoVScroll  = $0040
  es_AutoHScroll  = $0080
  es_NoHideSel    = $0100
  es_OEMConvert   = $0400

Button Styles:

  bs_PushButton      = $00
  bs_DefPushButton   = $01
  bs_CheckBox        = $02
  bs_AutoCheckBox    = $03
  bs_RadioButton     = $04
  bs_3State          = $05
  bs_Auto3State      = $06
  bs_GroupBox        = $07
  bs_UserButton      = $08
  bs_AutoRadioButton = $09
  bs_PushBox         = $0A
  bs_OwnerDraw       = $0B
  bs_LeftText        = $20

Listbox Styles:

  lbs_Notify            = $0001
  lbs_Sort              = $0002
  lbs_NoRedraw          = $0004
  lbs_MultipleSel       = $0008
  lbs_OwnerDrawFixed    = $0010
  lbs_OwnerDrawVariable = $0020
  lbs_HasStrings        = $0040
  lbs_UseTabStops       = $0080
  lbs_NoIntegralHeight  = $0100
  lbs_MultiColumn       = $0200
  lbs_WantKeyboardInput = $0400
  lbs_ExtendedSel       = $0800
  lbs_Standard          = lbs_Notify + lbs_Sort + ws_VScroll + ws_Border

Combo-Box Styles: (ChoiceBox)

  cbs_Simple            = $0001
  cbs_DropDown          = $0002
  cbs_DropDownList      = $0003
  cbs_OwnerDrawFixed    = $0010
  cbs_OwnerDrawVariable = $0020
  cbs_AutoHScroll       = $0040
  cbs_OEMConvert        = $0080
  cbs_Sort              = $0100
  cbs_HasStrings        = $0200
  cbs_NoIntegralHeight  = $0400

Scroll-Bar Styles:

  sbs_Horz                    = $0000
  sbs_Vert                    = $0001
  sbs_TopAlign                = $0002
  sbs_LeftAlign               = $0002
  sbs_BottomAlign             = $0004
  sbs_RightAlign              = $0004
  sbs_SizeBoxTopLeftAlign     = $0002
  sbs_SizeBoxBottomRightAlign = $0004
  sbs_SizeBox                 = $0008

Static Control Constants  (Styles for static controls - text and icon)

  ss_Left           = $00
  ss_Center         = $01
  ss_Right          = $02
  ss_Icon           = $03
  ss_BlackRect      = $04
  ss_GrayRect       = $05
  ss_WhiteRect      = $06
  ss_BlackFrame     = $07
  ss_GrayFrame      = $08
  ss_WhiteFrame     = $09
  ss_UserItem       = $0A
  ss_Simple         = $0B
  ss_LeftNoWordWrap = $0C
  ss_NoPrefix       = $80   

Dialog Styles:

  ds_AbsAlign   = $01
  ds_SysModal   = $02
  ds_LocalEdit  = $20   { Edit items get Local storage }
  ds_SetFont    = $40   { User specified font for Dlg controls }
  ds_ModalFrame = $80   { Can be combined with ws_Caption }
  ds_NoIdleMsg  = $100  { wm_EnterIdle message will not be sent }

Several style constants can be combined with each other or with OR. Please pay close attention to the information provided in the special Windows literature!

@Cot(N)

N : Value (angle in radian measure)

Result : Float

The cotangents of angle N

@Cos(N)

N : Value (angle in radian measure)

Result : Float

The cosine of angle N

@CreateButton(N,S,X1,Y1,X2,Y2)

N     :	Integer - Handle of the parent window
S     :	String  - Text inside the button
X1,Y1 :	Integer - Left upper edge of the button
X2,Y2 :	Integer - Size of the button

Result : Integer - Handle of the button

A button (click area) will be created. Parameter N is the handle of the dialog box or the window containing the button. Coordinates are relative to this dialog box or window.

See also: @CreateDefButton

@CreateCheckBox(N,S,X1,Y1,X2,Y2)

N     :	Integer - Handle of the parent window
S     :	String  - Text right, top next to the checkbox
X1,Y1 :	Integer - Left upper edge of the checkbox
X2,Y2 :	Integer - Size of the checkbox (incl. text)

Result : Integer - Handle of the checkbox

A checkbox (box to put a cross beside) will be created. Parameter N is the handle of the dialog box or window containing the checkbox. Coordinates are relative to this dialog box or window.

See also: @CreateRadioButton

@CreateChoiceBox(N,S,X1,X2,Y1,Y2)

N     :	Integer - Handle of the parent window
S     :	String  - MUST be a blank string
X1,Y1 :	Integer - Left upper edge of the choicebox
X2,Y2 :	Integer - Size of the choicebox

Result : Integer - Handle of the choicebox

A choicebox will be created. The 2. parameter MUST be a blank string. Also SETTEXT (or equivalent commands) should not be used. This can force unforeseeable reactions.
A choicebox is a special kind of a Windows combobox: Clicking on the down arrow allows the user to select an entry from a list of choices. Entering a line is not possible. The selected line is to read with @GETTEXT$. A choicebox is sorted alphabetical every time.

@CreateDefButton(N,S,X1,Y1,X2,Y2)

N     :	Integer - Handle of the parent window
S     :	String  - Text inside the button
X1,Y1 :	Integer - Left upper edge of the button
X2,Y2 :	Integer - Size if the button

Result : Integer - Handle of the button

A button (click area) will be created. Parameter N is the handle of the dialog box or the window containing the button. Coordinates are relative to this dialog box or window. The button is active by default.

See also: @CreateButton

@CreateDialog(N,S,X1,Y1,X2,Y2)

N     :	Integer - Handle of the parent window
S     :	String  - Dialog title
X1,Y1 :	Integer - Left upper edge of the dialog box
X2,Y2 :	Integer - Size of the dialog box

Result : Integer - Handle of the dialog box

A dialog box with title S will be created. In PROFAN² a dialog box can NOT be sized. If CTRL3D.DLL is used in the Windows system, the self-defined dialog boxes will be shown in 3D-Look. In this dialog box you can place any window objects of PROFAN². When deleting the dialog box with @DESTROYWINDOW, all sub-objects of the dialog box will also go away.

@CreateEdit(N,S,X1,Y1,X2,Y2)

N     :	Integer - Handle of the parent window
S     :	String  - Default text
X1,Y1:	Integer - Left upper edge of the editbox
X2,Y2 :	Integer - Size of the editbox

Result : Integer - Handle of the editbox

An editbox for entering a string will be created. S is the default string. A blank string forces a blank input default. Parameter N is the handle of the dialog box or window containing the editbox. Coordinates are relative to this dialog box or window. If Y2 is given as a negative value, @CREATEEDIT allows for the correct value but will activate the password function: All input chars will be replaced with the star-char (only shown, not the string S itself!).

@CreateExtDialog

I      : Integer - Instance-handle of the file including the dialog
H     : Integer - Handle of the parent window
S     : String  - Name of die dialog

Result : Integer - Handle of the dialog

A dialog out of a resource will be shown. Dialog resources can be signed with a name or with an integer. Because of this, the 3.parameter also can be an integer. Something like this:

	Let hDlg% = @CreateExtDialog(I%,%HWnd,1001)

@UseDLL returns the instance handle for DLLs and @WinExec for EXE files. %HINSTANCE contains the handle of the running PROFAN² program (interpreter or runtime, linked or not). It´s also possible to include in one program dialogs used with a tool like Borland´s Resource-Workshop into a DLL. E.g. it is not a problem to expand PROFRUN.EXE before (!) linking it with a PROFAN² PRC-code and use the new resources.

@GetHandle evaluates the handle of dialog objects like listboxes, editboxes, etc.

Here an easy example calling the load file dialog out of PROFAN.EXE or PROFRUN.EXE (instance handle = %HINSTANCE), showing it. It quits when pressing the OK-button or the Cancel-button.
By using the help of Borland´s Resource Workshop, it is easy to see the dialog is named "FILEOPEN" and the OK-button contains the value 1, the Cancel-button the value 2:

	Declare Ok%, hDlg%, Cancel%, Exit%
	CLS
	Let hDlg% = @CreateExtDialog(%HInstance,%HWnd,"FILEOPEN")
	Let Ok% = @GetHandle(hDlg%,1)
	Let Cancel% = @GetHandle(hDlg%,2)
	Let Exit% = 0
	WHILENOT Exit%
	  WaitInput
	  IF @GetFocus(Ok%)
	    Print "OK"
	    Let Exit% = 1
	  ELSEIF @GetFocus(Cancel%)
	    Print "CANCEL"
	    Let Exit% = 1
	  ENDIF
	ENDWHILE
	END

@CreateGroupBox(N,S,X1,Y1,X2,Y2)

N     :	Integer - Handle of the parent window
S     :	String  - Text shown left upper inside the frame
X1,Y1 :	Integer - Left upper edge of the groupbox
X2,Y2 :	Integer - Size of the groupbox

Result : Integer - Handle of the groupbox

A group frame will be created. Parameter N is the handle of the dialog box or window containing the group box. Coordinates are relative to this dialog box or window. A group box is used for visual order inside dialog boxes but also for grouping radio buttons.

See also: @CreateRadioButton

@CreateHScroll(N,S,X1,X2,Y1,Y2)

N     :	Integer - Handle of the parent window
S     :	String  - MUST be a blank string
X1,Y1 :	Integer - Left upper edge of the scroll bar
X2,Y2 :	Integer - Size of the scroll bar

Result : Integer - Handle of the scroll bar

A horizontal scroll bar will be created. The 2. parameter must be a blank string. By default the scroll bar area values are set from 1 to 100. This can be set and changed with SETSCROLLRANGE. With @GETSCROLLPOS the current position value can be read. @SETSCROLLPOS will set the scroll bar position value.

@CreateIcon(N,S,X1,Y1)

N     :	Integer - Handle of the parent
S     :	String  - Name of the icon
X1,Y1 :	Integer - Left upper of the icon

Result : Integer - Handle of the icon

A icon field with the name S will be created. Parameter N is the handle of the dialog box or window containing the group box. Coordinates are relative to this dialog box or window.

@CreateListBox(N,S,X1,X2,Y1,Y2)

N     :	Integer - Handle of the parent window
S     :	String  - MUST be a blank string
X1,Y1 :	Integer - Left upper edge of the listbox
X2,Y2 :	Integer - Size of the listbox

Result : Integer - Handle of the listbox

A listbox will be created. The 2. parameter MUST be a blank string. Also SETTEXT (or equivalent commands) should not be used. This can force unforeseeable reactions.

See also: @CreateSortedListbox

@CreateMultiEdit(N,S,X1,X2,Y1,Y2)

N     :	Integer - Handle of the parent window
S     :	String  - Text
X1,Y1 :	Integer - Left upper edge of the EditBox
X2,Y2 :	Integer - Size of the EditBox

Result : Integer - Handle of the sorted EditBox

A multiline editbox will be created. The 2. parameter can be a starting text. While the text length is not >255, SETTEXT can be used to set a new text. @GETTEXT$ is taken to read it. To handle longer text e.g. @MOVELISTTOEDIT is to use or @SENDMESSAGE together with an area variable.

Example:

	DECLARE hEdit%,Area#,File$
	LET File$="C:\PROFAN60\README.TXT"
	LET hEdit% = @CreateMultiEdit(%HWnd,"",10,10,200,200)
	DIM Area#,@Add(@FileSize(File$),2)  ‘adding 2 Bytes!
	ReadText Area#,File$
	@SendMessage(hEdit%,$000C,0,Area#)
	WaitInput
	End

If Y2 is set negative, @CREATEMULTIEDIT will take it correct, but activates the automatic word breaking mode. The horizontal scroll bar will not be shown and if there is not enough space, a word is set to the next line

@CreateRadioButton(N,S,X1,Y1,X2,Y2)

N     :	Integer - Handle of the parent window
S     :	String  - Text right beside to the radio button
X1,Y1 :	Integer - Left upper edge of the radio button
X2,Y2 :	Integer - Size of the radio button (incl. text)

Result : Integer - Handle of the radio button

A radio button will be created. Parameter N is the handle of the dialog box or window containing the group box. Coordinates are relative to this dialog box or window. Several radio buttons gathered in a group. Only one radio button in a group can be active. A new group is created by @CREATEGROUPBOX and is active until the next @CREATEGROUPBOX.

See also: @CreateGroupBox, @CreateCheckBox

@CreateSortedListBox(N,S,X1,X2,Y1,Y2)

N     :	Integer - Handle of the parent window
S     :	String  - MUST be a blank string
X1,Y1 :	Integer - Left upper edge of the sorted listbox
X2,Y2 :	Integer - Size of the listbox

Result : Integer - Handle of the sorted listbox

A sorted listbox will be created.

See also: @CreateListBox

@CreateText(N,S,X1,Y1,X2,Y2)

N     :	Integer - Handle of the parent window
S     :	String  - Text
X1,Y1 :	Integer - Left upper edge of the text field
X2,Y2 :	Integer - Size of the text field

Result : Integer - Handle of the text field

A text field will be created displaying the text S. Parameter N is the handle of the dialog box or the window containing the text field. Coordinates are relative to the dialog box or window. With PROFAN² 5.0 came the STARTPAINT/ENDPAINT commands. With these commands it is also possible to draw text in dialog window or a window you like.

See also: StartPaint, EndPaint

@CreateVScroll(N,S,X1,X2,Y1,Y2)

N     :	Integer - Handle of the parent window
S     :	String  - MUST be a blank string
X1,Y1 :	Integer - Left upper edge of the scroll bar
X2,Y2 :	Integer - Size of the scroll bar

Result : Integer - Handle of the scroll bar

A vertical scroll bar will be created. The 2. parameters must be a blank string. By default the scroll bar area values are set from 1 to 100. This can be set and changed with SETSCROLLRANGE. With @GETSCROLLPOS the current position value can be read. @SETSCROLLPOS will set the scroll bar position value.

@CreateWindow(N,S,X1,Y1,X2,Y2)

N     :	Integer - Handle of the parent window
S     :	String  - Window title
X1,Y1 :	Integer - Left upper edge of the window
X2,Y2 :	Integer - Size of the window

Result : Integer - Handle of the window

A window with title S will be created. The window style is set before with WINDOWSTYLE. Because the dialog window can be created in all possible window types of PROFAN² you can also resize it (minimize). Other than this, the dialog window resembles the dialog box explained above with the exception that the 3-D objects are not used.

@CToD$(S)

S : String - Date in country specific format

Result : String - Date in database format

Because date fields save the date in the form "YYYYMMMDD" (very useful for comparison) this function will convert the date S from the database format into a readable format, e.g. "MM.DD.YYYY". National settings in WIN.INI are considered.

@Date$(N)

N : Integer - Output format

Result: String - Date

Gets the current date in different formats:

0 : Short format dependent on the country code (e.g. "04/09/1993")
1 : Long format (e.g. "9th of April 1993")
2 : Long format with day (e.g. "Friday, 9th of April 1993")
3 : Database format YYYYMMDD (e.g. "19930409")
4. date format saved in WIN.INI

Output format 4 corresponds with the date settings in the WIN.INI, where the first character is the separator. The following characters are year (y), month (M) and  day (d), e.g. ".dMy".

NOTE: The formats 1 and 2 always return the German format.

@dbAppendBlank()

Result : LongInt - Number of the active (empty) record

An empty record will be added to the database and is ready to edit. The result is the number of this new record.

@dbClose(#N)

N : Integer - Database table number (1 .. 15)

Result : LongInt - Number of records

This function closes the database with the table number N. Every open database table must be closed inside the program, otherwise data can be lost.

@dbDelete()

Result : LongInt - Number of the record.

The current record will be marked (!) as deleted.

@dbFind(S,N)

S : String - Search string
N : Integer - Exactness

Result : Number of the found record

The program searches for a record which contains S in the index field. (If several indices are used, the first index count). N determines how to search:

0 - The first data set that starts with search term S will be found. 
1 - The first data set that is identical with S will be found.

Result: Data set number of the set that was found. It will be positioned on this data set. If no set was found, the result is 0.

(XBase: FIND S)

See also: @dbSeek

@dbGet$(S)

S : String - Field name

Result : String - Field contents

The Field S of the current record will be read. The result is a string. 

Example:

Let Name$ = @DBGet$("NAME")

In numerical fields the string can be transformed with @Str$ into a corresponding number. To transform date fields you can use the @DTOC$ function.

See also: @dbGetField$

@dbGetField$(N)

N : Integer - Field number

Result : String - Field contents

The field with number N will be read. Instead of the current field name the field number is used.

See also :dbGet$

@dbGetMemo(S)

S: String - Field name

Result: Integer - Number of chars inside the memo text

If S is a memo field the corresponding memo text will be transferred to the PROFAN² listbox. Before, the listbox is cleared. If S is not a memo field the return value is 0, also if it is a memo field without text inside.
The contents of the PROFAN² listbox can be shown e.g. with @LISTBOX$ to see or @EDITBOX$ to edit. Use @DBPUTMEMO to write changes back to the memo file of the database. To evaluate if a database includes memo fields, the system variable %DBMEMO is to read.

Following procedure shows how to simulate the dBase-command MEMOEDIT (reading a memo field, changing and writing back):
 
PROC MEMOEDIT
Parameters FieldName$
  @DBGETMEMO(FieldName$)
  IF @EDITBOX("Edit Memo",1)
    @DBPUTMEMO(FieldName$)
  ENDIF
ENDPROC

The parameter of this procedure is the field name of the memo field.

@dbGo(N)

N : LongInt - Number of the record or string record indication

Result : LongInt - Number of the record

Set N becomes the current record and will be loaded from the database table into memory. This copy of the record will be read and changed with the following functions. Instead of set number N, you can also use the following string record indication:

"|<" or "TOP"	- Position is top
">|" or "BOTTOM"	- Position is bottom
">" or "NEXT"	- Position is next
"<" or "PREV" 	- Position is previous

Example:

Let CurrentRec& = @dbGo ("NEXT")

If you open an index (or several indexes) it will be recognized. This gives the number of the data set that were positioned.

@dbIndex(S)

S : String - Name(s) of the index file(s)

Result : Integer - 1=OK, 0=Error

The index will be used. S contains the name(s) of the index file(s). Separate index files with commas, several indexes can be used at the same time.

Example:

LET X% = @DBIndex("IXNAME,IXORT")

The result is 1 if the index could be selected or 0, if an error occurred, because one of the index file is not available.

NOTE: Index file names are given without file extensions. The PROFAN² dBase-engine set it automatically to “IDX“.

(XBase: USE INDEX S)

@dbOpen(#N,S)

N : Integer - Database table number (1 - 15)
S : String - Filename of the database table

Result : LongInt - Number of records in the database table

The database table S will be opened. N contains values from 1 to 15. Up to 15 database tables can be opened at the same time. The result is the number of records in the database table.

Example:

LET RecCount& = @DBOpen(#1,"CLIENTS.DBF")

@dbPack()

Result : Number of records

All as deleted marked records will be removed out of the database table - final. They cannot be restored! The result is the remaining number of records.

See also: %dbDeleted

@dbPut(S1,S2)

S1 : String - Field name
S2 : String - New contents

Result : Integer (without meaning, every time 1)

The string S1 will be set to field F1 of the current record.

NOTE: This command only effects the working copy of the record in memory. @DBPUTREC writes it to the database table.

(XBase: REPLACE S1 WITH S2)

See also: @dbPutField

@dbPutField(N,S)

N : Integer - Field number
S : String  - New contents

Result : Integer (without meaning, every time 1)

The string S is written in field number N of the current record.

NOTE: This command only effects the working copy of the record in memory. @DBPUTREC writes it to the database table.

See also: @dbPut

@dbPutMemo(S)

S: String - Field name

Result: Integer - Success

If S is a memo field, the contents of the PROFAN² listbox will be written to the corresponding memo file and the pointer of this memo field will be updated. Occurs an error or is S not a memo field, @DBPUTMEMO returns 0, otherwise it´s 1.

@dbPutRec(N)

N : LongInt - Record number

Result: LongInt - Number of the written record

The current record (the work copy in memory) will be written as a at record-position N of the database table. If N has the value 0, the currently positioned record will be overwritten with the new value. Result: current record number.

@dbSeek(S1,S2)

S1 : String - Field name for searching
S2 : String - Search string
N  : Integer - Searching exactness (0, 1 or 2)

Result : Number of the found record

Search without index in a field you like. Found will be the first record including S2 in the field S1. The search starts at the current record position.

Result: Number of record (that was) found. Position will be set on this record. When no record is found, @DBSEEK returns 0.

The optional parameter N controls the search exactness: If N=0, nothing special happens: S2 is searched everywhere in the field. N=1: The field must begin with S2. N=3: The field must be exact S2. Uppercase and lowercase writing is not important.

See also: @dbFind

@dbUndelete()

Result : LongInt – Record number

The delete marker will be removed.

@dbUse(#N)

N : Integer – Database table number (1 - 15)

Result : LongInt – Record number in the database table

The database table with number N is set to be the active database table. All following database commands will work on this database table.

@Del$(S,N1,N2)

S  :  String
N1 : Value - Position
N2 : Value – Number of chars

Result: String

Starting at position N1will be removed from the string S.

@DeleteChoice(N1,N2)

N1: Integer - Handle of the choicebox
N2: Integer – No. of the entry (1.Line = 0)

Result: Integer - Success

The string at index N2 will be removed from the choicebox N1. Note, that the first line is at index 0.

@DeleteString(N1,N2)

N1: Integer - Handle of the listbox
N2: Integer - No. of the entry (1. Line = 0)

Result: Integer - Success

The string at index N2 will be removed from the listbox  N1. Note, that the first line is at index 0.

@DestroyWindow(N)

N : Integer - Handle of the window or window object

Result : Integer - 1=Success / 0=Failure 

The window or window object with the handle N will be removed (and destroyed). When the operation was successful the function returns 1, otherwise it returns 0.

@DiskFree(S)

S : String - Name of the drive

Result: LongInt

The result is free memory in drive S in bytes. For example, if the result is 2048, then there are still 2KB free. If the drive does not exist or is not readable, the result is 0.

Example:

Print @Str$(@DiskFree("C:"));" Bytes free"

@DiskSize(S)

S : String – Name of the drive

Result: Value

The result is the total memory on drive S in bytes. Is the result e.g. 43000000, the drive has ca. 43000 KB or ca. 43MB. If the drive does not exist or is not readable, the result is 0.

Example:

Print @DiskSize("C:");" Bytes"

@Div&(N1,N2)

N1 : Value
N2 : Value

Result: Integer/LongInt

Integer number of the division N1 from N2.

@Div(N1,N2)

N1 : Value
N2 : Value

Result: Value

Result of the division of N1 from N2.

In PROFAN 1.x programs all @Div callings should be replaced before re-compiling, because PROFAN 1.x could perform only integer calculation operations.

@DToC$(S) 

S : String – Date in database format

Result: String – Date in the country format

Because date fields save the date in the form "YYYYMMDD" (very useful for comparison) this function will convert the date S from the database format into a readable format, e.g. "DD.MM.YYYY". National settings in WIN.INI are considered.

The function @GETFDATE$ also returns the date in database format.

@EditBox(S,N)

S - String: Title of the edit dialog
N - Integer: Font

Result: Integer

Version 3.2 or higher has another built-in dialog--the edit dialog. S is the heading of the dialog and  N is the mode:

1 = Proportional font
2 = Courier

Editing the lines in the list box list. To edit text, you have to retrieve it from the list box list. The  result of the editing process is displayed in the list box list and can be written into a file. The text  can have a max. size of 30 KB.

The buttons "Copy", "Cut", and "Paste" are the familiar options with the clipboard.

If the editing process was finished with "OK" the %BUTTON has value 1 and the function returns value 1,  otherwise %BUTTON is 2 and the return value is 0.

@Eof(#N)

N : Integer – file number  (1..15)

Result: Integer (0 or 1)

If reading the file reaches the end of the file @Eof(#N) results in value 1; otherwise it is 0.

(Because of the compatibility with PROFAN 1.x the # can be skipped.)

@Equ$(S1,S2)

S1 : String 1
S2 : String 2

Result: Integer (0 or 1)

The result is TRUE (1) if both strings are equal, FALSE (0), if the strings are different.

@EQU(N1,N2)

N1 : Value - Value 1
N2 : Value - Value 2

Result: Integer (0 or 1)

The result is TRUE (1) if both values are equal, FALSE (0), if the values are different.

@Exp(N)

N - Value

Result: Float

Exponential function.

@ExtString$(I,N)

I     : 	Integer - Instance handle of the file (DLL/EXE) that contains the string
N    : 	Integer - Number of the string in the resource

Result : String - String in the resource

With this function strings saved in resources can be reached. @UseDLL returns the instance handle for DLLs and @WinExec for EXE files. %HINSTANCE contains the handle of the running PROFAN² program (interpreter or runtime, linked or not). It´s also possible to include in one program strings used with a tool like Borland´s Resource-Workshop into a DLL. E.g. it is not a  problem to expand PROFRUN.EXE before (!) linking it with a PROFAN² PRC-code and use then new resources.

Note when creating resources that in PROFAN² the maximum string length is 255. If the string cannot be found the result will be a blank string. @ExtString$ is very good for developing applications with multiple language support. All strings are included e.g. in one DLL representing one language.

The maximum of string length of 255 in PROFAN² can be avoided using Windows-API functions together with PROFAN² area variables. This way doesn´t allow PROFAN² commands and functions on the strings. It should be only done with good API knowledge. In most cases the string maximum of 255 will be no problem.

@FilePos(#N)

#N: File number

Result: LongInt - Current position of the file pointer

Evaluates the current position of the file pointer inside a file opened with OPENRW. Note that the first Byte is on position 0 (base 0).

@FileSize(S)

S : String - File name (also with path)

Result: LongInt - File size in bytes

The function determines the size of the selected file in bytes.

@FindFirst$(S)

S : String - File mask

Result: String

This function searches for the first file of the current directory that corresponds with the file mask. The result is the file. If it is a directory, it will be in square brackets.

@FindNext$()

Result: String

Finds the next file that corresponds with the file mask given from @FINDFIRST$(S). If the search was successful, %IORESULT = 0! 

Example:

Print @FindFirst$("*.PRF")
WhileNot %IOResult
  Print @FindNext$()
Wend

@FindWindow(S)

S : String - Searched window title

Result : Integer - Handle of the found window

Returns the handle of the window, which title starts with S. If no such window is found the function returns 0.

@Format$(S,N)

S: String - Format description
N: Value

Result: String - Formatted value

The function @Format$ formats the floating point value N described by S. Following format descriptions are supported:

0	Digit placeholder

Tells PROFAN² to insert a digit or 0 in that position. If there is a digit in the expression being formatted in the position where the 0 appears in the format string, display it; otherwise, display a zero in that position.

 #	Digit placeholder 

Tells PROFAN² to insert a digit or nothing in that position. If there is a digit in the expression being formatted in the position where the # appears in the format string, display; otherwise, display nothing in that position.

 .	Decimal point

The first appearance of '.' in the format string will fix the position of the separation sign of  the decimal part. Other appearances of '.' will be ignored. The real shown separation sign is determined by the Windows system appointment.

 ,	Thousands separator

If the format string contains one or more ','-chars, in the result string between every group of three digits - on the left side of the decimal comma - will be inserted the thousands separator. The positions and numbers of the ','-char has no other influence on the result the string. The real shown separation sign is determined by the Windows system appointment.

E+	Scientific format

If in the format string appears 'E+', 'E-', 'e+' or 'e-', the digits will be displayed in scientific notation. Up to four '0'-chars can follow direct next to 'E+', 'E-', 'e+' or 'e-', to fix the position numbers of the exponent. The formats 'E+' and 'e+' effect a plus-char for positive exponents and a minus-char for negative exponents to be included. The formats 'E-' and 'e-' effect only (!) a minus-char for negative exponents to be included.

 'xx'	Chars

Chars with quotation-marks will be displayed in the given way and will not cause the output format.

 ;	Semicolon

Separates the areas of positive and negative values and also zero values in the format string. To make a distinction between positive, negative and zero values with different formats, the format string can contain up to three format areas, separated with semicolons.

One format area: The format string will be used for all values.
Two format areas: The first area will be used for positive and zero values, the second only for negative values.
Three format areas: The first area will be used for positive values, the second for negative values, the third for zero values.

If the format area for negative values or the format area for zero values is empty,  then, there is nothing between the semicolons, instead of this the fomat area for postive values is used.

Inside the format string, the maximum position of  '0' left to the decimal comma, and the maximum position of the '0' right to the decimal comma fixes the number of digits displayed in the result string.

The digit to be formatted, will be rounded up to a count of decimal places, numbers of placeholders ('0' or '#') on the right side of the decimal comma exist. If the format string not contains a decimal comma, the value to be formatted will be rounded to the next integer value.

If the digit to be formatted includes more decimal places on the left side of the decimal comma than placeholders on the left side of char '.', are contained in the format string, additional places before the first placeholder will be added to the result string.

Example:

PRINT @Format$("###,##0.00 ' H';"###,##0.00 ' S'",Value!)

If the value is e.g. +1234,45,  the output would be: "~~1.234,45 H". The value -0,12 would displayed as "~~~~~~0,12 S" (the tilde sign replaces here a space char!).

@GetActiveWindow()

Result : Integer - Window handle

The function determines the handle of the currently active window.

@GetBValue(N)

N: Integer - Color value

Result: Integer - Part of blue color

Evaluates the corresponding color part of a color. Depending on the color mode this will be a value between 0 and 31 or 0 and 255. The color value can be determined e.g. with @GetPixel.

@GetByte(#N)

#N: File number

Result: Integer - Value (0...255)

A byte will be read out of a file, opened with OPENRW. The file position pointer is set to next byte afterwards. For manual positioning the command SEEK is used.

@GetCheck(N)

N : Integer - Handle of the window object

Result : Integer - Condition: 0=not active / 1=active

The function returns the condition of a checkbox or radiobutton with the handle N.

0 - Checkbox/radiobutton is not active
1 - Checkbox/radiobutton is active

See also: SetCheck

@GetClip$()

Result : String

This function read text out of the Windows clipboard (max. 255 chars). The clipboard will not be cleared while reading. For this use the command ClearClip.

See also: PutClip

@GetCount(N)

N: Integer - Handle of the listbox

Result: Integer - Numbers of entries

Returns the numbers of entries (lines) of a listbox. Note, that the first entry is on index 0 (base 0). Because of this, the last entry in a listbox is @GetCount - 1.

@GetCursel(N)

N: Integer - Handle of the listbox

Result: Integer - Current position inside the listbox

Evaluates the position of the cursor (colored line) in the listbox N. The first line is on index 0.

@GetDir$(S)

S : Drive char (with double colon)

Result: String (Path)

The path of the drive will be determined, "@" stands for the current drive. 
The result path is without a backslash at the end.

Example:

Let CPath$=@GetDir$("C:")
Let Path$=@GetDir$("@")

@GetEnv$(S)

S : String - Variable name

Result : String - Variable contents

The function reads the corresponding environment variable.

Example:

Let Pfad$ = @GetEnv$("PATH")

@GetFAttr(#N)

#N: File number

Result: Integer - Attribute

The function evaluates the file attribute. The file number must set with ASSIGN before but the file mustn’t be open. Attribute values are:

	$01 = ReadOnly
	$02 = Hidden
	$04 = System file
	$08 = Label
 	$10 = Directory-Entry
	$20 = Archive

Several attributes can be added. A system file, which is hidden, then has the attribute $06.

@GetFDate$(#N)

#N: File number

Result: String - Date in format  "YYYYMMDD“

The function evaluates the file date. The file number must set with ASSIGN and opened (e.g. with RESET).

@GetFileSize(#N)

#N: File number

Result: LongInt - File size in bytes

The function evaluates the current size of a file opened (!) with OPENRW. To get the size of a closed file use the function @FileSize. The advantage of @GetFileSize is to get the file size while working with it.

@GetFocus(N)

N : Integer - Handle of the window object

Result  : Integer (0 or 1)

The function determines if the window object with handle N has the focus. If the window object has the focus, the result will be 1, otherwise the result will be 0. To determine the position of the focus, use the system variable %GETFOCUS.

Pressing F1 during WAITINPUT and when the focus is inside a dialog object, %GetFocus will return the negative value of the handle.

@GetGValue(N)

N: Integer - Color value

Result: Integer - Part of green color

Evaluates the corresponding color part of a color. Depending on the color mode this will be a value between 0 and 31 or 0 and 255. The color value can be determined e.g. with @GetPixel.

@GetHandle(H,N)

H     : Integer - Handle of the Dialog containing the object
N     : Integer - Number of the dialog object inside the dialog

Result : Integer - Handle of the dialog object

Using the identification number of the dialog object and the handle of the dialog containing this object will determinate the object handle. When creating a dialog with a resource editor, every dialog object is given a unequivocal value: The identification number. At runtime we want to know the handle of the dialog object. This handle is used by PROFAN² functions and Windows messages for identification. It is given when creating the dialog (using the function @CreateExtDialog). Because of this the handle can only evaluate at runtime after the dialog was created. Therefore is @GetHandle.

An example is given with the description of the @CreateExtDialog function. By the way: PROFAN² gives to all dialog elements created with @Create... identification numbers. The first number in a program is 1000. This value will be added with 1 when @Create... is called.

@GetKey$()

Result: String (1 char)

Waits for a key command and returns the result.

@GetLine$(N1,N2)

N1: Integer - Handle of the editbox
N2: Integer - No. of the lline (1. line = 0)

Result: String - Line N2 of the editbox

Evaluates the line N2 in a multiline editbox.

@GetLineCount(N)

N: Integer - Handle of the editbox

Result: Integer - Numbers of lines

Evaluates the number of lines in a multiline editbox. Note, that the first entry is on index 0 (base 0). Because of this, the last entry in a listbox is @GetCount - 1.

@GetPixel(X,Y)

X : Integer - X coordinate
Y : Integer - Y coordinate

Result : Integer - Color value (RGB)

Evaluates the color value of a pixel at position x,y.

WARNING: Depending on the graphics mode, this result differs from the transferred color  value set by SetPixel; e.g. a pixel in the 16 color mode can only have 1 out of 16 values.

@GetRValue(N)

N: Integer - Color value

Result: Integer - Part of red color

Evaluates the corresponding color part of a color. Depending on the color mode this will be a value between 0 and 31 or 0 and 255. The color value can be determined e.g. with @GetPixel.

@GetString$(N1,N2)

N1: Integer - Handle of the listbox
N2: Integer - No. of the line (1. line = 0)

Result: String - Line N2 of the listbox

Returns the line with index N2 in the listbox N1.

@GetText$(N)

N : Integer - Handle of the window object.

Result : String - Text of the window object.

Evaluates the text of a window object. If it is a editbox the result will be the entered text, otherwise the window title, button text or the text next to the checkbox or radiobutton. (Shortly: This is the text given with the @Create... functions or set with the SetText command.)

@GetUsage(N)

N : Integer - Handle of the program

Result: Integer - Number of instances

N is the handle of the application started with @WINEXEC. The result states how often this application was started and will be 0 if the last instance of the application closes. For example, you can start a program and stay in the waiting loop, until you quit the program:

...
LET X%=@WINEXEC("NOTEPAD.EXE",3)
WHILE @GETUSAGE(X%)
WEND
...

INFORMATION: Behind these functions works a 16-Bit-API function that is not included in the 32-Bit-API of Windows 95. Therefore PROFAN² uses an undocumented  function. There is no guarantee of it working correctly when using @GetUsage under Windows NT. In the example above, it is suggested under Windows NT to use @WINEXECWAIT.

@GT(N1,N2)

N1 : Value - Value 1
N2 : Value - Value 2

Result:Value (0 or 1)

The result is TRUE (1) if value 1 is greater than value 2.  @GT$(S1,S2)

@GT$(S1,S2)

S1 : String 1
S2 : String 2

Result: Integer (0 or 1)

The result is TRUE (1) if string 1 is greater than string 2.

@Height(H)

H     : Integer - Handle of a window, dialog, dialog object

Result : Integer - Height of the object inside the frame

Often the size of a window or dialog is needed. This is also called client. The client area does not include the menu and the title bar. It´s only the part of the window (or object) where it is allowed to draw, write, etc.

@IconCount(S)

S - String: File name (with path)

Result: Integer - Number of icons

This function returns the number of icons contained in the file S. S can be an EXE file as well as DLL file.

Example:

	Let Count% = @IconCount("PROGMAN.EXE")

@If(N1,N2,N3)

N1 : Value - Condition
N2 : Value - Result of fulfilled condition
N3 : Value - Result of not fulfilled condition

Result: Value, depending on the condition

According to C, the IF is also available as a function. The @IF function has three arguments. The first one is the requirement, the second is the value that will be returned when the requirement is accomplished, and the third is the value that is returned if the requirement is not accomplished. 

Examples:

LetText$ = @IF(@Equ(A%,1), "A equal 1", "A unequal 1")
Print Text$

Let A% = @IF(@Gt(A%,1000),@Add(A%,200),@Add(A%,50))
Print A%

The second example adds to A% 200 if it is greater than 1000, otherwise, it adds only 50.

@Inkey$()

Result: String (1 char)

Returns the character of the currently pressed key.

@Inp(N)

N : Integer - Port address

Result : Integer - 16-bit value on Port N

@Inp reads a data word (16 Bit / 2 Byte) on input-port N (and N+1). The lo-byte is given in N, the hi-byte in N+1 on the port.

CAUTION: Be sure that you know what you are doing, because in Windows not all port addresses can be read. You could easily crash your system and lose data.

NOTE: Under Windows NT direct readings to the hardware are not allowed. The functions @INP and @INPB must be avoided!

@InpB(N)

N : Integer - Port address

Result : Integer - 8-bit value (Byte) at Port N

A byte value (8 bit) is read at input-port N.

CAUTION: Be sure that you know what you are doing, because in Windows not all port addresses can be read. You could easily crash your system and lose data.

NOTE: Under Windows NT direct readings to the hardware are not allowed. The functions @INP and @INPB must be avoided!

@Input$(S1,S2,S3)

S1 - String: Prompt (Question)
S2 - String: Window title
S3 - String: Prescribed string or value

Result: String or value (input)

A dialog box will be displayed where you can enter a string. This function should be used instead of the INPUT command, where possible.

In PROFAN² 2.5 or higher the default and the result can be numerical. The function can be used to enter strings and numerical values. 

Examples:

Let Place$=@Input$("Enter city:,"Test","Seattle")

Let z&=@Input$("New value:","Test",z&)

@Ins$(S1,S2,N)

S1 : String
S2 : String
N  : Value

Result: String

String S1 will be inserted in S2 at position N.

@InsertString(N1,N2,S)

N1: Integer - Handle of the listbox
N2: Integer - Line position (index)
S: String - Line to be inserted

Result: Integer - Position (index) of the inserted string

The line S will inserted at position N2 inside the listbox N1. This function makes only sense working with an unsorted listbox. Is N2 = -1, the line will be added at the end of the listbox.

@Instr(S1,S2)

S1 : String
S2 : String

Result: Value

Evaluates at which position S1 is found in S2. If S1 does not appear in S1 the result is 0.

@Int(N)

N : Value

Result : Integer / LongInt

The integer part of N. No rounding. (Rounding only by limitation of the issued positions with NUMWIDTH.)

@KeyIn(S)

S : String

Result: Value (0 or 1)

The result is 1 if the last key pressed appears in string S. 

Example:

WaitKey
Case @KeyIn("AaBb"):Print "A oder B"

@Left$(S,N)

S : String
N : Number of chars

Result : String 

Returns the first N (left) chars of S.

@Len(S)

S : String

Result: Value

Returns the length of the string S.

@Lg(N)

N : Value > 0

Result : Value

Returns the natural logarithm for value N.

@List!(N)

N : Integer - Index (0 .. 32767 / 16380)

Result: Float

Returns the Nth entry of the float list. The list can be filled with the command LIST!

@List$(N)

N : Integer - Index (0 .. 32767 / 16380)

Result: String

Returns the Nth entry of the string list. The list can be filled with the command LIST$

@List%(N)

N : Integer - Index (0 .. 32767 / 16380)

Result: Integer

Returns the Nth entry of the integer list. The list can be filled with the command LIST%

@List&(N)

N : Integer - Index (0 .. 32767 / 16380)

Result: LongInt

Returns the N-th entry of the longint list. The list can be filled with the command LIST&

@ListBox$(S,N)

S : String - Window title

N : Value - Type of the listbox (1 .. 8)

Result: Selected string

The contents of the list box list is offered for selection (or to browse). The second parameter states, where Form the list box should be displayed. 

	1 	- big - unsorted - System font
	2 	- big - unsorted - Courier 10
	3 	- big - sorted - System font
	4 	- big - sorted - Courier 10
	5 	- small - unsorted - System font
	6 	- small - unsorted - Courier 10
	7 	- small - sorted - System font
	8 	- small - sorted - Courier 10

The big (unsorted) list box is recommended for text display. The text will be read and then displayed. 

Example:

ClearList
AddFiles "*.BMP"
Let Wahl$=@ListBox$("Select picture:",7)
LoadBmp Selection$,10,10

The list box list will be filled with ADDFILES, ADDWINDOWS and ADDSTRING and emptied with CEARLIST. %GETCOUNT contains the amount of entries and @LISTBOXITEM$ reads each single entry. See also the demo "Quick Start"!

@ListBoxItem$(N)

N : Integer (0 ... 9999)

Result: String

Returns the N-th entry of the PROFAN² listbox list.

@Ln(N)

N : Value > 0

Result : Value

Returns the natural logarithm for value N.

@LoadFile$(S1,S2)

S1 : String - Title
S2 : String - File mask (with path)

Result: File name (with path)

A file selection box to load (open) with the heading S1 will be shown. The result is the selected file (including path) that can be opened. 

Example:

Let Name$=@LoadFile$("OPEN:","*.EXE")

In 32-Bit PROFAN² uses the Windows system dialogs for loading and saving. These dialogs allow several file filters. To use this feature, several file filters consisting of a file description and extension(s) can be combined. To open next to the *.EXE files also *.PIF and *.BAT files, the command line could look like this:

Let Name$ = @LoadFile$("OPEN","Programms|*.EXE;*.PIF|Batch|*.BAT")

The vertical line is reached with [AltGr] + [<] .

@Long(V,A)

V: Area variable (Must be DECLAREd and DIMensioned before)
A: Integer - Address inside the area variable (offset)

Result: LongInt - Value

This function evaluates the value of the 32-bit word (4 Byte) at address (offset) A in the area variable V. Is the address A out of the area value given with DIM before, an error message occurs.

@LongName$(S)

S: String - Short file name (8.3), returned by @ShortName$  (incl. path)

Result: Long name of path and file.

This function evaluates to the long file name (system 8.3) the corresponding short file name. The file name can include a path. If the file doesn’t exists @LongName$ returns a blank string. (Under Windows 3.x or if long file names are set off with SetLFN, the string S always will be returned.)

@Lower$(S)

S : String

Result: String

String S will be transformed completely to lower case letters, national special characters (e.g. German üäöÜÄÖ etc.) are recognized.

@LT(N1,N2)

N1 : Value 1
N2 : Value 2

Result: Value (0 or 1)

The result is TRUE (1) if value 1 is less than value 2.

@LT$(S1,S2)

S1 : String 1
S2 : String 2

Result: Integer (0 or 1)

The result is TRUE (1) if string 1 is less than string 2.

@MCISend$(S)

S : String - MCI command

Result: String (MCI result)

String S will be sent as a command. The result (or error) will be returned. 

Examples:

Output of a "WAV"-File:

@MCISend$("open gong.wav type waveaudio alias gong")     'New wave file
@MCISend$("play gong wait")                              'Play file
@MCISend$("close gong")                                  'Close

The wait tells the PC to wait until the process is completed.

Record WAV file with micro:

@MCISend$("open new type waveaudio alias test")      'New WAV-File
@MCISend$("set test time format milliseconds")       'Time format msec
@MCISend$("record test from 0 to 5000 wait")         'Record 5 sec 
@MCISend$("Play test from 0 wait")                   'Play
@MCISend$("save test test.wav")                      'Save

Play CD (Title 3 - 5):

@MCISend$(open cdaudio alias cd")
Print "Duration: ";@MCISend$("status cd length")
Print "Number of tracks: ";@MCISend$("status cd number of tracks")
@MCISend$("set cd time format tmsf")
@MCISend$("play cd from 3 to 5 wait")
@MCISend$("stop cd")
@MCISend$("close cd")

This process allows you to control all multi media devices and video for Windows. For details, consult you technical literature.

@MenuItem(N)

N : Value - Menu item

Result: Value (1 or 0)

If the currently selected menu item corresponds with N (0 to 254), the result is 1. Otherwise, the result will be 0. If N is 0, the result is 1, if no menu item was selected. 254 stands for selection of the copyright note.

@MessageBox(S1,S2,N)

S1 : String - Message text
S2 : String - Title
N  : Integer - Type of the Message box

Result -  Integer: Pressed button

An alert message is displayed on your screen. N is composed by BUTTONS + ICON + DEFAULT + WINDOW STYLE.

Values for BUTTON:

	0 	- OK
	1 	- OK Cancel
	2 	- Cancel Repeat Ignore
	3 	- Yes No Cancel
	4 	- Yes No
	5 	- Repeat Cancel

Values for ICON:

	0 	- No Icon
	16 	- STOP
	32 	- "?"
	48 	- "!"
	64 	- "i"

Values for DEFAULT:

(Value states the default button:)

	0 	- first button
	256 	- second button
	512 	- third button

Values for WINDOW STYLE:

	0 	- "normal" window.
	4096 	- big non-moveable "Error" window.

Result is the pressed button:

	1 	- OK
	2 	- Cancel
	3 	- Abort
	4 	- Repeat
	5 	- Ignore
	6 	- Yes
	7 	- No

@Mid$(S,N1,N2)

S  : String
N1 : Integer - Position
N2 : Integer - Number of characters
Result: String

The result is a string that contains N2 characters starting with position N1 from string S.

@Mod(N1,N2)

N1 : Integer
N2 : Integer

Result: Integer

The result is N1 module N2.

@MkStr$(S,N)

S : String
N : Number of repeatings of S

Result : String 

Returns a string of count copies of S.

@MoveListToChoice(N)

N: Integer - Handle of the choicebox

Result: Integer - Success

The contents of the PROFAN² listbox list (used by the pre-defined dialogs) will be copied into the choicebox with the handle N.

@MoveListToEdit(N)

N: Integer - Handle of the editbox

Result: Integer - Success

The contents of the PROFAN² listbox (used by the pre-defined dialogs) will be copied into the editbox with the handle N.

@MoveListToList(N)

N: Integer - Handle of the listbox

Result: Integer - Success

The contents of the PROFAN² listbox list (used by the pre-defined dialogs) will be copied into the listbox with the handle N.

With commands like ADDWINDOWS, ADDFILES or ADDFONTS the listbox can be filled and given the contents to another listbox (e.g. in an owner defined dialog).

@Mouse(X1,Y1-X2,Y2)

X1,Y1 : Integer - Left upper edge
X2,Y2 : Integer - Right lower edge

Result: Integer (0 or 1)

The result is 1, if the mouse was in the marked position when it was clicked the last time. 

Example:

WaitMouse
Case @Mouse(10,10-60,60):Gosub "Info"

@Mul(N1,N2)

N1 : Value
N2 : Value

Result: Value

Multiplication of N1 with N2.

@Neq(N1,N2)

N1 : Value - Value 1
N2 : Value - Value 2

Result: Integer (0 or 1)

The result is FALSE (0) if both values are identical and TRUE (1) if the values are different.

@Neq$(S1,S2)

S1 : String 1
S2 : String 2

Result: Integer (0 or 1)

The result is FALSE (0) if both strings are identical and TRUE (1) if the strings are different.

@Not(N)

N : Value

Result: Integer (0 or 1)

The result is 1 if N has value 0, otherwise it is 0.

@OemToAnsi$(S)

S : String

Result: String

The string S will be transformed from ANSI code to ASCII code (OEM).
This transforming especially concerns European chars. ASCII code is used under DOS, ANSI code under Windows.

@OpenCom(COMx,N1,N2)

COMx: String - Name of the serial port (e.g. "COM1" or "COM2")
N1: Integer  - Size of buffer for data to send
N2: Integer  - Size of buffer for data to receive

Result: Integer - Handle of the serial port ( >= 0)
	If it is <0, an error occurred.

The serial port will be initiated with the current settings and opened. The buffer size should calculated to give sending and receiving data enough space. So, don’t be stingy with bytes. With the help of @SETCOM and @SETCOMEXT afterwards the parameter of the serial port can be set accurately.

@Or(N1,N2)

N1 : Value
N2 : Value

Result: Integer

OR function: The result is not like 0 if N1 OR N2 (or both) are not 0.
It is only 0 if both arguments are 0.

@Ord(S)

S : String

Result: Integer

ANSI code of the first character of S.

@Par$(N)

N : Integer - Parameter number

Result: String - Parameter

The command line parameters will be skipped. The amount will be determined with %PARCOUNT.

Call options:

Interpreter:

      PROFAN <name.prf> <par2> <par3> ...

Runtime (.EXE file as runtime):

      PROFRUN <name.prc> <par2> <par3> ...
bzw.  <name.exe> <name.prc> <par2> <par3> ...

.EXE file:

      <name.exe> <par1> <par2> <par3> ...

The first parameter of the .EXE file has to start with the following characters, if it is not the name of a .PRC file: ! " # $ % ' ( ) * + , - . / the runtime module would try to interpret the first parameter as file name and react to a error message.

Is it a PROFAN² EXE file the integrated runtime module tries to interpret the first parameters <par1> as a PROFAN² compilation module. Is it found, then it will be started, otherwise the program starts itself. A PRC module will be also recognized if the extension is another one.

@Pi()

Result: Float - PI

Returns the circle number Pi (3.41...)

@Pow(N1,N2)

N1 : Value
N2 : Value

Result : Value

Percent function. The result is N1 high N2 (in BASIC: N1^N2).

@PostMessage(N1,N2,N3,N4)

N1 : Integer - Handle of the receiver (a window object or window object)
N2 : Integer - Number of the message
N3 : 16-Bit: Integer - 16-Bit message depending information
       32-Bit: Longint - 32-Bit message depending information
N4 : LongInt or area variable - 32-Bit message depending information

Result : Integer - 1 = Success, 0 = Failure

A message will be sent to the window or window object with the handle N1. N2 represents the message (number). The values N3 and N4 depend on the selected message.
@PostMessage unlike @SendMessage will not wait on the result but returns success immediately (or failure). Success only means the message could be sent.
A list of window messages is shown in the appendix.

@Pwd$(S)

S: String - Text to code..

Result: String - Coded or encoded text.

With this function it is possible to code a string, the output will appear to the user as random characters. Calling @Pwd$ again will encode this string, the random characters will be displayed in readable form. To work correctly  the programmer must define the password which creates a key to be used for coding the string. When no password is defined or a blank string is given, the function does nothing. The function will not change the sort order of strings. Therefore it can be used with dBase files (eg. Saving data).

INFORMATION: This coding makes it hard to reach data but it is not 100% safe!
Strings/Text are crypted with @Pwd$() and de-crypted with the same (!) function. The two functions only work together with the same key-string defined with PASSWORD.

An example of how PASSWORD works with @Pwd$ is as follows. 
__________________________________________________________________________

Declare hInput%,hOK%,ProgEnde%,Text$,Crypt$
Declare hText%,hCrypt%
WindowStyle 31
WindowTitle "Password-Demo"
Window 10,10-350,200
PopUp "&Program"
AppendMenu -4000,"&Quit"
Let hInput%=@CreateEdit(%HWND,"",10,10,100,-25)  '-> The last negative value
       'activates the password- All characters will be displayed with stars ("*").
       ‘This is only for showing, inside the editbox. 
Let hOK%=@CreateButton(%HWND,"&Ready",10,50,80,25)
Let hText%=@CreateText(%HWND,"",10,80,300,25)
Let hCrypt%=@CreateText(%HWND,"",10,110,300,25)
@SetFocus(hInput%)

PASSWORD "HiChris"       'String-parameter as you like! (The key)

Let ProgEnde%=0
WhileNot ProgEnde%
   WaitInput
   If @MenuItem(-4000)     'the menu entry "Quit" was selected
     Let ProgEnde%=1
   ElseIf @GetFocus(hOK%)  'when pressing the READY-Button
     Let Text$=@GetText$(hInput%) ‘the string is normal and to be read with @GetText$() !
     Let Crypt$=@Pwd$(Text$)   'Crypting based on the crypting-key "HiChris" !
     
     SetText hText%,@ADD$("Normal: ",Text$)
     SetText hCrypt%,@ADD$("Crypted: ",Crypt$)
     '...
     '... Code for (e.g.) saving the crypted password ...
     '...
   EndIf
EndWhile
END
________________________________________________________________________

@ReadCom(N1,N2)

N1: Integer - Handle of the serial port
N2: Integer - Number of chars to read

Result: String - Received chars

A string will be read from the serial port (handle N1), but a maximum of N2 chars. When the result string is a blank string no data exist or an error occurred. Such an error can be evaluated with @COMERROR. This should be done after every @WRITECOM! The serial port must be opened with @OPENCOM. This returns the handle of the serial port.

See also: @WriteCom, @SetCom, @CloseCom

@ReadIni$(S1,S2,S3)

S1 - String: File name / Registry class (32 bit)
S2 - String: Application name / Registry path (32 bit)
S3 - String: Entry (Key)

Result: String (Entry value)

A value will be read from a INI file. Investigation of the printer:

Let Printer$=@ReadIni$("WIN.INI","Windows","Device")

Use WriteIni to create and write INI f iles.

In addition PROFAN² 32Bit makes it is possible to read values out of the Windows registry (registry database). In this case the first parameter contains the registry class "HKEY_0" ... "HKEY_6":

    HKEY_CLASSES_ROOT     = KKEY_0
    HKEY_CURRENT_USER     = HKEY_1
    HKEY_LOCAL_MACHINE    = HKEY_2
    HKEY_USERS            = HKEY_3
    HKEY_PERFORMANCE_DATA = HKEY_4
    HKEY_CURRENT_CONFIG   = HKEY_5
    HKEY_DYN_DATA         = HKEY_6

The second parameter contains the complete "path" corresponding to the entry. The third parameter means the entry (also called "key") to be read out of the registry. If the path does not exist, a warning is given. Single entries of the path are separated with a backslash (known from DOS paths):

Let Printer$ = @ReadIni$("HKEY_5",\
    "System\Current\Controlset\Control\Print\Printer","Default")

Using WriteIni, INI files can be created and values be set in these files. In PROFAN² 32Bit writing to the Windows registry is also possible.

@RGB(R,G,B)

R,G,B : Value - Color value (0 .. 31 / 0 .. 255 in truecolor mode)

Result : Value (0 .. 32767 / 0 .. 64 millions in truecolor mode)

This function calculates one of the 32767 (16 millions in truecolor mode) possible colors from red, green and blue:

@RGB(0,0,0) = 0 (black)
@RGB(31,31,31) = 32767 (white)

@Rnd(N)

N : Value

Result: Integer or LongInt

Returns a random number between 0 and N-1.

@Right$(S,N)

S : String
N : Number of chars.

Result : String 

Returns the last N (right) chars of S.

@Round(N1,N2)

N1: Float - Value
N2: Integer - Numbers of decimal places

Result: Float - Rounded value

The value N1 will be rounded to N2 decimal places. N2 is allowed to be negative. Because of this, values can be rounded up to full 100 (n = -2), 1000 (n = -3), etc. The value to be rounded can be integer and longint too, of course!

@SaveFile$(S1,S2)

S1 : String - Titlet
S2 : String - File name (suggestion)

Result: File name (incl. path)

A file selection box to save with the heading S1 will be shown. The result is the selected file (including path) that can be used to save or write data.

Example:

Let Name$=@SaveFile$("SAVE:","*.TXT")

In 32-Bit PROFAN² uses the Windows system dialogs for loading and saving. These dialogs allow several file filters. To use this feature, several file filters consisting of a file description and extension(s) can be combined. To open next to the *.TXT files also *.ASC and *.PRF files, the command line could look like this:

Let Name$ = @SaveFile$("SAVE","Textfiles|*.TXT;*.ASC|Profan²-Files|*.PRF")

The vertical line is reached with [AltGr] + [<] .

@ScanKey(N)

N : Integer - Scancode

Result: Integer (1 or 0)

If the last scan code (virtual key code) corresponds with N (0 to 254) the result will be 1. Otherwise the result will be 0. See table of scan code  in %SCANKEY.

@SelectString(N1,N2,S)

N1: Integer - Handle of the listbox
N2: Integer - Start line for search (first entry => -1)
S: String - Search string or a left part/beginning of the search string

Result: Integer - Position of the search string

In the listbox with the handle N1, @SelectString$ searches the first line beginning with string S. The search starts with line N2. For N2 = -1, the search starts with the first line. If a line is found, the selecting bar will be set on this line to show it.

@SendKey(N1,N2)

N1 : Integer - Handle of the window object
N2 : Integer - Virtual key stroke  (Scancode)

Result : Integer

A simulated key stroke will be sent to the window/window object with handle N. N2 is the virtual Key stroke.

	8 -	BackSpace
	9 -	Tab
	13 -	Return
	16 -	Shift
	17 -	Ctrl
	20 -	CapsLock
	27 -	Esc
	32 -	Space
	33 -	PageUp
	34 -	PageDown
	35 -	End
	36 -	Home
	37 -	Left
	38 -	Up
	39 -	Right
	40 -	Down
	45 -	Ins
	46 -	Delete
	48 -	Key 0
	... -	...
	57 -	Key 9
	65 -	Key A
	... -	...
	90 -	Key Z
	112 -	F1
	... -	...
	135 -	F24

NOTE: This function might react differently under Windows 3.x when compared to Windows 95. Especially if  a virtual key stroke is sent from a 32Bit application to a 16Bit application and inversely.

@SendMessage(N1,N2,N3,N4)

N1 : Integer - Handle of the receiver (a window object or window object)
N2 : Integer - Number of the message
N3 : 16-Bit: Integer - 16-Bit message depending information
       32-Bit: Longint - 32-Bit message depending information
N4 : LongInt or area variable - 32-Bit message depending information

Result : Integer - Return value of the message

A message will be sent to the window or window object with the handle N1. N2 represents the message (number). The values N3 and N4 depend on the selected message.

WARNING: Messages in N4 that expect or return pointers to strings or data structures should only be used by experienced PROFAN² programmers. They can force a system crash. In every case be careful to DIMension enough the corresponding area variable. The most important messages for PROFAN² programmers are shown in chapter 4 of this reference.

@SendString(N,S)

N : Integer - Handle of the window object
S : Integer - String

Result : Integer

To the window/window object with the handle N will be sent a series of simulated key strokes where S is a string you like. Special chars, special german characters, upper- and lowercase chars will be set to corresponding key strokes. Every key stroke is represented with one or more chars. To display normal  letters, chars and digits, these are given as a string:

	@SendString(W%,"This is a test!")

Plus char (+), caret char (^), percent char (%), tilde (~) and brackets () have under @SendString special meanings. To display one of these chars you have to set it between curved brackets. Displaying e.g. the plus char you set {+} in the string:

	@SendString(W%,"A {+} B = C")

To show curved brackets you set {{} and {}} .

To send non-shown chars belonging to a key stroke (e.g. ENTER or TAB) , also key strokes, which display no chars, use the corresponding code text inside curved brackets:

	@SendString(W%,"This is the entry! {ENTER}")

Code text of the key strokes

	Code
	-----------------
	{PGUP}
	{PGDN}
	{PRINT}		‘(in german PROFAN², PRTSC)
	{INSERT}
	{ENTER}
	{END}
	{DELETE} or {DEL}
	{ESCAPE} or {ESC}
	{CAPSLOCK}
	{HELP}
	{CLEAR}
	{LEFT}
	{UP}
	{RIGHT}
	{DOWN}
	{NUMLOCK}
	{HOME}
	{SCROLLLOCK}
	{BACKSPACE} or {BS} or {BKSP}
	{TAB}
	{BREAK}
	{F1}
	...         	...
	{F24}

To set key stroke combinations containing the SHIFT-, CTRL- or ALT-key, use the following:
+ => SHIFT, ^ => CTRL and % => ALT.

To set such key stroke combinations, followed by one or more keys, set the code of the key strokes inside brackets. To hold e.g. the SHIFT key while pressing "e" and "c", you write "+(ec)" (="EC"). To hold SHIFT while pressing "e" and the following "c" without SHIFT-key, you write "+ec" (="Ec").

To use repeating key strokes use the syntax key count, where between both parameters a space char is set. For example means "LEFT 42", the left arrow key will be pressed 42 times, "h 10" means pressing the char "h" 10 times.

Additional uses can be \a, \t and \n. (Unfortunately, chars only reached with ALTGR aren’t sent under PROFAN²-16Bit.)

If N = 0 will be sent to the window that owns the focus, it means the same as %GETFOCUS.

NOTE: This function might react differently under Windows 3.x when compared to Windows 95. Especially if  a virtual key stroke is sent from a 32Bit application to a 16Bit application and inversely.

@SetActiveWindow(N)

N : Integer - Handle of the  window

Result : Integer - Handle of the previous active window

The window with handle N becomes the active window.

See also: %GetFocus, @GetFocus, @SetFocus

@SetBit(N1,N2,N3)

N1 : Integer variable (Integer/LongInt) - Value
N2 : Bit number (0 .. 15)
N3 : New value of the bit (0 or 1)

Result : LongInt

The function sets bit no. N2 in value N1 to N3. Single bits can be set specifically.

Example:

	declare a%
	cls
	let a% = 5
	print "a%: ";a%
	let a% = setbit (a%,5,1)
	print "a%: ";a%
	let a% = setbit (a%,5,0)
	print "a%: ";a%
	waitinput

@SetCom(S)

S: String - Corresponding to the format of the DOS command MODE

Result: Integer - 0 = OK, <0 = Failure

The serial port will be set with new values and the buffers will be initiated. The serial port must be opened before with @OPENCOM. String S contains the settings corresponding to the MODE command:

COMx:B,D,P,S

COMx: 		Serial port, e.g. COM2
B: Baud - Speed:	110, 150, 300, 600, 1200, 2400, 4800, 9600 or ? 19200
P: Parity:		O (Odd), E (Even), M (Mark), S (Space) or N (None)
D: Data bits: 	6, 7 or 8
S: Stop bits:	1, 1.5 or 2

Example:

	Let E% = @SetCom("COM2:9600,N,8,1")

For further information see the DOS manual. If these settings are not far enough, @SETCOMEXT offers more possibilities. @SETCOMEXT must be called after @SETCOM !

@SetComExt(N1,N2.N3.N4.N5.N6.N7)

N1: Integer - Handle of the serial port
N2: Integer - RlsTimeOut in ms
N3: Integer - CtsTimeOut in ms
N4: Integer - DsrTimeOut in ms
N5: Integer - Flags:
	$0001 = Binary mode (DCB.fBinary)
	$0002 = RTS not checked
	$0004 = parity checking on
	$0008 = CTS-handshake during output
	$0010 = DSR-handshake during output
	$0080 = DTR not checking
	$0100 = XON/XOFF during output on
	$0200 = XON/XOFF during input on
	$0400 = Parity error-data-set on
	$0800 = Zero removing on
	$1000 = Rx char event on
	$2000 = DTR-handshake during input
	$4000 = RTS-handshake during input
N6: Integer - Minimum number of chars in the waiting-queue before sending Xon
N7: Integer - Maximum number of chars in the waiting-queue before sending Xoff

This function is something for advanced programmers who know the serial port very good. It is to call after @SETCOM and expand the settings. With @SETCOMEXT the buffers are initiated new.

Combinations of flags are reached when adding the single flags. The given values are hexadecimal values! Values not to change are set to -1. This way, with @SETCOMEXT every single parameter of the serial port can be set specifically.

INFORMATION: In PROFAN²-32Bit under Windows 95 the three timeout parameters have no meaning.

See also: @OpenCom, @SetCom, @ComError

@SetFocus(N)

N : Integer - Handle of the window object

Result : Integer - Handle of the previous focused window object

Sets the focus on the window object with handle N. The return value is the focus of the window object that had it before. The focus is like the cursor in Windows. For example, if an input field gets the focus, the blinking vertical line appears (cursor) and you can enter something.

See also: @SetActiveWindow, @GetFocus, %GetFocus

@ShortName$(S)

S: String - Long file name (incl. path)

Result: Short file name (path and file)

This function evaluates to the short file name (8.3) the corresponding long file name. The file name can include a path. It is useful for programs not prepared for Windows 95 yet and can’t handle long file names. This also important for file names of data bases or index tables in PROFAN²-16Bit.

If the file doesn’t exists @ShortName$ returns a blank string. (Under Windows 3.x or if long file names are set off with SetLFN, the string S always will be returned.)

@ShowWindow(N1,N2)

N1 : Integer - Handle of the window
N2 : Integer - Show mode (1 .. 9)

The window with handle N1 will be displayed in Mode N2. The result is 1 if the window was visible, or 0 if it was hidden.

	0 	- Window is hidden and deactivated
	1 	- Window is activated and displayed in original size
	2 	- Window is activated and minimized to a symbol
	3 	- Window is activated and displayed as big as possible
	4 	- Window is displayed in normal size. The current active window stays activated
	5 	- Window is activated and displayed in current size
	6 	- Window is deactivated and minimized to a symbol
	7 	- Window is minimized to a symbol. The current active window stays active
	8 	- Window is displayed in current settings. The current active window stays active
	9.	- Same as mode 1

@ScanKey(N)

N : Integer - Scancode

Result: Integer (1 or 0)

If the last scan code (virtual key code) corresponds with N (0 to 254) the result will be 1. Otherwise the result will be 0. See table of scan code in %SCANKEY.

@Sin(N)

N : Value (Angle in radian measure)

Result : Float

The sine of angle N 

@Space$(N)

N : Number of chars

Result : String 

Returns a string of N number of space chars.

@SQLInit S

S - String: Init-String

Result: Integer

This function connects the program with the database server. S is the initialization string to open  and initialize the database server. If ODBC is not installed on your system, the error message "ODBC.DLL  not found" appears. If you enter S as a blank string in most ODBC drivers, a dialog box will open where  you can select the database server. There are also ODBC drivers for dBase-, Fox-Pro, Paradox and Access  databases. A driver like this is installed, for example, with WORD 6.0. With one of these drivers you  can use ODBC or SQL without a network. If the database server did not open, value 0 will be returned,  otherwise 1.

Examples: 

	@SQLINIT("DSN=SQLserver;UID=USER;DATABASE=TEST")

	@SQLINIT("DSN=dBase-Files")

	@SQLINIT("")

Please check the documentation for your ODBC driver for the exact syntax of the initialization string.

@Sqr(N)

N : Value

Result : Float

The square of N (N²).

@Sqrt(N)

N : Value

Result : Float

The square root for N.

@String$(V,A)

V: Area variable (Must be DECLAREd and DIMensioned before)
A: Integer - Address inside the area variable (offset)

Result: String - String starting at address

This function returns the string starting at address (offset) A. All chars will be added to the string until a char with code 0 (@Chr$(0)) appears or the maximum string length of 255 is reached. Is A out of the DIMensioned area of V, an error message occurs.

@Str$(S)

N : Value

S : String

The value of N will be transformed to a string without following spaces. The length of the string and (by float) the number of the following comma places are set with the NUMWIDTH and DECIMALS:bDecimals] commands.

@Sub(N1,N2)

N1 : Value
N2 : Value

Result: Value

N2 will be subtracted from N1.

@SubStr$(S1,N,S2)

S1 - String: String to work on
N  - Integer: Number of partial string
S2 - String: Separator char

Result: Substring from S1

Filters N partial string from S1, S2 is the separator between the partial strings. 

Example:

Let A$ = "one,two,three,four,five"
Print @SubStr$(A$,3,",")

The result would be the string "three". If the separator in string S1 is not found, the result of the first partial string would be the entire string, and for all following strings it would be the blank string. If N is less than 1, an error message will be displayed. If N is greater than the amount of existing partial strings, the result  is a blank string.

NOTE: S2 can also be made up of several characters!

@Tan(N)

N : Value (Angle in radian measure)

Result : Float

The tangent of angle N.

@TestBit(N1,N2)

N1 : Integer variable (Integer/LongInt) - Value
N2 : Bitnumber (0 .. 15)
N3 : New value of the bit (0 or 1)

Result : LongInt

This function checks if in N1 the bit no. N2 is set. The result is the value of the checked bit (0 or 1).

@Time$(N)

N : Integer (0 .. 1) - Subfunction

Result: String

Gets the current time:

N = 0 : hours and minutes (e.g. "23:45")
N = 1 : seconds and 100th of seconds (e.g. "39.67")

@TMouse(X1,Y1 - X2,Y2)

X1,Y1 : Integer - upper left
X2,Y2 : Integer - lower right

Result: Integer (0 or 1)

If the mouse was within the square during the last mouse click, the result will be 1. The coordinates are text coordinates (like in LOCATE or TBOX).

@Translate$(S1,S2,S3)

S1: String - String to work on
S2: String - Search text
S3: String - Replace text

Result: String, where S2 was replaced with S3.

All appearing S2 in S1 will be replaced with S3.

@Trim$(S)

S : String

Result: String

The leading and ending spaces of a string are cut off.

@Upper$(S)

S : String

Result: String

The string S will be transformed completely to capital letters, national special characters (e.g. special german characters) are recognized.

@UseDLL(S)

S: String - Name of the DLL file (possible with path)

Result: Integer - Handle of the DLL

The DLL S will be loaded into memory. If it is already loaded, the call counter goes up 1. The result is the handle of the DLL. (used for the command DRAWEXTICON.) If the result is less than 32, an error occurred and the DLL could not be called. For more information about error codes see @WINEXEC.

NEW: From PROFAN² 6.0 up many DLL files as you like can be loaded and reached. If a new DLL is loaded the call counter of the last DLL is not decremented. To remove the DLL (inside the PROFAN² program) use the command FREEDLL.

Example:

Declare hDLL%
Let hDLL%=@UseDLL("ICONS.DLL")
DrawExtIcon hDLL%,"MSDOS",20,20
FreeDLL hDLL%

@Val(S)

S : String

Result: Value

String S will be transformed into a numerical value. The result is 0 if the string contains non-numerical characters. In this case no error message is given. Numeric values are also strings in binary, octal and hexadecimal spelling like “%10001“ (binary), “&0754“ (octal) or “$3FA2“ (hexadecimal).

Example:

	Let A& = @Val("%10100011")

@Width(H)

H     : Integer - Handle of the window, dialog, dialog object

Result : Integer - Width of the object inside the frame

Often the size of a window or dialog is needed. This is also called client. The client area does not include the menu and the title bar. It only includes the part of the window (or object) where it is allowed to draw, write, etc.

@WinExec(S,N)

S : String - Program (incl. path) to start
N : Integer - Display mode  (0 .. 9)

Result : Integer - Handle of the executed program

Application S will be started with display mode N. The result is the handle of the application. If the result is smaller than 32, a Error will occur and the application will not start.

Values for the display mode:

	0 -	Not enough free memory or executable file damaged
	2 -	File not found.
	3 -	Path not found.
	5 -	Error at shared access or network access
	8 -	Insufficient memory to execute application.
	10 	Incorrect Windows version.
	11 -	Invalid .EXE file (no Windows-.EXE file or error in .EXE format).
	12 -	Application designed for other operating system.
	14 -	Unknown .EXE file type.
	15 -	Attempt to load invalid .EXE file (standard mode or enhanced 386 mode).
	16 -	Attempt to load a file twice containing multiple data segments.
	19 -	Attempt to load a compressed .EXE file.
	20 -	Dynamic link library (DLL) incorrect.
	21 -	Application requires 32-bit environment.

Example:

Let X%=@WinExec ("NOTEPAD.EXE",3)

If no path is selected, function @WinExec searches the program in the following order:

	1.	Current directory (@GetDir$("@"))
	2.	Windows directory (%WinPath)
	3.	Windows system directory (%SysPath)
	4.	Directory which contains calling program (@Par$(0))
	5.	Directories included in PATH (@GetEnv$("PATH"))
	6.	Network directories (stated with command MAP)

IMPORTANT: Because of reasons (we hope) Microsoft knows why, the string S must be no longer than 141 chars!

See also: @GetUsage

@WinExecWait(S,N)

S : String - Program (incl. path) to start
N : Integer - Display mode  (0 .. 9)

Result : Integer - Success: 1 = Ok, 0 = Failure while executing

Application S will be started with display mode N. Unlike @WinExec, this function waits until the executed programs ends. @WinExecWait returns no handle, only success or failure.

Example:

	@WinExecWait("NOTEPAD.EXE",1)

If no path is selected, function @WinExec searches the program in the same order like @WinExec (see above).

IMPORTANT: Because of reasons (we hope) Microsoft knows why, the string S must be no longer than 141 chars!

@WriteCom(N,S)

N: Integer - Handle of the serial port
S: String - Text to send

Result: Integer - Numbers of Bytes sent

The string S will be sent to the serial port. The result contains the number of  the real written bytes. Is the result negative, an error occurred. The absolute value is the number of bytes send before the error. The occurred error can be evaluated with @COMERROR. This should be done after every @WRITECOM. The serial port must be opened before with @OPENCOM. It returns the handle H.

See also: @ReadCom, @SetCom, @CloseCom

@Word(V,A)

V: Area variable (Must be DECLAREd and DIMensioned before)
A: Integer - Address inside the area variable

Result: Integer - Value

This function evaluates the value of the data word (2 bytes) at the address (offset) A in the area variable V. 

@XOr(N1,N2)

N1 : Value
N2 : Value

Result: Integer

Exclusive OR-function. The result is not like 0 if N1 OR N2 (but not both) are not 0.
It is only 0 if both arguments are equal.

IMPORTANT: Both arguments will be checked also @OR and @AND -byte for byte.

3. Commands

Every program line starts with a command. Also function can be used like commands but in this case only without (!) a return value. If you want a return value the assignment "LET" is mandatory. At least one blank has to follow the command word to be recognized.

Examples:

	StartPaint %HWND	‘Drawing in the PROFAN² -main window: okay

	@WinExec(...)		‘Executing a program, function used like a command,
				‘NO return value: okay

	hProg% = @WinExec(..)	‘Line starts not with a command or function: wrong!
	Let hProg%=@WinExec()	‘...now it’s okay, because LET is an accepted command.

More than one command in one line (e.g. as in BASIC, PASCAL or C) is prohibited. The only exception is the CASE command.

' ... (Remark character)

Comment signs should be put after the command in a line (in contrast to REM):

Examples: 

'Sub routine

Let X%=125  'Assign X-Position

Add VAR,N

VAR - Variable name (Integer)
N   - Integer

N will be added to the VAR variable (faster and easier than the @ADD function.).

Example:

ADD Punkte%,10

AddFiles [*]S

S : String - File mask

This command adds a file list to the PROFAN² list box.

Example:

ClearList
AddFiles "*.RGH"
@ListBox$("Result",1)

Only in PROFAN²-32Bit:: Is a star char given before the string, all files in subdirectories will be added too (corresponding to the file mask).

Examples:

ClearList
ChDir "C:\"
AddFiles *"*.WAV"
@ListBox$("Result",1)

Find all WAV-files on drive C:.

ClearList
ChDir "D:\"
AddFiles *"CTL3D.DLL"
@ListBox$("Ergebnis",1)

Finds all files named CTL3D.DLL on drive D:.

WARNING: If the nesting depth of the directories is to great (e.g. in a network) a stack overflow can appear. 

AddFonts

This command adds a list of fonts registered in the Windows system to the PROFAN² list box.

Example:

	ClearList
	AddFonts

AddString S

S : String

This command adds a string to the PROFAN² list box.

Example:

ClearList
AddString "Item 1"
AddString "Item 2"

AddWindows S

S : String - Window title mask

Adds the available window titles starting with S to the list. If S is an blank string, all windows with  a title will be added. Hidden windows (windows without titles) will not be read.

The command is e.g. helpful for the programming of task managers.

Append #N

N: Value - File number (1 .. 15)

The file  #N opens to append data. In case of an error %IoResult is bigger than 0.

Example:

Assign #1,"TEST.DAT"
Append #1
Case %IoResult : MessageBox "Error: Can’t open file!",16
Print #1,"Test data",56,Bill$
Close #1

AppendMenu N,S

N : Value - Menu number (1 .. 32766)
S : String - Entry

In the popup menu, the entry S will be added under number N. The & sign at the beginning will underline. Menu item number 254 has no affect, 255 always results in PROFAN² Copyright-message.

CreateMenu
AppendMenu 100,"&Open"
AppendMenu 101,"&Save"
AppendMenu 102,"Save &as"
TrackMenu 20,130
Case @MenuItem(100):Goto "Open"
Case @MenuItem(101):Goto "Save"
...

Another example:

PopUp "&File"
   AppendMenu 100,"&Open"
   AppendMenu 101,"&Save"
   AppendMenu 102,"Save &as"
   Separator
   SubPopUp "File &type"
      AppendMenu 110,"Exe"
      AppendMenu 120,"Com"
   EndSub
   AppendMenu 103,"&Quit"
PopUp .....

AppendMenuBar N,S

N : Value - Menu number (1 .. 32766)
S : String - Entry

The entry S will be added to the main menu under the number N. The & sign at the beginning results in underline.

Example:

AppendMenuBar 10,"&Open"
AppendMenuBar 11,"&Save"
WaitMouse
Case %MenuItem(10):Goto "Open"

Arc X1,Y1-X2,Y2; X3,Y3; X4,Y4

X1,Y1 : Value - Upper left
X2,Y2 : Value - Lower right
X3,Y3 : Start
X4,X5 : End

An arc will be displayed. X1,Y1 and X2,Y2 mark the rectangle, which contains the arc, the other coordinates start and end the arc.

Assign #N,S

N : Value - File number (1 .. 15)
S : String - File name  (+ path)

The file S will be assigned to file number N.

Example:

Assign #1,"DEMO.PRF"
Reset #1
WhileNot @Eof(#1)
   Input #1,FileLine$
   Print FileLine$
Wend
Close #1

Beep

Creates a signal. To create other signals, refer to SOUND and PLAY below!

BlockWrite #N,B,N1,N2

#N : File number of file opened with OPENR
B  :	Area variable (Must be DECLAREd and DIMensioned before)
N1 :	LongInt - Address inside the area variable (offset)
N2 :	LongInt - Numbers of bytes

Into the file opened with OPENRW, assigned with file number #N, N2 bytes will be written out of the area variable B starting from address N1. The example writes the contents of the area variable Test# to the file TEST.DAT:

Declare Test#
Dim Test#,500
Assign #1,"TEST.DAT"
OpenRW #1
BlockWrite #1,B#,0,500
CloseRW #1

Byte V,A=N

V: Area variable (Must be DECLAREd and DIMensioned before)
A: Integer - Address inside the area variable (offset)
N: Integer - Value (0 ... 255)

The byte at address (offset) A inside the area variable V will be set to the value N. Is the address A out of the area value given with DIM before, an error message occurs.

Case N:COM

N   :	Value - Conditional expression
COM :	PROFAN² command line

If  N has the value ,<>0 COM will be executed, otherwise the program execution will go to the next line. CASE is equal to a one line IF command. COM has to be a complete command line, a function without  LET assignment is not valid.

Examples:

CASE @Equ$(A$,""):PRINT "A$ is a blank string"

CASE @Neq(A%,0):Let A$=@ListBox$("List",5)

CASE @Neq(A%,0):@ListBox$("List",5)

CaseNot N:COM

N   :	Value - Conditional expression
BEF :	PROFAN² command line

If  N has the value ,<>0 COM will be executed, otherwise the program execution will go to the next line. CASENOT does not correspond to a one line IFNOT command. The same is true for the CASE command.

Char V,A=S

V: Area variable (Must be DECLAREd before and DIMensioned)
A: Integer - Address inside the area variable (offset)
S: String - String

The string S will be written at address (offset) A to the area variable V. In opposite to the command STRING, the string is not signed with a zero byte at the end!

The example fills an area variable with a series of strings (data), may given to a DLL or API function or stored there only for a short time (PROFAN² arrays are global and dimensioned for the whole runtime!) or for any other reasons programmers want to work on data. So, it’s possible to simulate arrays of any type, e.g. owner data structures, etc.!

Declare Area#,Address%,c%
Dim Area#,10000
Let Address%=0
Let c%=1
WhileNot @GT(c%,100)
	Let Text$="Test No. ";@Format$("000",c%)	‘means: "Test No.001...100"
	Char Area#,Address% = Text$
	Add Address%,@Len(Text$)
	Add c%,1
EndWhile
'...
Dispose Area#

See also: String

CharSet N

N: Integer - Charset

The character set for the next USEFONT command will be set.

0 - ANSI
1 - ASCII
2 - Symbol

Default is ANSI (0).

ChDir S

S : String - Path

Switch to directory S. If S contains a drive setting, it will also be switched to the current drive.

Example:

ChDir "D:\TABLES\GRAFIC"
LoadSizedBmp "Turnover",10,30-400,600;1

CheckMenu N1,N2

N1: Integer - Menu number
N2: Integer - Mode (0, 1)

The menu entry with number N1 will be signed with hook (checked). if N2 <> 0. If N2 = 0 a present hook will be removed.

Example:

	PopUp "Show mode"
		AppendMenu 101,"50 %"
		AppendMenu 102,"100 %"

	CheckMenu 102,1

The menu entry "100 %" will be signed with a hook.

Chord X1,Y1-X2,Y2; X3,Y3; X4,Y4

X1,Y1 : Value - Upper left
X2,Y2 : Value - Lower right
X3,Y3 : Start
X4,X5 : End

An arc will be displayed. X1,Y1 and X2,Y2 mark the rectangle which contains the arc, the other coordinates mark start and end of the arch.

ClearClip

Clears the clipboard.

ClearList

The PROFAN² list box will be deleted, the pointer will be set on the beginning. With ADDFILES, ADDSTRING and/or ADDWINDOWS the list will be filled.

ClipLoadBmp X,Y;N

X,Y   : Position to draw the bitmap
N     : Integer - Copy mode (-1 = transparent)

With this command a bitmap (picture) can be drawn out of the clipboard to the screen. In this case it is insignificant whether the bitmap comes from another PROFAN² program or another Windows program or somewhere else to the clipboard.

The copy mode is the same as used with LoadBmp or CopyBmp. Copy mode -1 (transparent) signs the lowest left pixel of the bitmap. The color of this pixel (!) will be shown in transparent mode.

Close #N

N : Value - File number (1-15)

The file opened with RESET, APPEND or REWRITE and assigned with file number N, will be closed.

Example:

Close #Nr%

CloseRW #N

N: File number (1-15)

A file opened in binary mode (OPENRW) will be closed.

NOTE: If this command is used on a file opened with RESET, APPEND or REWRITE, an error occurs (%IOResult will be set). Also in inversely cases.

Cls [N]

N : Value - Color value (0 .. 32767 / 16 millions)

Deletes the screen. A window will open. With PROFAN² 3.0 or higher, you can also set the background color.

Example:

Cls @RGB(23,23,23)

This line would delete the screen and use (in the 32k color mode) a light gray for the background.

Color C1,C2

C1 : Value - Text color (0 .. 15)
C2 : Value - Background color (0 .. 15)

The color of the text mode (PRINT, TBOX,  INPUT) will be set. The colors correspond to the 16 colors from MS-DOS in text mode.

Example:

Color 15,0
Print "Hugo was here!"

Copy S1 > S2

S1 : String - Source file
S2 : String - Target file

The source file will be copied and  named Source File. Both strings can contain path statements. Wildcards are not valid.

Example:

COPY "C:\START.BAT" > "D:\BAK\START.BAK"

CopyBmp X1,Y1-X2,Y2 > X3,Y3;N

X1,Y1 :	Value : Source upper left
X2,Y2 :	Value : Width, Height
X3,Y3 :	Value : Target upper left
N     :	Value : Copy mode (-1 = transparent)

The part of the screen that begins with X1,Y1 a width of X2 Pixel and is Y2 Pixel high, will be copied to position X3,Y3. CAUTION: X2,Y2 are not absolute coordinates but width and height! The last parameter determines the Copy mode:

-1	Transparent
0	Normal copy
1	Source and target are combined with AND
2	Source and target are combined with OR
3	Source and target are combined with XOR
4	Target is inverted (source is not considered)

Copy mode -1 (transparent) signs the lowest left pixel of the bitmap. The color of this pixel (!) will be shown in transparent mode.

CopyBmpToMem X1,Y1-DX,DY > X2,Y2

X1,Y1 :	Value - Upper left edge of the bitmap
DX,DY :	Value - Size of the bitmap (Width, Height)
X2,Y2 :	Value - Upper left edge of the position inside the memory bitmap, where it will be drawn.

The part of the screen starting at X1, Y1, with the size DX and DY (pixel) will be copied from screen to position X2, Y2 in the memory bitmap. The memory bitmap can be loaded with MLoadBMP or created with MCLS.
WARNING: Because of performance CopyBmpToMem checks not whether the coordinates X2, Y2 are really inside the memory bitmap area or not.

CopySizedBmp X1,Y1-X2,Y2>X3,Y3-X4,Y4;N

X1,Y1 :	Value : Source upper left
X2,Y2 :	Value : Width, Height
X3,Y3 :	Value : Target upper left
X4,Y4 :	Value : Width, Height
N     :	Value : Copy mode (-1 for  transparent mode is NOT allowed)

The part of the screen that begins with X1,Y1 a width of X2 Pixel and is Y2 Pixel high, will be copied to position X3,Y3. CAUTION: X2,Y2 are not absolute coordinates but width and height!
The last parameter determines the Copy mode.

CreateMenu

Creates a popup menu. The menu will be filled with APPENDMENU and called  TRACKMENU. The result is in the system variable %MENUITEM.

dbCreateIndex S1 > S2

S1 : String - Index expression (Field name)
S2 : String - Index name

Creates an index with the field S1. If a database table is not open, an error message occurs..

The index file will be named S2. S2 must not include a file extension because the extension ".NDX" (DBase III format) is fixed. S1 may also contain more than one database field connected by "+" to build an index. 

Example:

@dbOpen(#1,"ADDRESS.DBF")
@dbUse(#1)
dbCreateIndex "ZIP" > "IXZIP"
dbCreateIndex "LASTNAME+NAME" > "IXNAME"

In this example an index file "IXZIP.NDX" is created containing an index with the field "ZIP" from the current database table. After that an index file "IXNAME.NDX" is created using an index with LASTNAME and NAME; sorted by LASTNAME and NAME.

dbCreate S1 > S2

S1 : String - Name of the structure file
S2 : String - Name of the database table

Creates a database table S2 from a structure file S1. If S2 does not contain a file extension ".DBF" will be added. The table uses the dBase III format. The structure file is a basic ASCII file describing the structure of the database table. Each field uses one line that contains the following information divided by semicolons: Field name, type, length and decimals. Structure file example for a simple address maintenance:

LASTNAME; C; 30; 0
NAME;     C; 30; 0
STREET;   C; 30; 0
CITY_ZIP; C; 30; 0
PHONE;    C; 20; 0
NEE;      D;  8; 0
SALARY;   N; 10; 2

For further information on field types see also %DBFTYPE. The field names must correspond to the dBase conventions: Only capitals, digits and underline are allowed. The field name has to start with a letter. the maximum length is 10 characters.

To create structure files and database tables the "Database structure" utility of the PROFAN² development environment can be used.

DDELINK S1,S2

S1: String - Application
S2: String - Theme

Creates a DDE connection to the application S1 with the corresponding theme. When the connection is successful, the system variable %DDEWIN contains the handle of the application. If the application fails to execute, it is possible the command DDELink "will hang". If it does hang it is waiting for an answer from the called application. In this case a key stroke or button click helps. If you are calling an application other than the Windows program manager, it is safe to start the application with @WinExec. If the application is not available you will get an error message. Starting the Windows program manager should be avoided with @WinExec, because some people use other shell programs that react like the original program manager and @WinExec can cause problems. If the connection is successful %DDEWIN contains the application handle otherwise 0.

The following example creates a connection to the program manager (or the actual shell, e.g. Explorer under Windows 95) and tells it to receive commands to create program groups:

	DDELINK "Progman","Progman"

DDEExecute S

S: String - Command

The command S is send to the application connected with DDELINK before. For possible commands and corresponding syntax see the documentation of the linked application. If the DDE server ends after linking, DDEEXECUTE can "hang". In this case a key stroke or button click helps.

The following example creates a program group, shows it and creates an icon inside:

IF %DDEWin
  let command$ = "[CreateGroup(PROFAN-Test,PROFTEST.GRP)]"
  let command$ = befehl$ ; "[ShowGroup(PROFAN-Test,1)]"
  let command$ = befehl$ ; "[AddItem(winfile.exe,File-Manager)]"
  DDEExecute command$
ENDIF

DDETerminate

The actual DDE connection will be terminated. Every DDELink command (and after the DDEExecute commands) must follow DDETerminate to end the connection.

Dec VAR

VAR : Variable name (Integer)

VAR will be decremented for 1 (identical with SUB VAR,1).

NOTE: DEC only works with integer variables. To decrement another variable type use
Let VAR = @SUB(VAR,1).

Decimals N

N: Integer - Decimal places

The number of the necessary decimal places will be determined. Default is 6. This number is also considered by the @Str$ function. (Programs written in PROFAN 1.x should always use the line "DECIMALS 0", before being re-compiled with PROFAN² 2.x )

Declare VAR [,VAR[,VAR]...]

VAR : Variable-Name

In PROFAN, all variables have to be declared before the initial use. String variables are signed with $, LongInt-Variable with &, Float-Variable with !, Integer-Variables with % and area variables with #.

From PROFAN² 6.0 and later it is possible to declare arrays of variables (next to the PROFAN² standard open-dimension arrays) up to  3 dimensions. Arrays of area variables are not supported. An array can’t have more than 32000 (PROFAN²-32BIT) or 16000 (PROFAN²-16Bit) elements. The number of elements and dimension are set in square brackets, when working with arrays use the square brackets.

With the exception of area variables and arrays all variables also can be declared inside procedures or sub routines. There they have local validity. The used memory is given free when leaving a procedure.

Examples:

Declaring variables in the main program with global validity:

	Declare XPos%,YPos%,Text$

Declaring an integer array, (only) global validity:

	Declare 3DChess%[8,8,8]
	Let 3dchess%[0,0,0]=1

Declaring an area variable global validity:

	Declare Area#

Declaring some local variables inside a procedure: local validity:

	PROC SubProc
	   Declare Count%,Text$
	   Let Count%=1
	   WhileNot @GT(Count%,10)
	      Let Text$=@Str$(Count%)
	      Print Text$
	      Add Count%,1
	   EndWhile
	ENDPROC

Def @<Name>(N) <Expression>

 <Name>		:	Function name
 N		:	Number of parameters
 <Expression>	:	Function

A new function will be defined. <Name> is the name of the new function, N signs the numbers of given parameters and <Expression> describes the new function. The parameters are contained in @$(n), @%(n), @!(n) and @&(n).

Example:

Declare A%,B%
Def @Max(2) @If(@Gt(@!(1),@!(2)),@!(1),@!(2))
Let A%=34
Let B%=12
Print @Max(A%,B%)

This function determines the larger number.

Def <Name>(N) *S1,S2,S3,S4

 <Name>	:	Function name
 N	:	Number of parameters
 S	:	DLL name
 S	:	Function name INSIDE the DLL
 S3	:	Parameter types
 S4	:	Result type

Defines an external function that exists in a 16Bit-DLL or in the 16Bit-API.

The parameter types have following meanings:

% = Integer (also handles, words, bytes and bool values should be signed this way))
& = LongInt (also unsigned long and all other 4 byte values)
# = Area variable (this means all pointers to strings or data structures, etc.)

With area variables values (or strings, data structures) can be returned, because the address is given to the functions.

The result types have following meanings:

% = Integer (handles, words, Bytes, bool values)
& = LongInt (4 byte values)
Blank string = No result value

Use area variable to give strings, data structures to extern functions or to get from. Of course they must DIMensioned sufficiently.

Examples:

DEF @MoveWindow(6) *"USER","MoveWindow","%%%%%%",""
DEF @waveOutGetNumDevs(0) *"MMSYSTEM","waveOutGetNumDevs","","%"
DEF @GetWText(3) *"USER","GetWindowText","%#%","&"
DEF @GetApiPixel(3) *"GDI","GetPixel","%%%","&"
DEF @GetSysResources(1) *"USER","GetFreeSystemResources","%","%"
DEF @MsgBox(4) *"USER","MessageBox","%##%","%"
DEF @GetClientRect(2) *"USER","GetClientRect","%#",""

Two detailed examples are found in the directory EXAMPLES: DLL16.PRF/DLL32.PRF and RES.PRF. The last evaluates free system resources and shows it in a message box.

NOTE: Also PROFAN²-32Bit supports calling functions out of 16Bit DLLs. To use this feature the file "PROF16.EXE" must be copied into the Windows directory. It takes a mediating role between the 32- and 16Bit world. It is a 16Bit program.

Def <Name>(N) !S1,S2

 <Name>	:	Function name
 N	:	Number of parameters
 S	:	DLL name
 S	:	Function name INSIDE the DLL

Defines an external function that exists in a 32Bit-DLL or in the 32Bit-API.

Examples:

DEF @MoveWindow(6) !"USER32","MoveWindow"
DEF @waveOutGetNumDevs(0) !"WINMM","waveOutGetNumDevs"
DEF @GetWText(3) !"USER32","GetWindowTextA"
DEF @GetApiPixel(3) !"GDI32","GetPixel"
DEF @MsgBox(4) !"USER32","MessageBoxA"
DEF @GetClientRect(2) !"USER32","GetClientRect"

Dim V,N

V:	Area variable (Must be DECLAREd and DIMensioned before)
N:	16 Bit-Version: Integer - Size (1 ... 64500)
	32 Bit-Version: LongInt - Size (depend on available memory)

This command allocates a memory area of N bytes to the area variable V. Until this area variable is not given free with DISPOSE, no other program can write, read or use this memory in another way.

Dim! N

N : Integer - Number 0 .. 32767 (32Bit) / 16380 (16Bit)

Sets the size of the PROFAN² float array. The command can occur only once during the execution of the program and before first using a float array variable.

Example:

DIM! 56
LIST! 56 = 2345.67

Dim$ N

N : Integer - Number 0 .. 32767 (32Bit) / 16380 (16Bit)

Sets the size of the PROFAN² string array. The command can occur only once during the execution of the program and before first using a string array variable.

Dim% N

N : Integer - Number 0 .. 32767 (32Bit) / 16380 (16Bit)

Sets the size of the PROFAN² integer array. The command can occur only once during the execution of the program and before first using a integer array variable.

Dim& N

N : Integer - Number 0 .. 32767 (32Bit) / 16380 (16Bit)

Sets the size of the PROFAN² longint array. The command can occur only once during the execution of the program and before first using a longint array variable.

Dispose V

V: Area variable (Must be DECLAREd and DIMensioned before)

The memory of the area memory V will be given free. Before using again in PROFAN² it must be reserved again with the DIM command.
IMPORTANT: Every memory area allocated with DIM must be set free with DISPOSE afterwards. At the very least do so before ending the PROFAN² program. Otherwise this memory will be blocked until Windows is shut down!

DrawExtBmp I,S,X,Y;N

I:	Integer - Instance handle of the EXE or DLL, containing the bitmap
S:	String - Name or number of the bitmap
X,Y:	Position, where the bitmap is drawn
N:	Integer - Copy mode (-1 = transparent)

With this function a bitmap (picture) in another program or DLL can be used and shown on the screen. For this it is necessary to know the name or the number of the bitmap. Bitmap resources can be signed with a name or an integer value. To get the instance handle of a DLL implement @UseDLL. To get the instance handle of an EXE file use @WinExec. %HWND contains the instance handle of the running PROFAN² program. It’s possible to put all bitmaps, used in a program in one DLL, with a tool like Borland´s Resource Workshop. Also it’s possible to expand (PROFAN.EXE and) PROFRUN.EXE before linking a compiled PRC module.

The copy mode is the same as used with LoadBmp or CopyBmp. Copy mode -1 (transparent) signs the lowest left pixel of the bitmap. The color of this pixel (!) will be shown in transparent mode.

DrawExtIcon N,S,X,Y

N:	Integer : Handle of the extern file
S:	String : Icon name or -number
X,Y:	Value : Coordinates

The external icon S from the module with the N Handle will be placed in position X,Y. With a DLL the handle will be determined with @USEDLL, with an EXE file use @WINEXEC. Icons of a file are only accessible while the EXE file is executed.

Example:

Declare hDLL%
Let hDLL%=@UseDLL("ICONS.DLL")
DrawExtIcon hDLL%,"MSDOS",20,20

DrawIcon S,X,Y

S:	String : Icon name
X,Y:	Value : Coordinates

The icon S will be drawn at position X,Y.

Example:

DrawIcon "Button1",12,12

18 Icons are included in PROFAN.EXE, but this can be expanded with a resource toolkit.

The PROFAN² icons in the US-Version are named "ICON01" to "ICON20".
Icon editors are available, which can be used to change them.

DrawLibIcon S,N,X,Y

S:	 String: Icon name (with path)
N:	Integer: Number of the icon in the icon file
X,Y:	Integer: Position of the icon

With this command you can use an icon from any icon file. Using icons from EXE and DLL files are possible, you may also use single icons (*.ICO). The first icon of a file is number 0. The total number of icons in a file can be determined using the @ICONCOUNT function.

Example:

	DrawLibIcon "PROGMAN.EXE",2,100,100
	DrawLibIcon "SPIEL.ICO",0,200,100

DrawSizedExtBmp I,S,X1,Y1-X2,Y2;N

I:	Integer - Instance handle of the EXE or DLL file containing the bitmap
S:	String - Name of the bitmap
X1,Y1:	Position, where the bitmap is drawn
X2,Y2 :	Size of the bitmap
N:	Integer - Copy mode

This command does almost the same thing as DrawExtBmp. The difference is, the bitmap can be sized greater or smaller). With the additional parameters X2 and Y2 the bitmap size is set. Copy mode -1 (transparent) is not allowed!

DrawSysIcon N,X,Y

N:	Value - Icon number (0 .. 4)
X,Y:	Value - Coordinates

The Windows icon number N will be placed in position X,Y.

	0 : Windows-Symbol
	1 : STOP-Sign
	2 : Question mark
	3 : Exclamation mark
	4 : Info-Sign

DrawText X,Y,S

X,Y:	Value - Coordinates
S:	String or numeric value

Text S will be displayed in position X,Y of the screen, using USEFONT determined fonts with the color set by TEXTCOLOR.

DrawText 10,50,"Highscore:"

From PROFAN² 2.5 and later, S is allowed to be a numerically literal or a numerical variable. It will be changed to a string, according to Numwidth and Decimals:

DrawText 10,50,HighScore&

Ellipse X1,Y1-X2,Y2

X1,Y1:	Value - upper left
X2,Y2:	Value - lower right

A circle or ellipse will be drawn. X1,Y1 and X2,Y2 mark the rectangle that contains the ellipse.

EnableMenu N1,N2

N1: Integer - Menu number
N2: Integer - Mode (0, 1, 2)

The menu entry with menu number N1 will be deactivated, if N2 = 1.  If N2 = 2 it will be marked gray and will be deactivated. If N2 = 0 the menu entry will be shown normally and can be selected.

EnableWindow N1,N2

N1: Integer - Handle of the window object
N2: Integer - 0 = Disable, 1 = Enable (normal)

The window object with the handle N1 will be set disable or enable. If a window object is set disable, no clicking or entering values is possible.

End

End of the PROFAN² program. The program will be quit without any question.

Erase #N S

N : Value - File number (1 .. 15)

The file with file number N will be deleted. N must be assigned before!

Example:

	ASSIGN #1,"TEST.BAK"
	ERASE #1

ExitWindows N

N: Integer - Modus (0, 1)

With this command Windows will be shut down (after the usual safety questions, e.g. if files are open).
If N = 1, Windows will be started again. This is useful for setup programs changing e.g. WIN.INI.

FileMode N

N: Integer - File mode (see also DOS documentation)

Sets the file mode used for the opening of files (RESET, REWRITE or OPENRW) and for the file access. Under all DOS versions the following file modes are available:

0:	Only read
1:	Only write
2:	Read and write

Newer DOS versions know other modes, especially in a network. In PROFAN² the standard is N = 2. Do you want to read a file with file attribute read-only, you have to set before using RESET or OPENRW the file mode to 0.

Fill X,Y,C

X,Y:	Value - Coordinates
C:	Value - RGB color value of the border color

Starting with X,Y, everything within the border in color C will be filled with the current brush (USEBRUSH).

Example:

Fill 20,50,@RGB(0,0,31)

Font N

N : Value - Font number (0...2)

Selects the font N for the text mode (Display text with PRINT).

0 : System font (ANSI charset)
1 : OEM -font (ASCII charset)
2 : ANSI font

Since PROFAN² 4.5 this command determines which font PROFAN² uses in dBase-III tables. If N = 1 the OEM font is selected. This should be used if other programs will access the data tables. Mostly dBase data should be used with the ASCII or OEM font. This is also correct for ODBC drivers.

FreeDLL H

H : Integer - DLL handle

The DLL calling counter  with the handle H will be lowered when 1 is used. If the counter is 0, the DLL will be removed from memory. For every @UseDLL in a program you must also use FreeDLL, otherwise a loaded DLL is not released in memory until Windows is shut down.

GetMessage

This command waits on the next message that is meant for the PROFAN² program. GetMessage sets the system variables %Message, %Mwnd, &Wparam and &Lparam and passes the message on to Windows.

IMPORTANT: Inside a While-Loop whether a GetMessage OR another WAIT command  is used! PROFAN² system variables, normally set by WAIT commands (%SCANKEY, %KEY, %MENUITEM, etc.) will not be set by GETMESSAGE. In this case the programmer himself has to work on the messages!

If N  ... [ElseIf N ...] [Else ... ] EndIf

N : Value . Conditional expression

The lines between IF and ENDIF are only executed if N is not the same value as 0.

Example:

If @Equ(Test%,78)
  Print "Test% is 78!"
  Print "-------------"
EndIf

You can also call with more than one condition (e.g. when evaluating a menu) using  ELSEIF. When a condition is accomplished, the corresponding program part will be executed and continued on the line after ENDIF:

IF @Lt(A%,1)
  COLOR 1,15
  PRINT "A is less than 1"
ELSEIF @Equ(A%,1)
  COLOR 2,15
  PRINT "A equals 1"
ELSEIF @Equ(A%,2)
  COLOR 3,15
  PRINT "A equals 2"
ELSE
  PRINT "A is greater than 2"
ENDIF

WARNING: Behind ELSEIF must appear a conditional expression. If it does not exist the PROFAN² interpreter would handle ELSEIF like ELSE but the PROFAN² runtime module would recognize this error and break with the error message "To less parameters" (212).

IfNot N ... [ElseIf N ... ] [Else ...] EndIf

As a shortcut for If @Not(N), you can also use the shorter and faster IfNot:

IfNot @Equ(Test%,78)
  Print "Test% is not 78!"
  Print "-------------------"
EndIf

Inc VAR

VAR - Variable name (Integer)

VAR will be increment by 1. (identical with ADD VAR%,1)

NOTE: INC only works with integer variables. To increment another variable type use
Let VAR = @ADD(VAR,1).

Input #N,VAR

N : Value - File number (1...15)
VAR : Variable

A value will be read from file #N into the variable. Example:

Example:

Assign #1,"TEST.DAT"
Reset #1
Input #1,Title$
Input #1,Number%
Close #1

Input VAR

VAR : Variable

From the keyboard, a value will be read into the variable (text mode). Example:

Example:

Print "Enter title: ";
Input Title$
Print "Enter number: ";
Input Number%

In Windows, it is common to use the enter dialog with the function @Input$.

InsertMenu N1,N2,S

N1: Integer - Number of the menu entry before a new is inserted
N2: Integer - Number of the new menu entry (0 .. 32766)
S: String - Text of the new menu entry

On the previous menu position of the menu entry with number N1 a new menu entry with number N2 will be inserted. Menu number and menu text have the same meanings link under APPENDMENU.

See also: AppendMenu

Let VAR=N|S

VAR : Variable name
N   : Value
S   : String

A value will be assigned to a previously DECLAREed variable. The LET must (!) be here!

With the LET command it is possible to set - similar to the PRINT command - several string expressions, separated with semicolons or commas. Two strings separated with a comma will be added with a space char between, with a semicolon, no space char will be inserted. This method is  easier and (!) faster than adding with the @ADD$ function.

Example:

	LET Text$ = "You reached",@Str$(Score%),"points!"

NOTE: The automatically type conversion works with normal variables. With functions returning a numeric value the conversion is not done automatically. Because of this the @Str$ function is to be used every time!

Line X1,Y1-X2,Y2

X1,Y1 : Value - Start coordinates
X2,Y2 : Value - End coordinates

A line will be drawn between the marked positions in the line type and weight set with USEPEN.

LineTo X1,Y1

X1,Y1 : Value - End coordinates

A line will be drawn from the last (or set with MOVETO position to the marked position in the line type and weight set with USEPEN.

ListBoxItem$ N = S

N : Integer - Index (0 .. 9999)
S : String

The string S will be copied to position N in the PROFAN² list box list.

List! N1 = N2

N1 : Integer - Index 0 .. 32767 (32Bit) / 16380 (16Bit)
N2 : Float - Value

Value N2 will be copied to position N1 in the PROFAN² float list.

Example:

List& 1 = 5.67
List& 2 = 1045.324
Print @List!(1),@List!(2)

List$ N = S

N : Integer - Index 0 .. 32767 (32Bit) / 16380 (16Bit)
S : String

String S will be copied to position N1 in the PROFAN² string list.

List% N1 = N2

N1 : Integer - Index 0 .. 32767 (32Bit) / 16380 (16Bit)
N2 : Integer - Value

Value N2 will be copied to position N1 in the PROFAN² integer list.

List& N1 = N2

N1 : Integer - Index 0 .. 32767 (32Bit) / 16380 (16Bit)
N2 : LongInt - Value

Value N2 will be copied to position N1 in the PROFAN² longint list.

LoadBmp S, X,Y ;N

S:	String - Name of the picture file
X,Y:	Value - Coordinates
N:	Value - Copy mode (-1 = transparent)

A Windows BMP file will be loaded and displayed according to the copy mode N. The picture must be in BMP or RLE format. S also can include path statements. It will be displayed in it's original size, in position X,Y.

Values for copy mode are:

-1	Transparent
0	Normal copy
1	Source and target are combined with AND
2	Source and target are combined with OR
3	Source and target are combined with XOR
4	Target is inverted (source is not considered)

Example:

LoadBmp "C:\WINDOWS\PAPER.BMP",10,10;0

The last parameter set the copy mode. Copy mode -1 (transparent) signs the lowest left pixel of the bitmap. The color of this pixel (!) will be shown in transparent mode.

LoadSizedBmp S, X1,Y1-X2,Y2;N

S:	String - Name of graphic file
X1,Y1:	Value - Coordinates
X2,Y2:	Value - Size
N:	Value - Copy mode (-1 is not allowed here “-1 = transparent mode)

A Windows  BMP file will be loaded and displayed according to the copy mode N. It will be displayed in it's original size, in position X,Y. With negative values for X2 or Y2 you can also create mirror images.

Locate X,Y

X : Value - Row
Y : Value - Column

The next PRINT or INPUT command positioned on line Y, column X. Only for text mode commands.

Long V,A=N

V: Area variable (Must be DECLAREd and DIMensioned before)
A: LongInt - Address inside the area variable (offset)
N: LongInt - Value (0 .. 4,29 thousand millions)

The long word (32bit value = 4 byte) at address (offset) in the area variable V will be set to the value N. Is the address A out of the area value given with DIM before, an error message occurs.

NOTE: Because 4 bytes are written, addresses A to A+3 are used. At A the lowest, at A+3 the highest word is written. To write several longint values in the area variable, e.g. to simulate an array, there is to hold a distance of 4 (bytes).

Example:

DECLARE Area#
DIM Area #,12
LONG Area #,0 =231056
LONG Area #,4 =510251
LONG Area #,8 = 516
PRINT @LONG(Area #,0)
PRINT @LONG(Area #,4)
PRINT @LONG(Area #,8)
DISPOSE Area #

MCLS DX,DY

DX,DY : Value - Width, Height

An empty memory bitmap with size DX, DY will be created. With CopyBmpToMem or rerouting with StartPaint -1 you can work on this memory bitmap. With MBmpCopy  and MCopySizedBmp any parts of the bitmap can be copied on the screen.

MCopyBmp X1,Y1-X2,Y2 > X3,Y3;N

X1,Y1:	Value : Source upper left
X2,Y2:	Value : Width, Height
X3,Y3:	Value : Target upper left
N:	Value : Copy mode (-1 = transparent)

The part of the screen that begins with X1,Y1 a width of  X2 Pixel and is Y2 Pixel high, will be copied from the picture loaded with MLOADBMP to position X3,Y3.
CAUTION: X2,Y2 are not absolute coordinates but width and height! The last parameter determines the copy mode.

Values for copy mode are:

-1	Transparent
0	Normal copy
1	Source and target are combined with AND
2	Source and target are combined with OR
3	Source and target are combined with XOR
4	Target is inverted (source is not considered)

Copy mode -1 (transparent) signs the lowest left pixel of the bitmap. The color of this pixel (!) will be shown in transparent mode.

MCopySizedBmp X1,Y1-X2,Y2 > X3,Y3-X4,Y4;N

X1,Y1:	Value - upper left edge of the bitmap to copy
X2,Y2:	Value - Size of the source bitmap
X3,Y3:	Value - Upper left edge of the target position
X4,Y4:	Value - Size of the target bitmap
N:	Value - Integer - Copy mode (-1 is NOT allowed)

The part of the (memory) screen that begins with X1,Y1 a width of  X2 Pixel and is Y2 Pixel high, will be copied from the picture loaded with MLOADBMP to position X3,Y3 - X4,Y4.

CAUTION: X2,Y2 are not absolute coordinates but width and height! The last parameter determines the copy mode.

MLoadBMP S

S : String - Picture file name (possibly with path)

The image file S will be loaded to memory, but not displayed. MCOPYBMP allows you to copy parts of the picture (or complete pictures) to the screen.

NOTE: Only one BMP file can be in memory. When calling MLOADBMP, the previously loaded BMP file will be overwritten.

MkDir S

S : String - Path

Directory S will be established. If an error occurs, %IORESULT has another value as 0.

Example:

MkDir "C:\WINDOWS\TEST"

See also: ChDir, RmDir

MoveTo X1,Y1

X1,Y2 : Value - Coordinates

The graphics cursor moves to the indicated position without drawing a line. This command is only useful with the following command LINETO.

Music S

S: String (Notes)

The S parameter is a string with its own macro language. This Macro language is compatible with 
Music-Macro-Language, known from BASIC (for the PLAY command):

A..G	corresponding note
	# 	- Increasing
	+ 	- Increasing
	- 	- Decreasing
	. 	- Pointed (dots)
	n 	- Assigns note length: 4 = quarter, 2 = half, etc. If n is left out the standard length is 		  used.
On	Octave n (0..6) is selected
>	one octave higher
<	one octave lower
Ln	Set the standard length
Pn	Rest in the length n
Tn	Tempo: Number of quarter notes per minute. Default value is 120.
MN	Normal music. Every note will be played 7/8 of time.
ML	Legato. The tones flow together.
MS	Staccato. Every note will be played only 3/4 of time.

To play a scale in quarter notes in the 3 octave, simply use the following command:

MUSIC "O3 C4 D4 E4 F4 G4 A4 B4 > C4"

Increase- and decrease-marks also are possible like pointing (dots):

MUSIC "C#2 F-8 G4."

Breaks have a note value of "P".

For soundcard owners the macro language was expanded: The command MUSIC sends to a existing MIDI output (soundcard or MIDI port). Following macro commands where added:

In	Instrument n (0 ... 127) will be fixed on actual channel.
Kn	Channel n (0..15) will be played.
Vn	The actual channel volume will be set to n (0...127)

Default is channel  0, with instrument 0 (= piano) and volume 100. The expanded functions only work if the MIDI output was installed correctly, otherwise the output is done in PROFAN²-16Bit to the PC speaker and in PROFAN²-32Bit nothing happens.

NextPage

With NEXTPAGE while a printing job (STARTPRINT and ENDPRINT) a new page will be started.

NumWidth N

N: Integer - Minimum width

Minimum size for numerical values. This value is also used by the @STR$ function and the command DrawText. If this string is shorter, it will be filled with spaces. Default is 0.

See also: Decimals

OpenRW #N

#N: File number (1...15)

The file with file number #N will be opened in binary mode for reading and writing. Any bytes of the file can be read (@GetByte) or write (PutByte). @FilePos evaluates the position of the file pointer, with SEEK this position can be set.

More than one byte on one step can be read and written with the help of @BlockRead and WriteBlock, using an area variable.

See also: @BlockRead, WriteBlock and ReWrite, Append, Reset.

Orientation N

N : Integer - Angle (in tenth of degree!)

Sets the angle of the text output activated by the next USEFONT command. (Useful only with TRUE-Type-Fonts.) Any text format on the screen and printer is allowed!

OutP N1,N2

N1 : Integer - Port address
N2 : Integer - Output value

Sends the word value N2% to port N1%. The value will be interpreted as a data word (2 byte / 16 bits). The lower byte is sent to port N1, the higher byte to post N1+1. To send one byte, use OutPB.

The function @INP reads a data word from a port.

OutPB N1,N2

N1 : Integer - Port address
N2 : Integer - Output byte value (0 ... 255)

Sends the byte value N2% to port N1%. The function @INP reads from a port.

CAUTION: This command should only be used if you are familiar with I/O operations. It is required for accessing I/O boards from a program. Incorrect values could result in a Windows crash or could even have a negative impact on the monitor if registers of the graphics adapter are accessed.

Unplanned test of this command could damage your hardware and could result in loss of data!

Parameters VAR [,VAR[,VAR] ...]

VAR - Variable name

Variables will be assigned to the parameters of the Procedure that are known within the procedure. One example is in PROC. The total number of variables should be the same as the number of arguments. It will not be checked, like data types. If necessary, they will automatically be transformed.

See also: Proc

PassWord S

S: String - Password

This function sets the password used with @Pwd$ for coding and encoding of strings.

IMPORTANT:  Encoding only works correctly if the same password was used to code the string. To disable the coding function use PassWord with a blank string:

	PASSWORD ""

INFOMATION: This coding makes it hard to reach data but it is not 100% safe! The sort order of strings is mostly independent of the code function.

Pie X1,Y1-X2,Y2; X3,Y3; X4,Y4

X1,Y1 : Value - upper left
X2,Y2 : Value - lower right
X3,Y3 : Start
X4,X5 : End

A partial circle will be drawn. X1,Y1 and X2,Y2 mark the rectangle that contains the circle, and  mark the rectangle which contains the arc. The other coordinates mark the start and end of the arch.

Play N1,N2,N3

N1 : Value - Note value (0 =break)
N2 : Value - Tempo
N3 : Value - Dots

The note values are counted in half tone steps upward. The time is displayed reciprocally: e.g. 4 means 1/4 note; 2 = 1/2 note. The example shows how to play a half note:

Play 24,2,1

PLAY was expanded for playing sound to the MIDI output: If several note values, separated with semicolons, are given, the notes will be played on several channels at the same time. The channel 1...16 correspond to the MIDI channels, except channel 4 was swapped with channel 10. The drums are found in General MIDI on channel 4. Its easy for creating three voice songs with drums accompaniment.

If tempo is greater than 0 the tones will be played accordingly and the PROFAN² program will wait. If tempo is 0, the tone will be "turned on" the sounds will be played in the background until they are turned off. A tone is turned off setting it with a prearranged minus char.

If tempo is 1 no tone will be created but the values N1...N16 will be interpreted as instruments, allocated to the 16 MIDI channels. The example plays a C-cord (25,27,29) on the church organ (instrument no. 20/ Counting starts here with 0), until a key is pressed.

Play 19;19;19,-1,0
Play 25;27;29,0,0
WaitKey
Play -25;-27;-29,0,0

NOTE: This command works in PROFAN²-16Bit also without a soundcard. If it does not exist, the pc speaker is used. Commands with tempo < 1 will be ignored. If there are several tone values only the first will be played.

PlaySound S,N

S : String - File name (incl. path)
N : Integer - Play mode

A WAV file will be played with the sound card (or the SPEAKER driver). If no sound card is available, nothing happens.

Example:

PlaySound "C:\MMDATA\GONG.WAV",1

Possible values for N:

	0 -	Sound is played in foreground. Program is halted.
	1 -	Sound is played in background. Program is still running.
	8 -	Sound is repeated until a new sound is started.
	16 -	Sound is started if no other sound is played.

Combinations are possible with additions.

PopUp S

S : String - Name of the menu

A pop up menu will be appended to the window menu. If no window menu exists, it will be created.

PopUp "&File"
	AppendMenu "&Open"
	AppendMenu "&Save"
PopUp "&Edit"
	...

Print #N,f;f,f ...

N : Value - File number (1..15)
f : Printable expression

The expression/s will be written in the file marked N. If  a semicolon is placed between the expressions, they will be appended directly, a comma results in a space.

See also ASSIGN, REWRITE, APPEND and CLOSE.

Print f;f,f...

f : Printable expression

The expression/s will be written to the screen.  If a semicolon is placed between the expressions, they will be appended directly, a comma results in a space.

Example:

Print "This is the",N%;". Test"

See also: Locate

Proc <Name> ... EndProc

<Name> : Procedure name

A procedure will be defined, the procedure can be used like a new command in the following program. With the PARAMETERS command you can retrieve the delivered parameters.

Example:

PROC Repeat
  PARAMETERS Text$, Number%
  DECLARE I%
  LET I%=0
  WHILE @LT(I%,Number%)
       PRINT Text$
       INC I%
  WEND
ENDPROC

Repeat "Test text",10

Variables declared via PARAMETERS or DECLARE are only known within the procedure (locally). Variables declared in the main program can be accessed as well (similar to PASCAL). The procedure can quit before reaching the command line ENDPROC by using RETURN; a return value can be transferred to the calling program.

PutByte #N1,N2

#N1: File number (1 - 15)
N2: Integer - Byte value to write (0 ... 255)

Byte N2 will be written at the current file position pointer in the file with the file number #N1. The file position pointer will be incremented by 1 (set to the next byte). If the file position pointer reaches the file end, @EOF(#N) returns -1. Further write operations will size up the file.

See also:: @GetByte

PutClip S

S : String

Writes string S (or numeric value) in the clipboard.

Examples:

PutClip "This is a test!"

PutClip Text$

The clipboard is not cleared before writing.

The clipboard can be used to exchange data with other programs or to remotely control another program.

See also: ClearClip @GetClip$()

Randomize

Resets the random number generator (@RND).

ReadText V,S

V: Area variable (Must be DECLAREd and DIMensioned before)
S: String - File name (incl. path)

The text file S will be read into the area variable V at address (offset) 0. Lines are separated with CR/LF (char 13+10). At the end a zero byte is added. If the text is too long for the area variable (DIM), it will be cut and a warning message appears.

NOTE: To read a whole text file you have to DIMension an area variable with @ADD(@FileSize(...),2)!

Rectangle X1,Y1-X2,Y2

X1,Y1 : Value - upper left
X2,Y2 : Value - lower right

Draws a rectangle within the specified coordinates.

Rem ...

Everything after this is comment. REM is at the beginning of the comment line. For comments after other commands use '.

RemoveMenu N

N: Integer - Number of menu entry

The menu entry with number N will be removed out of the current window menu.

See also: AppendMenu

Rename #N,S

N : Value - File number (1..15)
S : String  - New file name (with path)

Renames the file with number N into S. If S contains a path (with or without a drive number) the file will be moved. Moving is only allowed on the same drive.

Example:

Assign #3,"C:\TEST.DAT"
Rename #3,"C:\UTILS\TOAST.DAT"

RePaint

Repaints the screen. Whenever special command combinations screw up the screen (occasionally in connection with pop-up windows) the repaint command recreates the screen. This is only required for old PROFAN versions.

Reset #N

N : Value - File number (1..15)

The file N will be opened for reading.

Example:

Declare Line$
Assign #2,"TEST.DAT"
Reset #2
WhileNot @Eof(#2)
	Input #2,Line$
	Print Line$
Wend

See also: Rewrite, Append and OpenRW.

Return [<Value>]

Returns from a subprogram or a procedure. You can return a value to the calling program. The value can be found in @$(0), @%(0), @&(0) or @!(0):  PROC Test

PROC Test
	Print "This is a test "
	Return "OK!"
ENDPROC

Print "In main program "
Test
Print "Back again! Result:",@$(0)

If this is a procedure, the return value may also be a local variable.
IMPORTANT: Even though a procedure is quit via RETURN the definition of the procedure must end with ENDPROC.

Rewrite #N

N : Value - File number (1..15)

Opens the file with number N for writing. The existing file contents gets cleared. If the file does not exist it will be created.

Example:

Assign #2,"C:\UTILS\TEST.DAT"
Rewrite #2
Print #2,Line$
Close #2

To extend an existing file,  use the APPEND command.
See also: Reset and OpenRW.

RmDir S

S : String - Directory name

Removes directory S. If there are still files or subdirectories it will not be cleared. After a successful operation %IORESULT contains the value 0.

See also: ChDir and MkDir

RoundRect X1,Y1-X2,Y2; X3,Y3

X1,Y1 : Value - upper left
X2,Y2 : Value - lower right
X3,Y3 : Value - Rounding

Draws a rounded rectangle. X1,Y1 and X2,Y2 describe the rectangle; the additional parameters define the degree of rounding in vertical and horizontal direction.

Run S

S : String - Program name

Calls program S and ends the calling PROFAN program. Any Windows program may be called (even with parameters).

Example:

Run "NOTEPAD HILFE.TXT"

Run "E:\PROFAN\PROFAN DEMO.PRF"

Run "WRITE"

See also: @WinExec and Shell

SaveBmp S,X1,Y1-X2,Y2

S	String - File name (incl  path)
X1,Y1	 Integer - upper left edge
X2,Y2:	Integer - lower right edge

The specified area of the screen is saved as a bitmap file. The file extension ".BMP" has to be specified.

Example:

SaveBmp "TESTPIC.BMP",10,10-200,140

SaveBmpToClip X,Y - DX,DY

X,Y:	Integer - upper left edge
DX,DY	 Integer - Size of the bitmap to save

The specified area of the screen is saved as to the clipboard. From there the bitmap can be used in other programs.

Screen X,Y

X,Y:	Size of the virtual screen

The system of coordinates of the PROFAN² main window or of the window activated with STARTPAINT will be fixed on width X and height Y. All following coordinate values reference to this system of coordinates. This way screen outputs are possible, such as adapting every window size or screen resolution. The line of the following example resets the system of coordinates again to the standard pixel values:

Cls
Screen 3000,2000
Line 10,10 - 2900,1900
Screen Width(%Hwnd),Height(%Hwnd)
WaitInput

ScreenCopy [X1,Y1-X2,Y2]

X1,Y1: Integer - upper left edge
X2,Y2: Integer - lower right edge

Copies the specified area to the printer and prints the page. If no area is specified the whole screen will be printed.

Examples:

ScreenCopy 10,10 - 600,100

ScreenCopy

See also STARTPRINT  ... ENDPRINT and WINCOPY.

Seek #N,A

#N:	File number (1 - 15)
A:	LongInt - Position of the file pointer

The file pointer of the binary (!) opened file with file number #N will be set to position A.

NOTE: Seek #N,@GetSize(#N) sets the pointer after the last byte. The file will be sized up.

Separator

Adds a separator line to a pop-up menu.

Example:

PopUp "&File"
	AppendMenu 100,"&New"
	AppendMenu 101,"&Open"
	AppendMenu 102,"&Save"
	AppendMenu 103,"Save &as "
	Separator
	AppendMenu 104,"&End"

SetAutoPaint N

N: Integer	 0:	AutoPaint is disabled, %wmPaint will be set every time
		1	AutoPaint is enabled, %wmPaint will be set only by dialog windows
		2	AutoPaint is enabled, %wmPaint will be never set (standard)

If a window is sized or moved, parts of the screen must be drawn new. Normally PROFAN² does this work for you, reacting on its own to Windows messages. While drawing inside dialog boxes or dialog windows (see StartPaint - EndPaint), PROFAN² does not need to know about this painting request.

If you draw inside a windows dialog, PROFAN² does not redraw automatically. With SetAutoPaint the repaint message to a dialog window will be set when you leave with WAITINPUT. The system variable %wmPaint will be set. In this case PROFAN² continues redrawing the main window.

There are some cases when advanced programmers will do this on there own. E.g. they want to adapt a background bitmap to the main window. To do this, the automatic screen updating can be disabled with SetAutoPaint 0. Now %wmPaint is also set when the main window must be re-drawn.

The following example shows a bitmap in the size of the main window. It is to quit with "Esc":

	Declare Quit%

	PROC DrawNew
	  MCopySizedBmp 0,0-32,32 > 0,0-Width(%HWnd),Height(%HWnd);0
	ENDPROC

	SetAutoPaint 0
	CLS
	MLoadBmp "TEST.BMP"
	DrawNew

	Let Quit%=0
	WHILENOT Quit%
	  WaitInput
	  IF @Equ(%Key,27)
	    Let Quit% = 1
	  ELSEIF %wmPaint
	 DrawNew
	  ENDIF
	ENDWHILE
	END

SetCheck N1,N2

N1 : Integer - Handle of the window object
N2 : Integer - 1 = set / 0 = reset

Sets/resets a checkbox or a radio button with the handle N1

SetDialogFont  N

N:Integer - Mode (0 = System font / 1 = Selected font)

If N = 1 for the next dialog objects, created with @CREATE... , the font initialized before with USEFONT. Otherwise the system font is used.

SetErrorLevel N

N: Integer - Error level

Sets the error level to any value desired. It defines the system behavior in case of errors or warnings.

Possible values for N:

2 -	Warnings are handled as errors and create an error message followed by a program abort.
1 -	Warnings are displayed but the program may be continued.
0 -	(Default) Warnings are not displayed. This error level should be used in a tested program.
-1 -	Error messages are not displayed and the program continues. This could cause Windows errors or system crashes where you might lose data.

A warning occurs whenever an expression cannot be interpreted as a numeric value, e.g. a bitmap cannot be found ...

SetFAttr #N1,N2

#N1: File number (1...15)
N2: Integer - Attribute(s)

Sets attributes of the file #N. File number #N must be ASSIGNed before but the file mustn’t be opened. A file can be opened with a command like RESET, APPEND, RESET or OPENRW.

The attributes:

	$01 = ReadOnly
	$02 = Hidden
	$04 = SystemFile
	$08 = Label
 	$10 = Directory-Entry
	$20 = Archive

To use several attributes, add them.

SetLFN N

N: Integer - -1, 0 or 1 (only PROFAN²-16Bit)

Determines the use of long filenames:

-1	The system automatically recognizes whether Windows95 (or higher) is active or not
0	Long file names disabled
1	Long file named enabled.

Under Windows 3.x activating of long filenames will produce an system error. Because of this be careful with SetLFN. The command is implemented to allow long file names in such programs where the automatic handling of long file names doesn’t work, e.g. Windows 3.x NT.

If you use SetLFN the system variable %LFN will contain the corresponding value. The result %LFN = -1 this system variable means the automatic recognizing of long file names.

IMPORTANT: In PROFAN²-32Bit the command SetLFN has no effect.

SetMenuItem N

N: Integer - Menu number

The system variable %MENUITEM, also evaluated by the @MENUITEM function, will be set on value N.

SetPixel X,Y,C

X,Y : Value - Coordinates
C   : Value - RGB-Color value

Sets a pixel at position X,Y in the color C (or the color which is the closest to C).

Example:

SetPixel 10,10,@RGB(13,20,3)
SetPixel 11,11,0

SetScrollPos N1,N2

N1: Integer - Scroll bar handle
N2: Integer - Value

The scroll bar value will be set. To read this value the function @GETSCROLLPOS is to use.

SetScrollRange N1,N2,N3

N1: Integer - Scoll bar handle
N2: Integer - lowest value (-32767 - 32767)
N3: Integer - highest value (-32767 - 32767)

SetScrollRange sets the scroll bar bounds. Lowest and highest value, the difference of the value mustn’t be more than 32767! The default scroll bar bounds are 0...100.

SetText N,S

N : Integer - Handle of the window object
S : String  - New text

Assigns the text S to window object with the handle N. In case of input or text fields, S is the  text in the field. For an icon field it is the identifier of the icon, for a button it is the text on the  button, for a window it is the window title, ...

The function @GETTEXT$ reads the information.

This command is only available in the registered version!

SetTimer N - KillTimer

N     : LongInt - Timer interval in milliseconds

A timer will be set. This timer triggers every N milliseconds a new timer event. This event will e.g. cause the application to provide input for the WAITINPUT command  and the system variable %wmTimer is set to 1. If %wmTimer is read, it will be reset. Because the whole numbers of timers in Windows is limited, PROFAN² will only allow one timer. Normally this is sufficient. It’s possible to set an active timer with a new SetTimer command. Before ending a PROFAN² program a timer that is  used by the programmer (set with SetTimer) must be set free with KILLTIMER. The following example shows a loop, that ends after 10 seconds ( = 10000 milliseconds) this example doesn’t put a strain on the CPU:

	PROC Loop
	Parameters N&
	  Declare Quit%
	  SetTimer N&
	  Let Quit % = 0
	  WHILENOT Quit %
	    WaitInput
	    Case %wmTimer:Let Quit % = 1
	  ENDWHILE
	  KillTimer
	ENDPROC

	CLS
	Print "Starting timer ..."
	Loop 10000
	Print "... and go on"
	WaitKey
	End

Information: The timer event is only triggered if the PROFAN² main window exists.
Tip: It is possible to create a invisible PROFAN² main window (Windowstyle 112, Size 0,0-0,0).

SetTrueColor N

N: Integer - 0 or 1

0 - 32768 colors
1 - 16 million colors

PROFAN² uses 32768 colors with its own draw commands as default. The red, green and blue color part can be the values 0...31. With SETTRUECOLORS 1 you can switch up to 16 million colors. After this the color part value can be 0...255.

SetWindowPos W=X,Y-DX,DY

W: Integer - Handle of the window or window object
X,Y: Integer - upper left edge
DX,DY: Integer - New window size

Position and size of the window or window object with handle W will be set new. This command can be used with every Windows object when the handle is known!

Tip: Often it is necessary to change the size of a window object when you do not know the window size. If you don’t know the coordinates of its upper left edge, take advantage of the Windows API like following example:

DEF @GetWindowRect16(2) * "USER","GetWindowRect","%#",""
DEF @GetWindowRect32(2) ! "USER32","GetWindowRect"
Declare Rect#

PROC ReSizeWindow
PARAMETERS hWnd%,wNew%,hNew%
	Declare x%,y%
	Dim Rect#,8
	If %Win32
		@GetWindowRect32(hWnd%,Rect#)
	Else
		@GetWindowRect16(hWnd%,Rect#)
	EndIf
	Let x%=@Word(Rect#,0)
	Let y%=@Word(Rect#,2)
	Dispose Rect#
	SetWindowPos hWnd%=x%,y%-wNew%,hNew%
ENDPROC

Window 10,10-400,300	'PROFAN² main window with handle %HWND
WaitKey
ReSizeWindow %HWND,300,200
WaitKey
END

Shell S

S : String - Program name

Calls program S. The calling PROFAN program continues. Any Windows program can be called (even with arguments).

Example:

Shell "NOTEPAD HELP.TXT"  

See also: Run, @WinExec

ShowCursor N

N : Integer - 0 = hide / 1 = show

1 - Shows the cursor
0 - Hides the cursor

Hides or shows the cursor. In screen savers normally no visible (mouse) cursor is wanted. Every application that hides the cursor should also show it again.

ShowMax

Expands the window to its maximum size. This  command corresponds to the click on the "arrow up" button at the upper right corner of the frame.

ShowMin

Reduces the PROFAN² main window to an icon. The program is still running. It can be enlarged by using SHOWNORMAL or SHOWMAX or by using the appropriate system menu choice.

ShowNormal

Shows the PROFAN² main window in normal size that is the size before the reduction or enlargement.

See also: @ShowWindow

Sound N1,N2

N1 : Value - Frequency in Hertz
N2 : Value - Duration in 360th of a second

Generates a sound in specified frequency and duration. The program pauses while the sound plays. The following line plays an A for one second:

	SOUND 440,360

NOTE: This command doesn’t work in PROFAN²-32Bit under Windows95, because the Window95-API allows no sound output via pc-speaker. Under Window NT it should work.

SQLExec S,N

S - String: SQL command
N - Integer: Result mode

This sends an SQL command to the database. S is the SQL statement and is N the result mode:

0:	The result will be displayed. Each data set is a line and can contain a maximum of 255  	characters.
1:	The result is written to the list box list and can then be viewed with the @LISTBOX$ 	function. Each data set is an entry in the list and can contain a maximum of 255 	characters, max. 10000 data sets  fit in one list. 
2:	The result will be written to the file "SQL.DAT" created in the current path. Each data set is  	one line. 

&SQLCOUNT returns the number of processed data sets or 1 if an error occurred.

Example:

SQLEXEC "SELECT * FROM CUSTOMER",1

SQLSetNULL S

S - String: Zero value

Determines that the ZERO is displayed as S in the result. A data set field has value ZERO if no value  was assigned. ZERO stands for nothing.

SQLSetDel S

S - String: Separator char

Determines which character separates the fields in the result. The default is "|". If S is 2 characters,  the second determines which character bounds the field entries. If the default is the blank string, the  second character is only effective when the result of the SQL command is sent to a file (Mode 2.). For  example, if you want the result, the file displays the field entries in quotes and the fields are  separated by commas. S$ has to contain the symbols and ":"

	SQLSETDEL @ADD$(",",@CHR$(34))

SQLDone

The command ends the connection to the SQL server and frees the memory occupied by ODBC.DLL.

StartPaint H - EndPaint

H:	Integer - Handle of the window where to draw / -1 = Memory bitmap

With this command screen outputs to another window, e.g. a dialog box or dialog window can be rerouted. (Excluded are commands for the PROFAN² text mode: LOCATE, PRINT, TBOX,...). With StartPaint it’s possible to draw, show text or a bitmap. etc. in windows if the handle is known.

IMPORTANT: Every StartPaint must (!) follow an EndPaint command. After EndPaint outputs will be shown in the PROFAN² main window again. While painting/drawing (using StartPaint) StartPrint - EndPrint is not allowed.

If the handle is given as -1 the output comes to a "invisible" window, the memory bitmap. This memory bitmap is created with MCLS or MLOADBMP before.

While drawing in dialog boxes or dialog windows pay attention that  the drawings will not repaint automatically, e.g. when another window covers the dialog. Also if AutoPaint is enabled, dialog boxes and dialog windows create a wm_Paint-message: A WaitInput will be left and the system variable %wmPaint is set to 1.

If AutoPaint is disabled with SetAutoPaint 0, it makes sense (but it is not necessary) to do all outputs in the PROFAN² main window with StartPaint - EndPaint. In this case, the system variable %HWND should be used.

StartPrint [S] ... NextPage ... EndPrint

Between these two commands all graphic screen output commands (DRAWTEXT, RECTANGLE, ...) are sent to the printing page. "Text mode" and bitmap commands are prohibited, but LOADBMP and LOADSIZEDBMP will work normally and are perfect to print bitmap graphics. ENDPRINT starts to print the page. The print page has a width of 640 dots and a length of 960 dots.(The printer should be set up as DIN A4 portrait.) While printing (using StartPrint) StartPaint - EndPaint is not allowed.

You are free to set with the string parameter S a name for the printing job. This name replaces the Windows standard name used by the print manager.

With NEXTPAGE while a printing job a new page will be started.

String V,A=S

V: Area variable (Must be DECLAREd and DIMensioned before)
A: Integer - Address inside the area variable (offset)
S: String

String S will be stored in the area variable V at address (offset). The end of the string is signed with a zero-byte (added!). If there is not enough space (allocated with DIM) to store the string (and the zero-byte) it will be cut. If A is out of the memory area of V an error message appears.

NOTE: If you want to write several strings in one area variable be careful the strings do not overlap. Don’t forget: Every string gets an additional zero-byte to sign the string end.

StrWidth N

N: Integer (Minimum length)

Sets the minimum length for strings (for the PRINT command). Strings shorter than N are lengthened according to the preceding blanks. Default value is 0 (= standard string behavior).

Sub VAR,N

VAR - Variable name (value)
N   - Integer

N2 will be subtracted from N1. (This is faster than the @SUB function)

Example:

SUB Points%,10

SubPopUp  ... EndSub

From PROFAN² 6.0 up it’s possible to create sub menus. A menu-nesting up to a depth of 10 is allowed.

Example:

...
AppendMenu 210,"&Choice 3"
SubPopUp "&Fonts..."
	AppendMenu 211,"Font &1"
	AppendMenu 212,"Font &2"
	...
EndSub
AppendMenu ...

TBox X1,Y1 - X2,Y2; N

X1,Y1 :	Value - upper left edge
X2,Y2 :	Value - lower right edge
N:	Frame type

Draws a box in text mode. The coordinates are specified in characters (similar to  LOCATE). The command uses the semigraphic characters of the OEM character set.

0 - Single frame
1 - Double frame
2 - Vertical double/horizontal single
3 - No frame

TextColor C1,C2

C1 : Value - Foreground color (RGB)
C2 : Value - Background color (RGB)

Sets the colors for the DRAWTEXT output. The value -1 corresponds to a transparent background color i.e. the existing background is used.

Example:

TextColor @RGB(15,15,31),-1
DrawText 23,67,"Hugo was here!"

TraceON

TRACEON switches to the TRACE mode. Before a line is processed it will be displayed in a message box. You can cancel the program with "Cancel". This command is only useful in the interpreter and does not  work in the runtime module or in compiled programs.

TraceOFF

TRACEOFF turns the TRACE mode off.

TrackMenu X,Y

X,Y : Value - Position

Shows the menu created  with CREATEMENU and APPENDMENU at the desired position and expects a choice. The result is in %MENUITEM.

Example:

TrackMenu 20,130
Case %MenuItem(100):Gosub "Saving"
Case %MenuItem(120):End

UseBrush N,C

N : Value - Type of the brush
C : Value - Color of the brush (RGB)

The brush is used to fill graphics (RECTANGLE, ROUNDRECT, etc.). C is the used RGB color (0 ... 32767), N defines the brush type:

0 :	Transparant (not filled)
1 :	Solid (filled)
2 .. 8:	different shades

Shades:

2 -	horizontal =====
3 -	vertical |||||
4 -	diagonal  \\\\\
5 -	diagonal  /////
6 -	checkered   #####
7 - 	diag. check. XXXXX

The shades are executed in color C.

UseCursor N

N : Value - Cursor type (0 .. 11)

Changes the mouse cursor type. There are all 11 Windows mouse cursor types available and an additional printer symbol (while printing). The hourglass cursor should be used whenever the user has to wait, e.g. while saving and loading.

The options for N:

0 -	Cursor (Standard)
1 -	Text entry (vertical line)
2 -	Hourglass (Please enter ...)
3 -	Spider lines
4 -	Large vertical arrow
5 -	Quadruple arrow (+)
6 -	Icon (little square in larger square)
7 -	Double arrow (\)
8 -	Double arrow (/)
9 -	Double arrow (-)
10 -	Double arrow (|)
11 -	Printer

See also: ShowCursor

UseExtCursur I,S

I:	Integer - Instance handle of the EXE or DLL, containing the cursor
S:	String - Cursor name

@UseDLL returns the instance handle for DLLs and @WinExec for EXE files. %HINSTANCE contains the handle of the running PROFAN² program (interpreter or runtime, linked or not). It’s also possible to put all in one program used mouse cursors with a tool like Borland´s Resource-Workshop into a DLL. E.g. it is no problem to expand PROFRUN.EXE before (!) linking it with a PROFAN² PRC-code and then use the new resources.

See also: UseCursor, ShowCursor

UseExtMenu I,S

I:	Integer - Instance handle of the EXE or DLL, containing the menu
S:	String - Name or number of the menu

@UseDLL returns the instance handle for DLLs and @WinExec for EXE files. %HINSTANCE contains the handle of the running PROFAN² program (interpreter or runtime, linked or not). It’s also possible to put all in one program used menus with a tool like Borland´s Resource-Workshop into a DLL. E.g. it is not a problem to expand PROFRUN.EXE before (!) linking it with a PROFAN² PRC-code and then using the new resources.

UseFont S,N1,N2,N3,N4,N5

S  : String - Font name
N1 : Value - Character height
N2 : Value - Character width
N3 : Value - Bold? (0 .. 1)
N4 : Value - Italic? (0 .. 1)
N5 : Value - Underline? (0 .. 1)

Sets the font for text output by DRAWTEXT.

N1:	Character height. If this value is 0, a default value will be set for width and height.
N2:	Character width. If this value is 0, a default value will be used.
N3:	1 = bold , 0 = standard
N4:	1 = italic, 0 = standard
N5:	1 = underline, 0 = standard

UseIcon S

S : String - Icon name

Chooses the icon that is used whenever the program is minimized. Default is the profan icon. Any of the build-in 18 icons ("ICON01" - "ICON18") can be used.

UsePen N1,N2,C

N1 : Value - Line type (0 .. 5)
N2 : Value - Line width
C  : Value - RGB color

Sets the values for frames and/or lines used be the graphics commands.

Example

UsePen 1,5,@RGB(0,0,31)
Rectangle 10,10 - 150,100

Line types:

0 __________
1 _ _ _ _ _ _
2 ............
3 _._._._._.
4 _.._.._..
5 no line

Values 1 through 5 are only useful with a line width of 1.

WaitInput

Waits for mouse click or key stroke in the PROFAN window. The result is put in the system variables 
%MOUSEKEY, %MOUSEX, %MOUSEY, %SCANKEY and %KEY.

WAITKEY and WAITINPUT wait on a key stroke and also react to the following events and set %KEY with corresponding values:

1	An entry in a listbox or a choicebox was selected
2	In a dialogbox or dialog window the system menu was double-clicked or the menu entry 	"Close" was selected.
4	A window in the PROFAN² program was sized.
5	F1 was pressed while the focus was on a dialog object or inside a dialog box. %GetFocus 	contains the object handle as negative value.
13	In a one-line editbox the key <Enter> was pressed.
255	A button, a checkbox or a radiobutton was clicked.

WaitKey

Waits for a key stroke. The results can be found in the system variable %KEY. (Function key, 
so-called "virtual key code" are not recognized. If this is required, use the WAITSCAN command.)

WaitMouse

Waits for a mouse key stroke (within the PROFAN window). The key and the position can be found in the system variables %MOUSEKEY, %MOUSEX and %MOUSEY.

WaitScan

Waits for any key stroke. Function keys, cursor keys, shift and ctrl keys are recognized. The result is located as virtual key code in the variable %SCANKEY or - in the case of a standard key - as ANSI code in %KEY.

Important scan codes:

	16 -	Shift
	17 -	Ctrl
	27 -	Esc
	33 -	Page Up
	34 -	Page Down
	35 -	End
	36 -	Home
	37 -	Left
	38 -	Up
	39 -	Right
	40 -	Down
	45 -	Ins
	46 -	Del
	112 -	F1
	... -	...
	123 -	F12

The other scan codes can be easily determined by using the following program:

Cls
While 1    'Endless loop!
	WaitScan
	Print %ScanKey
Wend
End

While N ... EndWhile

N : Value - Conditional expression

The commands between WHILE and WEND are repeated until N equals 0.

Example:

While N%
	Print "Enter any number:";
	Input N%
Wend

Instead of ENDWHILE also  WEND - known from Basic - is allowed.

Tip: In PROFAN² exists no For/Next-Loop like in Basic. You have to use While...EndWhile to "simulate" the For/Next-Loop:

To get a Basic code like this:

	For Count% = 1 To 100
		'...
	Next Count%

take this PROFAN² code:

	Declare Count%
	Let Count%=1
	WhileNot @GT(Count%,100)
		'...
		Add Count%,1	'Don’t forget this command,
	EndWhile		'otherwise it’s an endless loop!

WhileNot N ... EndWhile

N : Value - Conditional expression

The commands between WHILENOT and WEND are repeated as long as N equals 0.

Example:

WhileNot @Eof(#2)
	Input #2,Line$
	Print Line$
Wend

Window X1,Y1-X2,Y2

X1,Y1 : Value - upper left edge
X2,Y2 : Value - Size in pixel

Opens the PROFAN² main window (handle %HWND) in the specified size. X1 and Y1 are absolute screen coordinates. Every program that outputs in the main window or the PROFAN program must open that window with the WINDOW or CLS command. If CLS is used to open the window, PROFAN uses the entire (standard VGA) screen (649 * 480 pixels).

NOTE: If the PROFAN² main window already exists it is changed corresponding to the parameters of WINDOW.

WindowStyle N

N : Value - Window style (0 ... 255/512)

The style of the program window will be set. The following characteristics can be defined:

1 	- Window can be enlarged
2 	- Window can be minimized to icon
4 	- Thick frame (size of window is variable)
8 	- Window has system menu
16 	- Window has no menu (also no ©)
32 	- Window uses screen background as window background
64 	- Window has no headline
128 	- Program cannot be quit by using <Ctrl-Esc>, <Alt-Tab> or <Alt-F4>.
512#	- Dialog window style for the PROFAN² main window

Combinations can be created by adding the values. The command must occur before the first opening of the program window! The following example sets the screen background as window background.

Example:

WindowStyle 31

Perfect for screen savers:

WindowStyle $F0

Dialog window style (512 / $200) allows dialog objects to react inside the PROFAN² main window the same way as in dialog window: You can switch with TAB between these objects. Also you can check with %KEY = 2 whether the main window is closed by clicking the close-button. This is also under Windows95. A standard window with dialog characteristics has e.g. style $20F. Styles $100 (256) and $80 (128) are nor to use with the new style. The style $200 (512) is to use when a program creates dialog objects in the PROFAN² main window.

NOTE: Under Windows95 not all style combinations make sense. Minimize and maximize icons will only be shown if a system menu exists.

(The command only exists in the registered version!)

WindowTitle S

S : String

Sets the title of the program window. Example:

Example:

WindowTitle "My first program"

If no title is set the default title is used.
(This command only exists in the registered version!)

WinCopy W

W: Integer - Handle of the window to print

The window with the handle W will be printed completely and with greatest size possible. Using WINCOPY %DESKTOP the whole screen can be printed. WINCOPY %HWND works on the main window  of a Profan² program. WinCopy prints the whole window in opposite to SCREENCOPY that prints only the client area of a window, without the frame. You can print every (!) window when the handle is known.

WinHelp S1,S2

S1: String - Name of the Windows help file (with extension)
S2: String - Search expression 

Calls the Windows help program to load the help file S1. S1 must include the file extension (mostly *.HLP) and might contain a path. The second parameter S2 means the key-word of the help part to show. So, a context-sensitive help is possible to create.
If S1 is a blank string the help starts with the search dialog!
If S2 is a question mark ("?"), the "help for the help", if S1 is a star ("*"), the contents of the help file will be shown.

Word V,A=N

V: Area variable (Must be DECLAREd and DIMensioned before)
A: Integer - Address inside the area variable (offset)
N: Integer - Value (0 .. 65535)

The word value (16bit value = 4 byte) at address (offset) in the area variable V will be set to the value N. Is the address A out of the area value given with DIM before, an error message occurs.

NOTE: Because 2 bytes are written, addresses A to A+2 are used. At A the lowest, at A+2 the highest byte is written. To write several integer values in the area variable, e.g. to simulate an array, there is to hold a distance of 4 (bytes).

Example:

	DECLARE Area#
	DIM Area #,6
	WORD Area #,0 =1056
	WORD Area #,2 =10251
	WORD Area #,4 = 516
	PRINT @WORD(Area #,0)
	PRINT @WORD(Area #,2)
	PRINT @WORD(Area #,4)
	DISPOSE Area #

WriteIni S1,S2,S3=S4
S1: String - Name of INI file (including path) / Registry-Class (32 Bit)
S2: String - Application/Paragraph /Section/Registry-Path (32 Bit)
S3: String - Entry (registry key)
S4: String - Value of the entry

Creates or changes an entry in an INI file. If the INI file does not exit it will be created in the specified 
directory or in the Windows directory.

Example:

In file GAME.INI under application[MyProgram] the entry: "HIGHSCORE=25000" should be set:

LET HighScore& = 25000
WRITEINI "GAME.INI","MyProgram","HIGHSCORE"=@Str$(HighScore&)

It is recommended to create an INI file for every program instead of filling the WIN.INI file.

In PROFAN²-32Bit additional it is possible to write values to the Windows Registry (registry data base). In this case, the first parameter means the registry-class, "HKEY_0" ... "HKEY_6":

    HKEY_CLASSES_ROOT     = HKEY_0
    HKEY_CURRENT_USER     = HKEY_1
    HKEY_LOCAL_MACHINE    = HKEY_2
    HKEY_USERS            = HKEY_3
    HKEY_PERFORMANCE_DATA = HKEY_4
    HKEY_CURRENT_CONFIG   = HKEY_5
    HKEY_DYN_DATA         = HKEY_6

S2 contains full path information. S3 means the entry (registry key) to write. If the path and/or entry exists it the corresponding values are will be changed, otherwise it will be created. S4 means the entry value. Singles entries of the registry path are separated with a backslash (analog directories).

In a 32Bit program the game could save the Highscore value this way:

LET HighScore& = 25000
WriteIni "HKEY_1","RGH-Soft\Games\MyProgramm", \
         "High-Score"=@Str$(HighScore&)

To save additional options you could use the same registry-path but another entry, e.g. for soundcard characteristics:

WriteIni "HKEY_1","RGH-Soft\Games\MyProgramm","Sound"="ON"

In PROFAN²-16Bit this last command line wouldn’t produce an error but create an INI file named "HKEY_1" in the Windows directory with the corresponding entry. This could be the programmers intention because it’s possible to write programs running under 32Bit using registry and 16Bit using INI files. For this reason instead of long class names PROFAN² uses short versions HKEY_0 ...HKEY_6.

CAUTION: Be careful while writing to existing registry entries! The same way as it is possible to produce problems in Windows changing SYSTEM.INI or WIN.INI, there are many bad changes possible to create troubles under Windows95/NT.

4. Important Messages

In PROFAN² messages are sent with the function:

	@SendMessage(N1,N2,N3,N4)

N1 is the window or object receiving the message. N2 is the message number, given in hexadecimal notation in the following lists. N3 (Integer in 16Bit / LongInt in 32Bit) and N4 are parameter corresponding to the messages. If not needed, they are set zero.

Note for PROFAN²-32Bit

The following information has been tested under 16Bit. Most should work under 32Bit the same way. In some cases parameters must be set with other values. In case of doubt see the corresponding Windows programming documentation... or try. Dialog objects use different message numbers in 16 and 32Bit. Therefore both numbers are listed:

Button messages

These messages can be used with all kinds of buttons, including radio buttons and checkboxes.
CAUTION: Do not use these messages with other Windows objects. The same numbers have different meanings on other objects!

The first value is for PROFAN²-16Bit, the second for PROFAN²-32Bit.

bm_GetCheck = $0400 / $00F0

Evaluates if the radio button or checkbox is marked or not.

Return value: 0 = not marked; >0 = marked

bm_GetState = $0402 / $00F2

Evaluates the button status.

Return value: 0 = not pressed; >0 = pressed

bm_SetCheck = $0401 / $00F1

Marks a radio button or a checkbox.

N3: 0 = don´t mark; 1 = mark

bm_SetState = $0403 / $00F3

Set the button status.

N3: 0 = normal; 1 = emphasized

ComboBox Messages

Messages like these can be  to used with all kinds of comboboxes, also including the choicebox supported in PROFAN². Other combobox types e.g. allow entering values in the first line or show both combobox parts at the same time: edit field and listbox.
CAUTION: Do not use messages like these with other Windows objects. The same numbers have different meanings on other objects!

The first value is for PROFAN²-16Bit, the second for PROFAN²-32Bit.

cb_AddString = $0403 / $0143

Adds a string to the combobox list. The string is stored in an area variable.

N4: Area variable = String to add
Return value: <0 = Failure

Example:

	Let S$ = "This is a test!"
	String V#,0 = S$
	@SendMessage(W%,$0403,0,V#)

W% means the combobox handle.

cb_DeleteString = $0404 / $0144

Deletes a string out of a combobox list.

N3: Index of the string to delete (first string/line = 0)
Return value: <0 = Failure

cb_Dir = $0405 / $0145

Adds a list of files from the current directory to the choicebox list. The selection can take account of a file attribute (see @GetFAttr). For additional drive listing add $4000 to the attribute value. An area variable contains the search mask.

N3: Integer	 	= File attribute
N4: Area variable		= File search mask (e.g. "*.*")
Return value:	<0	= Failure (e.g. not enough space in the list)
		>=0 	= Index of the last entry (first entry/line = 0)

Example:

	Let S$ = "*.*"
	String V#,0 = S$
	@SendMessage(W%,$0405,$4037,V#)

W% means the combobox handle. To create a only drive list, set N3=$4000.

cb_FindString = $040C / $014C

Evaluates an entry starting with the search string.

N3: Integer = Index of the entry before(!) the search starts (-1 = start at the beginning)
N4: Area variable = Search string
Return value	 <0 = Failure (not found)
 		>=0 = Index of the found entry (first entry/line = 0)

cb_GetCount = $0406 / $0146

Evaluates the numbers of entries in the list.

Return value: Index of the last entry. (first entry/line = 0)

cb_GetCurSel = $0407 / $0147

Index of the current selected entry.

Return value: Index of the entry (first entry/line = 0).

cb_GetLBText = $0408 / $0148

Copies a string out of the list to an area variable.
CAUTION: The ending zero-byte must be set manually with the help of the return value.
NOTE: The area variable must DIMensioned enough.

N3: Integer = Index of the entry wanted to read
N4: Area variable = Area variable to store the string
Return value: String length

cb_GetLBTextLen = $0409 / $0149

Evaluates the string length of a string in the list.

N3: Integer = Index of the string wanted
Return value: String length.

cb_ResetContent = $040B / $014B

Deletes the complete list of the combobox.

cb_SetCurSel = $040E / $014E

Selects an entry and scrolls it to the visible display area.

N3: Integer = Index of the entry wanted
	-1: No entry will be selected

cb_SelectString = $040D / $014D

Evaluates an entry starting with the search string. The entry will be marked and scrolled to the visible display area.

N3: Integer	= Index of the entry before(!) the search starts (-1 = start at the beginning)
N4: Area variable	= Search string
Return value	 <0 = Failure (not found)
 		>=0 = Index of the found entry (first entry/line = 0)

cb_ShowDropDown = $040F / $014F

Shows the list of a combobox.

N3: 1 = Show list; 0 = Close list

Edit Messages

Messages like these can be used with all kinds of edit fields.
CAUTION: Do not use messages like these with other Windows objects. The same numbers have different meanings on other objects!

The first value is for PROFAN²-16Bit, the second for PROFAN²-32Bit.

em_CanUndo = $0416 / $00C6

Evaluates whether an editfield is able to react to an em_Undo message or not.

Return value: 0 = is not able; 1 = is able

em_GetModify = $0408 / $00B8

Evaluates, whether an editfield was changed or not.

Return value: Changing flag

em_LimitText = $0415 / $00C5

Sets the maximum number of chars stored in n editfield.

N3: Number of chars (0 = no limit)
Return value: 0 = Failure

em_SetModify = $0409 / $00B9

Sets the changing flag.

N3: Changing flag

em_SetReadOnly = $041F / $00CF

Set an editfield to only-read status.

N3: 1 = Only-read; 0 = Read + Write

em_Undo = $0417 / $00C7

Undo of the last edit field action.

Return value: 0 = Undo didn’t work

Listbox Messages

Messages like these are only to be  used with listboxes.
CAUTION: Do not use these messages with other Windows objects. The same numbers have different meanings on other objects!

The first value is for PROFAN²-16Bit, the second for PROFAN²-32Bit.

lb_AddString = $0401 / $0180

Adds a string to the listbox list. The string is stored in an area variable.

N4: Area variable = String to add
Return value: <0 = Failure

Example:

	Let S$ = "This is a test!"
	String V#,0 = S$
	@SendMessage(W%,$0403,0,V#)

W% means the listbox handle.

lb_DeleteString = $0403 / $0182

Deletes a string out of a listbox list.

N3: Index of the string to delete (first string/line = 0)
Return value: <0 = Failure

lb_Dir = $040E / $018D

Adds a list of files from the current directory to the listbox list. The selection can take account of a file attribute (see @GetFAttr). For additional drive listing add $4000 to the attribute value. An area variable contains the search mask.

N3: Integer 		= File attribute
N4: Area variable		= File search mask (e.g. "*.*")
Return value:	<0	= Failure (e.g. not enough space in the list)
		>=0	= Index of the last entry (first entry/line = 0)

Example:

	Let S$ = "*.*"
	String V#,0 = S$
	@SendMessage(W%,$0405,$4037,V#)

W% means the listbox handle. To create a only drive list, set N3=$4000.

lb_FindString = $0410 / $018F

Evaluates an entry starting with the search string.

N3: Integer = Index of the entry before(!) the search starts (-1 = start at the beginning)
N4: Area variable = Search string
Return value	 <0 = Failure (not found)
 		>=0 = Index of the found entry (first entry/line = 0)

lb_GetCount = $040C / $018B

Evaluates the numbers of entries in the list.

Return value: Index of the last entry. (first entry/line = 0)

lb_GetCurSel = $0409 / $0188

Index of the current selected entry.

Return value: Index of the entry (first entry/line = 0).

lb_GetText = $040A / $0189

Copies a string out of the list to an area variable.
CAUTION: The ending zero-byte must be set manual with the help of the return value.
NOTE: The area variable must DIMensioned enough.

N3: Integer	= Index of the entry wanted to read
N4: Area variable	= Area variable to store the string
Return value	= String length

lb_GetTextLen = $040B / $018A

Evaluates the string length of a string in the list.

N3: Integer = Index of the string wanted
Return value: String length.

lb_ResetContent = $0405 / $0184

Deletes the complete listbox list.

lb_SelectString = $040D / $018C

Evaluates an entry starting with the search string. The entry will be marked and scrolled to the visible display area.

N3: Integer = Index of the entry before(!) the search starts (-1 = start at the beginning)
N4: Area variable = Search string
Return value	 <0 = Failure (not found)
 		>=0 = Index of the found entry (first entry/line = 0)

lb_SetCurSel = $0407 / $0186

Selects an entry and scrolls it to the visible display area.

N3: Integer = Index of the entry wanted
	-1: No entry will be selected

lb_SetHorizontalExtend = $0415 / $0194

Normally the real listbox width corresponds to the width displayed on the screen. There is no horizontal scroll bar. The message lb_SetHorizontalExtend sets the listbox width in pixel. When this width is more than the displayed area the listbox contains a horizontal scroll bar.

N3: Integer = Listbox width in pixel

General Windows Messages (Numbers are for 16 and 32Bit)

wm_Clear = $0303

Deletes the current selection in a window.

wm_Close = $0010

Closes the concerning window.

wm_Copy = $0301

Copies the marked part to the clipboard.

wm_Cut = $0300

Copies the marked part to the clipboard. The marked text will be killed.

wm_GetText = $000D

Evaluates the text of a control object and stores it in an area variable. This must be DIMensioned enough.
CAUTION: The ending zero-byte must be set manually with the help of the return value.

This message corresponds to the PROFAN² function @GetText. The message wm_GetText does not have the limitations of the function @GetText on the amount of characters that can be read, it’s possible to read text longer than 255 chars.

N3: Integer	= Maximum number of chars to read
N4: Area variable	= Area variable to contain the text
Return value	= Number of chars read

wm_GetTextLength = $000E

Evaluates the string length of the control object.

Return value: Text length in bytes.

wm_Paint = $000F

Requests the window to redraw.

wm_Paste = $0302

Fits data from the clipboard to the window at the current mouse position.

wm_SetFont = $0030

Sets the font for a window or window object. This way editfields, lisboxes, buttons, etc. can be given a freely selected font. The PROFAN² system variable %FONT contains the handle of the last font set (UseFont).

N3: Integer = Font handle (0 = System font)
N4: >0 = Object to redraw

NOTE: PROFAN² manages only two fonts in one dialog (see SetDialogFont). If you want to use several fonts at the same time you have to load the fonts via Windows-API to get more font handles at the same time. For further information see the Windows programming documentation.

wm_SetText = $000C

A windows object is given the text stored in an area variable. This message corresponds to the PROFAN² function SetText. The Message wm_SetText does not have the limitations of the function SetText on the amount of characters that can be read, it’s possible to read text longer than 255 chars.

N4: Area variable = Contains text (zero-byte!)

wm_Undo = $0304

Breaks the last action (e.g. cut or paste).

Programming for Users

P R O F A N ²   6.0

THE easy programming language 
for Windows 3.x and Windows 95/NT

Appendix

APPENDIX 1: Error Messages

Following error messages and warnings will be produced by the interpreter or compiler and the runtime-system:

Program Structure

100 : 	System variable unknown
101 : 	Function unknown
102 : 	Command unknown
103 : 	Integer variable expected!
104 : 	File number expected!
105 : 	Table number expected!
106 : 	ENDIF or ELSE not found!
107 : 	ENDIF not found!
108 : 	While/EndWhile-Nesting to deep!
109 : 	ENDWHILE or WHILE not found.
110 : 	WHILE missing!
111 : 	GOSUB/PROC missing!
112 : 	PROC missing!
113 : 	Label not found!
114 : 	GOSUB/PROC nesting to deep!
115 : 	ENDPROC not found!
116 : 	"DIM%" is only allowed one time!
117 : 	"DIM&" is only allowed one time!
118 : 	"DIM$" is only allowed one time!
119 : 	"DIM!" is only allowed one time!
120 : 	STARTPRINT missing!
121 : 	Area variable expected!
122 :	Variable name incorrect:
123 :	Variable name to long:
124 :	STARTPAINT missing!
125 :	SUBPOPUP missing!

Incorrect/missing parameters

200 : 	Incorrect function value!
201 : 	Division by 0!
202 : 	Wrong type for @DTOC$ !
203 : 	Wrong type for @CTOD$ !
204 : 	String index is < 1 !
205 : 	Substring-No is < 1 !
206 : 	Such number of elements does not exist!
207 : 	Area variable exceed:
208 : 	Command line parameter missing!
209 : 	File not found:
210 : 	File number out of allowed area!
211 : 	Numbers of parameters must be 0...12!
212 : 	To less parameters!
213 : 	Function argument missing!
214 : 	No numeral:
215 : 	Variable not declared:
216 : 	Wrong parameter type:
217 : 	Not enough memory for all integer variables!
218 : 	Not enough memory for all longint variables!
219 : 	Not enough memory for all string variables!
220 : 	Not enough memory for all float variables!
221 : 	During printing not allowed!
222 : 	Box not inside the window!
223 : 	Negative window size!
224 : 	ICON not found:
225 : 	ICON does not exist! (Only 0..4)
226 : 	Failure while menu creation!
227 : 	Menu nesting too deep!
228 : 	Bitmap could not be loaded:
229 : 	Bitmap could not be saved:
230 : 	Cursor does not exist! (Only 0..11)
231 : 	Only 0... 9999 elements are allowed!
232 : 	To many elements!
233 : 	This element does not exist!
234 : 	Failure while tone creation!
235 : 	Printing is not possible!
236 : 	Failure while HardCopy!
237 : 	This command needs a window!
238 : 	String end missing!
239 : 	Not enough memory for all area variables!
240 : 	Not enough memory for the area variable!
241 : 	Area variable already DIMensioned!
242 : 	Incorrect window handle!
243 : 	Area variable not DIMensioned!
244 : 	Text too long for area variable!
245 :	Number of parameters is different to parameter description!
246 : 	Incorrect parameter type in parameter description!
247 : 	Failure while loading DLL:
248 :	Function does not exist in DLL:
249 :	Prohibited between STARTPAINT/ENDPAINT:
250 :	SETTIMER missing!
251 :	TIMER is already set!
252 :	Menu can not load:
253 :	Not enough memory for all area variables!
254 : 	Maximum three dimensions are allowed!

IO Errors

300 : 	File not readable:
301 : 	File can not be created:
302 : 	Failure while reading:
303 : 	Failure while writing:
304 :	PROF16.EXE not executable or missing!
305 : 	REGISTRY:

ODBC Errors and messages

500 : 	ODBC not initialized!
501 : 	Failure while ODBC-initialization!
502 : 	ODBC.DLL not found!
503 : 	ODBC-Error
504 : 	Records worked on!
505 : 	Operation successful!
506 : 	Result file can’t be opened!
507 : 	Result amount to great!

Data Base Error

600 : 	dB-Error:
601 : 	File not found
602 : 	Double field name
603 : 	Incorrect field length
604 : 	Incorrect decimal places
605 : 	Index file incorrect
606 : 	Field not found
607 : 	File name incorrect
608 : 	Key field incorrect
609 : 	Table number out of allowed area!
610 : 	Table number not set before!
611 : 	Formula incorrect
612 : 	Field not found while reading
613 : 	Field number not found while reading
614 : 	Field for write not found
615 : 	Field number for write not found
616 :	Index file name incorrect:

Miscellaneous Errors

900 : 	This command does not exist in the shareware version!
901 : 	Only 32767 / 16380 lines are allowed!
902 : 	Line to long (max. 254 chars)!
903 : 	INCLUDE-file not found!
904 : 	INCLUDE-nesting prohibited!
905 : 	No correct PROFAN² file!
906 : 	Program file incorrect!

APPENDIX 2: Messages

Some messages, that should be especially interesting for PROFAN² programmers, are located in chapter 4 of this reference and in the PROFAN² online-help where a detailed description is given.

For Parameter and functions of other messages you should locate and read the special Windows programming documentation or corresponding literature on the market.

Normally messages are called by names. Because of this in the following lists, message numbers are classified to message names.

The following lists of messages might not be complete. Some messages where added, especially under Windows95.

General Windows Messages (Number are for 16 and 32 bit)

$0007 	:  wm_SetFocus
$0008 	:  wm_KillFocus
$000A 	:  wm_Enable
$000B 	:  wm_SetRedraw
$000C 	:  wm_SetText
$000D 	:  wm_GetText
$000E 	:  wm_GetTextLength
$000F 	:  wm_Paint
$0010 	:  wm_Close
$0011 	:  wm_QueryEndSession
$0012 	:  wm_Quit
$0013 	:  wm_QueryOpen
$0014 	:  wm_EraseBkGnd
$0015 	:  wm_SysColorChange
$0016 	:  wm_EndSession
$0018 	:  wm_ShowWindow 
$0019 	:  wm_CtlColor
$001A 	:  wm_WinIniChange
$001B 	:  wm_DevModeChange
$001C 	:  wm_ActivateApp
$001D 	:  wm_FontChange
$001E 	:  wm_TimeChange 
$001F 	:  wm_CancelMode
$0020 	:  wm_SetCursor
$0021 	:  wm_MouseActivate
$0022 	:  wm_ChildActivate
$0023 	:  wm_QueueSync
$0024 	:  wm_GetMinMaxInfo
$0026 	:  wm_PaintIcon
$0027 	:  wm_IconEraseBkGnd
$0028 	:  wm_NextDlgCtl
$002A 	:  wm_SpoolerStatus
$002B 	:  wm_DrawItem 
$002C 	:  wm_MeasureItem
$002D 	:  wm_DeleteItem
$002E 	:  wm_VKeyToItem
$002F 	:  wm_CharToItem
$0030 	:  wm_SetFont
$0031 	:  wm_GetFont

$0037 	:  wm_QueryDragIcon
$0039 	:  wm_CompareItem
$0041 	:  wm_Compacting
$0044 	:  wm_CommNotify
$0046 	:  wm_WindowPosChanging
$0047 	:  wm_WindowPosChanged

$0081 	:  wm_NCCreate
$0082 	:  wm_NCDestroy
$0083 	:  wm_NCCalcSize
$0084 	:  wm_NCHitTest
$0085 	:  wm_NCPaint
$0086 	:  wm_NCActivate
$0087 	:  wm_GetDlgCode
$00A0 	:  wm_NCMouseMove
$00A1 	:  wm_NCLButtonDown
$00A2 	:  wm_NCLButtonUp
$00A3 	:  wm_NCLButtonDblClk
$00A4 	:  wm_NCRButtonDown
$00A5 	:  wm_NCRButtonUp
$00A6 	:  wm_NCRButtonDblClk
$00A7 	:  wm_NCMButtonDown
$00A8 	:  wm_NCMButtonUp
$00A9 	:  wm_NCMButtonDblClk

$0100 	:  wm_KeyDown
$0101 	:  wm_KeyUp
$0102 	:  wm_Char
$0103 	:  wm_DeadChar
$0104 	:  wm_SysKeyDown
$0105 	:  wm_SysKeyUp
$0106 	:  wm_SysChar
$0107 	:  wm_SysDeadChar

$0110 	:  wm_InitDialog
$0111 	:  wm_Command
$0112 	:  wm_SysCommand
$0113 	:  wm_Timer
$0114 	:  wm_HScroll
$0115 	:  wm_VScroll
$0116 	:  wm_InitMenu
$0117 	:  wm_InitMenuPopup

$011F 	:  wm_MenuSelect
$0120 	:  wm_MenuChar
$0121 	:  wm_EnterIdle

$0200 	:  wm_MouseMove
$0201 	:  wm_LButtonDown
$0202 	:  wm_LButtonUp
$0203 	:  wm_LButtonDblClk
$0204 	:  wm_RButtonDown
$0205 	:  wm_RButtonUp
$0206 	:  wm_RButtonDblClk
$0207 	:  wm_MButtonDown
$0208 	:  wm_MButtonUp
$0209 	:  wm_MButtonDblClk

$0210 	:  wm_ParentNotify

$0220 	:  wm_MDICreate
$0221 	:  wm_MDIDestroy
$0222 	:  wm_MDIActivate
$0223 	:  wm_MDIRestore
$0224 	:  wm_MDINext
$0225 	:  wm_MDIMaximize
$0226 	:  wm_MDITile
$0227 	:  wm_MDICascade
$0228 	:  wm_MDIIconArrange
$0229 	:  wm_MDIGetActive
$0230 	:  wm_MDISetMenu
$0233 	:  wm_DropFiles

$0300 	: wm_Cut
$0301 	: wm_Copy
$0302 	: wm_Paste
$0303 	: wm_Clear
$0304 	: wm_Undo
$0305 	: wm_RenderFormat
$0306 	: wm_RenderAllFormats
$0307 	: wm_DestroyClipboard
$0308 	: wm_DrawClipboard
$0309 	: wm_PaintClipboard
$030A 	: wm_VScrollClipboard
$0305 	: wm_SizeClipboard
$030D 	: wm_ChangeCBChain

$030E 	: wm_HScrollClipboard
$030F 	: wm_QueryNewPalette
$0310 	: wm_PaletteIsChanging
$0311 	: wm_PaletteChanged

Button Messages

The following messages are to be used with all kinds of buttons, including radio buttons and checkboxes.
CAUTION: Do not use these messages with other Windows objects. The same numbers have different meanings on other objects!
The first value is for PROFAN²-16Bit, the second for PROFAN²-32Bit.

$0400 / $00F0 	:  bm_GetCheck
$0401 / $00F1	:  bm_SetCheck 
$0402 / $00F2	:  bm_GetState
$0403 / $00F3	:  bm_SetState
$0404 / $00F4 	:  bm_SetStyle

Edit Messages

The following messages are to used with all kinds of edit fields.
CAUTION: Do not use these messages with other Windows objects. The same numbers have different meanings on other objects!
The first value is for PROFAN²-16Bit, the second for PROFAN²-32Bit.

$0400 / $00B0 	:  em_GetSel
$0401 / $00B1 	:  em_SetSel
$0402 / $00B2 	:  em_GetRect
$0403 / $00B3 	:  em_SetRect
$0404 / $00B4 	:  em_SetRectNP
$0405 / $00B5 	:  em_Scroll
$0406 / $00B6 	:  em_LineScroll
$0408 / $00B7 	:  em_GetModify
$0409 / $00B9	:  em_SetModify
$040A / $00BA 	:  em_GetLineCount
$040B / $00BB 	:  em_LineIndex
$040C / $00BC 	:  em_SetHandle
$040D / $00BD 	:  em_GetHandle
$040E / $00BE 	:  em_GetThumb
$0411 / $00C1 	:  em_LineLength
$0412 / $00C2 	:  em_ReplaceSel
$0413 / $00C3 	:  em_SetFont
$0414 / $00C4 	:  em_GetLine
$0415 / $00C5 	:  em_LimitText
$0416 / $00C6 	:  em_CanUndo
$0417 / $00C7 	:  em_Undo
$0418 / $00C8 	:  em_FmtLines
$0419 / $00C9 	:  em_LineFromChar
$041A / $00CA 	:  em_SetWordBreak
$041B / $00CB 	:  em_SetTabStops
$041C / $00CC 	:  em_SetPasswordChar
$041D / $00CD 	:  em_EmptyUndoBuffer
$041E / $00CE 	:  em_GetFirstVisibleLine
$041F / $00CF 	:  em_SetReadOnly
$0420 / $00D0 	:  em_SetWordBreakProc
$0421 / $00D1 	:  em_GetWordBreakProc
$0422 / $00D2 	:  em_GetPasswordChar

Listbox-Messages

The following messages are to be used with all kinds of listboxes.
CAUTION: Do not use these messages with other Windows objects. The same numbers have different meanings on other objects!
The first value is for PROFAN²-16Bit, the second for PROFAN²-32Bit.

$0401 / $0180 	:  lb_AddString
$0402 / $0181 	:  lb_InsertString
$0403 / $0182 	:  lb_DeleteString
$0405 / $0184 	:  lb_ResetContent
$0406 / $0185 	:  lb_SetSel
$0407 / $0186 	:  lb_SetCurSel
$0408 / $0187 	:  lb_GetSel
$0409 / $0188 	:  lb_GetCurSel
$040A / $0189 	:  lb_GetText
$040B / $018A 	:  lb_GetTextLen
$040C / $018B 	:  lb_GetCount
$040D / $018C 	:  lb_SelectString
$040E / $018D 	:  lb_Dir
$040F / $018E 	:  lb_GetTopIndex
$0410 / $018F 	:  lb_FindString
$0411 / $0190 	:  lb_GetSelCount
$0412 / $0191 	:  lb_GetSelItems
$0413 / $0192 	:  lb_SetTabStops
$0414 / $0193 	:  lb_GetHorizontalExtent
$0415 / $0194 	:  lb_SetHorizontalExtent
$0416 / $0195 	:  lb_SetColumnWidth
$0418 / $0197 	:  lb_SetTopIndex
$0419 / $0198 	:  lb_GetItemRect
$041A / $0199 	:  lb_GetItemData
$041B / $019A 	:  lb_SetItemData
$041C / $019B 	:  lb_SelItemRange
$041F / $019E 	:  lb_SetCaretIndex
$0420 / $019F 	:  lb_GetCaretIndex
$0421 / $01A0 	:  lb_SetItemHeight
$0422 / $01A1 	:  lb_GetItemHeight
$0423 / $01A2 	:  lb_FindStringExact

ComboBox-Messages

The following messages are to used with all kinds of comboboxes, including the choicebox supported in PROFAN². Other combobox types e.g. allow entering values in the first line or show both combobox parts at the same time: edit field and listbox.
CAUTION: Do not use these messages with other Windows objects. The same numbers have different meanings on other objects!
The first value is for PROFAN²-16Bit, the second for PROFAN²-32Bit.

$0400 / $0140 	:  cb_GetEditSel
$0401 / $0141 	:  cb_LimitText
$0402 / $0142 	:  cb_SetEditSel
$0403 / $0143 	:  cb_AddString
$0404 / $0144 	:  cb_DeleteString
$0405 / $0145 	:  cb_Dir
$0406 / $0146 	:  cb_GetCount
$0407 / $0147 	:  cb_GetCurSel
$0408 / $0148 	:  cb_GetLBText
$0409 / $0149 	:  cb_GetLBTextLen
$040A / $014A 	:  cb_InsertString
$040B / $014B 	:  cb_ResetContent
$040C / $014C 	:  cb_FindString
$040D / $014D 	:  cb_SelectString
$040E / $014E 	:  cb_SetCurSel
$040F / $014F 	:  cb_ShowDropDown
$0410 / $0150 	:  cb_GetItemData
$0411 / $0151 	:  cb_SetItemData
$0412 / $0152 	:  cb_GetDroppedControlRect
$0413 / $0153 	:  cb_SetItemHeight
$0414 / $0154 	:  cb_GetItemHeight
$0415 / $0155 	:  cb_SetExtendedUI
$0416 / $0156 	:  cb_GetExtendedUI
$0417 / $0157 	:  cb_GetDroppedState
$0418 / $0158 	:  cb_FindStringExact

DDE-Messages (Numbers are for 16 and 32 bit)

$03E0 	: wm_dde_Initiate
$03E1 	: wm_dde_Terminate
$03E2 	: wm_dde_Advise
$03E3 	: wm_dde_Unadvise
$03E4 	: wm_dde_Ack
$03E5 	: wm_dde_Data
$03E6 	: wm_dde_Request
$03E7 	: wm_dde_Poke
$03E8 	: wm_dde_Execute

APPENDIX 3: Technical Specifications

PROFAN² exists as a 16bit, as well as 32bit application development tool. Compatibility between the two platforms has been closely maintained. The number of commands and functions are identical in both versions. Minor technical differences exist concerning only a few commands and functions. Differences are marked in the PROFAN² reference.

Because of compatibility it’s also possible in PROFAN²-32Bit to call functions from 16Bit DLLs, but only if PROF16.EXE was copied into the Windows directory. If a 32Bit application is distributed calling 16Bit functions, PROF16.EXE must be also given with this application!

The file format of PRC files (compiled modules) are identical. This makes it possible to start the same program once with the 16Bit runtime and other time with the 32Bit runtime.

32-Bit-Version of PROFAN² 6.0

32767 Program lines, max. 255 chars per line (PROFAN² 4.5:16380)
32767 Entries per array (PROFAN² 4.5: 16380)
10000 Entries inside the PROFAN² listbox list
500 Variable per type (PROFAN² 4.5: 200)

max. number of parameters for procedures/functions: 12 (PROFAN² 4.5: 8)
max. size of an area variable: Memory (PROFAN² 4.5: 64 kb)
While-Wend-Nesting: 10
Proc-Endproc-Nesting: 150 (PROFAN² 4.5: 10)
Numbers of opened files: 15 (PROFAN² 4.5: 8)

Numbers of opened data base tables: 15 (PROFAN² 4.5: 8)

max. size of records: 16000 chars (DBase III/PROFAN² 4.5: 4000 chars)
max. numbers of fields per record: 1024 (DBase III/PROFAN² 4.5: 128)

16-Bit-Version of PROFAN² 6.0

16380 Program lines, max. 255 chars
16380 Entries per array
10000 Entries inside the PROFAM² listbox list
200 Variable per type

max. number of parameters for procedures/functions: 12 (PROFAN² 4.5: 8)
max. size of an area variable: 64kB
While-Wend-Nesting: 10
Proc-Endproc-Nesting: 50 (PROFAN² 4.5: 10)
Numbers of opened files: 15 (PROFAN² 4.5: 8)

Numbers of opened data base tables: 15 (PROFAN² 4.5: 8)
max. size of records: 16000 chars (DBase III/PROFAN² 4.5: 4000 chars)

max. numbers of fields per record: 1024 (DBase III/PROFAN² 4.5: 128)

NOTE: Because a procedure can call itself (recursion), the Proc-Endproc-Nesting means also the max. recursion-depth.