Function Help
Total Function Count: 226
Generated by PerlScript -- Last Modified Tue Dec 14 09:39:59 1999
Author: Kevin Cao
*email me if you noticed any incorrect information
clear() : clears the console window
Return: None
puts(string text) : print a string to the output form, Does not append a newline,
- [ string text] : a short string
Return: None
putsl(string text) : print a string to the output form, Automatically append a newline,
- [ string text] : a short string
Return: None
gets(string prompt) : presents an input dialog with the given string as a prompt,
- [ string prompt] : a short string
Return: Returns a string if the user pressed OK, or zero if the user presses Cancel,
settextdefault() : to set the text style back to the default state,
Return: None
getbkmode() : This function returns the current background mix mode for a specified device context. The background mix mode of a device context affects text and dashed pens.
Return: Either OPAQUE or TRANSPARENT, which specifies the current background mix mode, indicates success. Zero indicates failure.
setbkmode(int iBkMode) : This function sets the background mix mode of the specified device context. The background mix mode is used with text, hatched brushes, and with non-solid pen styles.
- [ in iBkMode] : Specifies the background mode. It is either of the following values: OPAQUE TRANSPARENT
Return: If the function succeeds, the return value specifies the previous background mode.
setfontattr(string fontname, int italic, int underline,int strikeout, int weight,int width, int height) : set the current text drawing attributes, Italic,Underline, and Strikeout can be either 0 or 1, width and height are the font size,
- [ string fontname] : example "Arial"
- [ int italic] : 0 or 1
- [ int underline] : 0 or 1
- [ int strikeout] : 0 or 1
- [ int weight] : thin 100, normal 400, bold 700, extrabold 800, heavy 900
- [ int width] : font width
- [ int height] : font height
Return: None
polyline(int * array, int nCount) : polyline function draws points on the screen, and connect them with lines. It is similar to polygon but it doesnot connect the end point to the beginning point. It could be very useful for drawing curves.
- [ int *int_array] : an array of integers which represents a series of x and y values. 0 and Even index is the x value, and odd index is the y value. For example: (0,1) (2,3) (4,5) (6,7) (8,9) Draws 5 points and connect them with lines. The number of points must be greater or equal to 2.
- [ int nCount] : indicates how long this array is.
Return: None
polygon(int * array, int nCount) : polygon function draws a polygon on the screen. A ploygon is made up by a list of x and y values on a 2D space. The points are connected by a line. This function draws a polygon consisting of two or more vertices connected by straight lines. The current pen outlines the polygon, and the current brush fills it using the specified polygon fill mode.
- [ int *int_array] : an array of integers which represents a series of x and y values. 0 and Even index is the x value, and odd index is the y value. For example: (0,1) (2,3) (4,5) (6,7) (8,9) Draw a polygon with number of points (greater or equal to 2)
- [ int nCount] : indicates how long this array is.
Return: None
textw(string text) : precalculate the width of the text on screen without drawing it
- [ strint text] : a string
Return: return the width
keepscreen_on() : keep the screen graphics even if you switch to another appication, Default is ON.
Return: None
keepscreen_off() : turn off the screen keeper
Return: None
screenx() : return screen width
Return: an integer value for screen width
screeny() : return screen height, height value is offset by the menu height,
Return: an integer value for screen height
texth[string text) : precalculate the heigth of the text on screen without drawing it
- [ strint text] : a string
Return: return the height
clearg() : clear the graphics form,
Return: None
text(int x, int y, string str) : display a string str at locations (x,y),
- [ int x] : horizontal x value,
- [ int y] : vertical y value,
- [ string str] : text to be drawn on screen
Return: None
line(int x1, int y1, int x2, int y2) : draws a line from (x1, y1) to (x2, y2),
- [ int x1] : initial point's x value
- [ int y1] : initial point's y value
- [ int x2] : end point's x value
- [ int y2] : end point's y value
Return: None
rect(int x1, int y1, int x2, int y2) : draws a rectangle from (x1, y1) to (x2, y2)
- [ int x1] : initial point's x value
- [ int y1] : initial point's y value
- [ int x2] : end point's x value
- [ int y2] : end point's y value
Return: None
roundrect(int x1, int y1, int x2, int y2,int cx,int cy) : draws a round rectangle from (x1, y1) to (x2, y2) with round corner (cx,cy),
- [ int x1] : initial point's x
- [ int y1] : initial point's y
- [ int x2] : end point's x
- [ int y2] : end point's y
- [ int cx] : cx is the width of the ellipse used to draw the rounded corners,
- [ int cy] : cy is the height of the ellipse used to draw the rounded corners
Return: None
circle(int x, int y, int r) : draws a circle center at (x,y) with radius r
- [ int x] : horizontal x value for the center of the circle
- [ int y] : vertical y value for the center of the circle,
- [ int r] : radius for the circle
Return: None
ellipse(int x1, int y1, int x2, int y2) : draws an ellipse from (x1, y1) to (x2, y2)
- [ int x1] : initial point's x value
- [ int y1] : initial point's y value
- [ int x2] : end point's x value
- [ int y2] : end point's y value
Return: None
drawbitmap(string filename,int x,int y) : Draws a bitmap on screen at location x and y.
- [ string filename] : file path
- [ int x] : horizontal x value
- [ int y] : vertical y value
Return: None
drawbitblt (string filename,int x,int y,int flag) : draw a bitmap on screen at x and y location with special flags AND,OR,XOR,COPY, *Note: with this function, you can draw bitmap on screen with different effects,
- [ string filename] : file path
- [ int x] : horizontal x value
- [ int y] : vertical y value
- [ int flag] : special draw flag Flags:
- [ 0 ] : SRCCOPY /* dest = source */
- [ 1 ] : SRCAND /* dest = source AND dest */
- [ 2 ] : SRCINVERT /* dest = source XOR dest */
- [ 3 ] : SRCPAINT /* dest = source OR dest */
- [ 4 ] : SRCERASE , /* dest = source AND (NOT dest ) */
- [ 5 ] : NOTSRCCOPY , /* dest = (NOT source) */
- [ 6 ] : NOTSRCERASE , /* dest = (NOT src) AND (NOT dest) */
- [ 7 ] : MERGECOPY , /* dest = (source AND pattern) */
- [ 8 ] : MERGEPAINT , /* dest = (NOT source) OR dest */
- [ 9 ] : PATCOPY , /* dest = pattern */
- [ 10 ] : PATPAINT , /* dest = DPSnoo */
- [ 11 ] : PATINVERT , /* dest = pattern XOR dest */
- [ 12 ] : DSTINVERT , /* dest = (NOT dest) */
- [ 13 ] : BLACKNESS , /* dest = BLACK */
- [ 14 ] : WHITENESS /* dest = WHITE */
Return: None
setbrushattr(int R, int G, int B) : set the brush color, it is used for rect,circle,ellipse's filling color,
- [ int R] : Red
- [ int G] : Green
- [ int B] : Blue, *Note: RGB red, green, blue (RGB) color based on the specified color values
Return: None
setpenattr(int style, int width, int R, int G, int B) : set the pen attribute,
- [ int nStyle] : style can be solid (0), dash(1), or invisible (5),
- [ int nWidth] : an integer value that determines your pen's width,
- [ int R] : Red
- [ int G] : Green
- [ int B] : Blue, *Note: RGB red, green, blue (RGB) color based on the specified color values
Return: None
setbkcolor(int R, int G, int B) : set the background color
- [ int R] : Red
- [ int G] : Green
- [ int B] : Blue, *Note: RGB red, green, blue (RGB) color based on the specified color values
Return: None
settextcolor(int R, int G, int B) : set the text color
- [ int R] : Red
- [ int G] : Green
- [ int B] : Blue, *Note: RGB red, green, blue (RGB) color based on the specified color values
Return: None
setpixelattr(int R, int G, int B) : set the pixel color attribute
- [ int R] : Red
- [ int G] : Green
- [ int B] : Blue, *Note: RGB red, green, blue (RGB) color based on the specified color values
Return: None
setpixel(int x,int y) : set the pixel at location x and y
- [ int x] : horizontal x value
- [ int y] : vertical y value
Return: None
getpixelR(int x,int y) : obtain color of a pixel
- [ int x] : horizontal x value
- [ int y] : vertical y value
Return: None
getpixelG(int x,int y) : obtain color of a pixel
- [ int x] : horizontal x value
- [ int y] : vertical y value
Return: None
getpixelB(int x,int y) : obtain color of a pixel
- [ int x] : horizontal x value
- [ int y] : vertical y value
Return: None
settextangle(int x) : to set the angle at 10th degree accuracy of your text, For example, if you want to make your string looks like standing up, just passing value 900 = 90 Degree * 10,
- [ int x] : integer value for 10th of a degree
Return: None
getc() : wait for a key is released, and return the previous key value
Return: Char value
keyevent(char vkey,char cScan, int flag, int extra); : synthesizes a keystroke. The system can use such a synthesized keystroke to generate a WM_KEYUP or WM_KEYDOWN message
- [ char vkey] : Specifies a virtual-key code. The code must be a value in the range 1 to 254.
- [ char cScan] : Specifies a hardware scan code for the key.
- [ int flag] : KEYEVENTF_KEYUP If specified, the key is being released. If not specified, the key is being depressed.
- [ int extra] : Specifies an additional 32-bit value associated with the key stroke.
Return: none
getnotify() : When an event PM_COMMAND occurs, it contains a notification message. Window controls like ListBox, Button, ComboBox have its own set of notification messages. When a PM_COMMAND event occurs, you can call two functions to find out which windows control sends this message, and why. First call guiid() to find out the window control's ID, second call getnotify() to find out the control's notification message.
Return: return the notification message.
flushevent() : flush all events in the current event queue
Return: return none
event(int blocking) : Check for events in the event queue. [Warning] add sleep(0) statement into your tight loop. You need to allow other processes to have time slice when you are in a tight event. If you don't put sleep(0) in a tight loop, you won't be able to switch tasks and battery power will be drained quickly.
- [ int blocking] : If blocking is zero, event returns immediately, otherwise it waits for an event,
Return: Events are as follows: PM_NONE [0], PM_CHAR[1] , PM_MOUSEMOVE [2], PM_MEMORYSHORT[3], PM_BUTTONDOWN[4], PM_BUTTONUP[5], PM_DBCLICK[6], PM_PAINT[7], PM_COMMAND[8],PM_KEYUP[10],PM_KEYDOWN[9],PM_TIMER[11]
postevent(int nEvent) : post your own event to the event queue, make sure they don't have the same value as the standard PocketC event values,
- [ int nEvent] : event identifier,
Return: None
penx() mousex() : retrieve the x value of the previous pen event, *Note: Any MouseMove, Button related messages, Mouse position can be tracked with mousex() and mousey() function
Return: integer value for x position
peny() or mousey() : retrieve the y value of the previous pen event, *Note: Any MouseMove, Button related messages, Mouse position can be tracked with mousex() and mousey() function
Return: integer value for y position
cursorwait(int nState) : show/hide sandbox waiting box on screen
- [ int nState] : state can be 1 or 0, 1 means show wait cursor, 0 means hide wait cursor
Return: None
menu() : retrieve the ID value of the previous menu event, *Note: When user select a menu item,PM_ COMMAND event will be passed back as the return value of event(int) function, You should use menu() to get the menu id which was selected by the user,
Return: integer value for menu identifier
guiid() : retrieve the ID value of the previous graphic user interface,
Return: integer value for GUI identifier
key() : retrieve the character written during the last event()
Return: key value
timerid() : retrieve the timer id for the last PM_TIMER message
Return: integer value for Timer identifier
settimer(int timerid,int timeElapse) : set a timer, You can set up multiple timer, Each timer has its own ID, and its time length, When you set a timer, remember to specifies the time out value, in milliseconds, When time out, in your event queue, you will receive a PM_TIMER (11) message,
- [ int nTimerID] : timer identifier
- [ int timeElapse] : time length in ms,
Return: If the function succeeds, the return value is an integer identifying the new timer, An application can pass this value, or the string identifier, if it exists, to the killtimer function to destroy the timer, If the function fails to create a timer, the re
killtimer(int timerid) : kill the timer ID, otherwise, you will receive a PM_TIMER every timeElapse milliseconds,
- [ int nTimerID] : timer identifier
Return: Return 1 or 0 indicating TRUE or FALSE
waitp() : wait for a pen event PM_BUTTONUP
Return: None
writebyte(int handle, int v) : Writes to the output stream the eight low- order bits of the argument v.
- [ int handle] : a file or serial connection handle
- [ int v] : an integer value
Return: None
readbyte(int handle) : Reads and returns one input byte.
- [ int handle] : input handle for file or serial connections
Return: the 8-bit value read.
fileenum(int first, string filename) : the function enumerates through all files in one directory.
- [ int first] : use 1 for find the first file.
- [ string filename] : specifies a valid directory or path and filename, which can contain wildcard characters * and ?
Return: returns file name. If returns an empty string, that indicates no more files have been found.
filecopy(string ExistingFilePath,string NewFilePath,int bFailIfExists); : copies an existing file to a new file. Make sure set the last parameter bFailIfExistes . It specifies how this operation is to proceed if a file of the same name as that specified by NewFilePath already exists. If this parameter is TRUE and the new file already exists, the function fails. If this parameter is FALSE and the new file already exists, the function overwrites the existing file and succeeds.
- [ string existingfilepath] : file path, Filepath means entire full file path to the file including the file name, For example: "/PocketC/test,pc"
- [ string newfilepath] : file path, Filepath means entire full file path to the file including the file name, For example: "/PocketC/test,pc"
- [ int bFailIfExists] : , if a file of the same name as that specified by lpNewFileName already exists, If this parameter is 1 and the new file already exists, the function fails, If this arameter is 0 and the new file already exists, the function overwrites the existing file and succeeds
Return: Return 1 or 0, 1 means True, 0 means False
filemove(string ExistingFilePath,string NewFilePath,int bFailIfExists); : moves an existing file to a new file.
- [ string existingfilepath] : file path, Filepath means entire full file path to the file including the file name, For example: "/PocketC/test,pc"
- [ string newfilepath] : file path, Filepath means entire full file path to the file including the file name, For example: "/PocketC/test,pc"
Return: Return 1 or 0, 1 means True, 0 means False
fileopen(string filepath, int type, int flag) : open a file in unicode/ascii. You can create a new file or simply open one. Please use the flag correctly.
- [ string filepath] : file path, Filepath means entire full file path to the file including the file name, For example: "/PocketC/test,pc",
- [ int type] : file type, type could be 0 or 1, 0 means ASCII, 1 means Unicode
- [ int flag] : please specifies the action to take when opening the file. You can combine options listed below by using the bitwise-OR (|) operator.
- FILE_CREATE 0x00001000 /*create a new file. If the file exists already, it is truncated to 0 length.*/
- FILE_NOTRUNCATE 0x00002000 /*Combine this value with modeCreate. If the file being created already exists, it is not truncated to 0 length. Thus the file is guaranteed to open, either as a newly created file or as an existing file. This might be useful, for example, when opening a settings file that may or may not exist already.*/
- FILE_READ 0x00000000 /*Opens the file for reading only.*/
- FILE_READWRITE 0x00000002 /*Opens the file for reading and writing.*/
- FILE_WRITE 0x00000001/*Opens the file for writing only.*/
Return: Returns an integer as the File Handle if successful,otherwise -1, Remember to keep this handle value somewhere, Because you have to use this handle for the rest of file operations,
filemodeget(int filehandle) : obtain file mode,
- [ int filehandle] : filehandle, It is used to indentify which file this function is targeted,
Return: Return file mode, ASCII or Unicode
filemodeset(int filehandle, int filetype) : Set file mode ASCII or Unicode, Use with caution, Don't try to write unicode and ascii code into one file,
- [ int filehandle] : filehandle, It is used to indentify which file this function is targeted,
- [ int filetype] : type could be 0 or 1, 0 means ASCII, 1 means Unicode
Return: None
fileclose(int filehandle) : close a file, Note: you have to keep the return value from fileopen() for closing that file,
- [ int filehandle] : filehandle, It is used to indentify which file this function is targeted,
Return: None
fileread(int filehandle,int counter) : Reads (unbuffered) data from a file at the current file position,
- [ int filehandle] : filehandle, It is used to indentify which file this function is targeted,
- [ int counter] : The maximum number of bytes to be read from the file, For text mode files, carriage return–linefeed pairs are counted as single characters,
Return: The number of bytes transferred to the buffer, Note , the return value may be less than nCount if the end of file was reached,
filewrite(int filehandle,string data,int counter) : Writes (unbuffered) data in a file to the current file position,
- [ int filehandle] : filehandle, It is used to indentify which file this function is targeted,
- [ string data] : data you want to write to the file,
- [ int counter] : The maximum number of bytes to write. String in PocketC is unicode, each character takes two bytes. Make sure when you save strings to a file, its byte size is the string length * 2. If you want to save to an ASCII file, the maximum byte size is string length* 1.
Return: If failed, return -1. If successful, it returns number of written bytes.
filegetlen(int filehandle) : Retrieves the length of the file, Note: Obtains the current logical length of the file in bytes, not the amount,
- [ int filehandle] : filehandle, It is used to indentify which file this function is targeted,
Return: The length of the file,
filesetlen(int filehandle, int newlen) : Set the length of the file. Newlen value can be larger or smaller than the current length of the file, The file will be extended or truncated according to the newlen
- [ int filehandle] : filehandle, It is used to indentify which file this function is targeted,
- [ int newlen] : Desired length of the file in bytes.
Return: None
fileseek(int filehandle,int offset,int from) : Positions the current file pointer, Repositions the pointer in a previously opened file, The Seek function permits random access to a file's contents by moving the pointer a specified amount, absolutely or relatively, No data is actually read during the seek, When a file is opened, the file pointer is positioned at offset 0, the beginning of the file.
- [ int filehandle] : filehandle
- [ int offset] : Number of bytes to move the pointer,
- [ int from] : pointer movement mode, (FILE_BEGIN 0) Move the file pointer lOff bytes forward from the beginning of the file, (FILE_CURRENT 1) Move the file pointer lOff bytes from the current position in the file, (FILE_BEGIN 2) Move the file pointer lOff bytes from the end of the file, Note that lOff must be negative to seek into the existing file; positive values will seek past the end of the file,
Return: If the requested position is legal, Seek returns the new byte offset from the beginning of the file,
fileseekend(int filehandle) : Sets the value of the file pointer to the logical end of the file, fileseekend() is equivalent to fileseek( filehandle,0, FILE_END),
- [ int filehandle] : filehandle, It is used to indentify which file this function is targeted,
Return: Return: The length of the file in bytes,
fileflush(int filehandle) : Flushes any data yet to be written, Forces any data remaining in the file buffer to be written to the file,
- [ int filehandle] : filehandle, It is used to indentify which file this function is targeted,
Return:
filepos(int filehandle) : Obtains the current value of the file pointer, which can be used in subsequent calls to Seek,
- [ int filehandle] : filehandle, It is used to indentify which file this function is targeted,
Return: current value of the file pointer
[OBSOLETE] CopyFile(string NewFilePath,string ExistingFilePath,int bFailIfExists); : CopyFile function copies an existing file to a new file. Make sure set the last parameter bFailIfExistes . It specifies how this operation is to proceed if a file of the same name as that specified by NewFilePath already exists. If this parameter is TRUE and the new file already exists, the function fails. If this parameter is FALSE and the new file already exists, the function overwrites the existing file and succeeds.
- [ string existingfilepath] : file path, Filepath means entire full file path to the file including the file name, For example: "/PocketC/test,pc"
- [ string newfilepath] : file path, Filepath means entire full file path to the file including the file name, For example: "/PocketC/test,pc"
- [ int bFailIfExists] : , if a file of the same name as that specified by lpNewFileName already exists, If this parameter is 1 and the new file already exists, the function fails, If this arameter is 0 and the new file already exists, the function overwrites the existing file and succeeds
Return: Return 1 or 0, 1 means True, 0 means False
MoveFile(string ExistingFileName,string NewFileName); : The MoveFile function renames an existing file or a directory( including all its children),
- [ string existingfilepath] : file path, Filepath means entire full file path to the file including the file name, For example: "/PocketC/test,pc"
- [ string newfilepath] : file path, Filepath means entire full file path to the file including the file name,
Return: Return 1 or 0, 1 means True, 0 means False
CreateDirectory(string Dirname), : The CreateDirectory function creates a new directory,
- [ string dirpath] : dir path, Filepath means entire full dir path, For example: "/MyFolder"
Return: Return 1 or 0, 1 means True, 0 means False
RemoveDirectory(string Dirname), : The RemoveDirectory function deletes an existing empty directory,
- [ string dirpath] : dir path, Filepath means entire full dir path, For example: "/MyFolder"
Return: Return 1 or 0, 1 means True, 0 means False
DeleteFile(string FileName); , : The DeleteFile function deletes an existing file
- [ string existingfilepath] : file path, Filepath means entire full file path to the file including the file name, For example: "/PocketC/test,pc"
Return: Return 1 or 0 or -1, 1 means True, 0 means False, -1 means files not dot exist
GetFileAttr(string filepath), : Get the file's attribute
- [ string filepath] : file path
Return: File attribute. - FILE_ATTRIBUTE_READONLY 0x00000001
- FILE_ATTRIBUTE_HIDDEN 0x00000002
- FILE_ATTRIBUTE_SYSTEM 0x00000004
- FILE_ATTRIBUTE_DIRECTORY 0x00000010
- FILE_ATTRIBUTE_ARCHIVE 0x00000020
- FILE_ATTRIBUTE_NORMAL 0x00000080
- FILE_ATTRIBUTE_TEMPORARY 0x00000100
- FILE_ATTRIBUTE_COMPRESSED 0x00000800
- FILE_ATTRIBUTE_OFFLINE 0x00001000
OpenFileDlg(string FileFilter); : use to initialize an Open or Save As common dialog box, After the user closes the dialog box, the system returns information about the user’s selection, In our case, the selected file path, If user hits cancel, the return string has string len = 0, if you don't want to add any fill filter, just call OpenFileDlg("")
- [ string text] : a short string, The first string in each pair is a display string that describes the filter (for example, “Text Files”), and the second string specifies the filter pattern (for example, “*,TXT”), To specify multiple filter patterns for a single display string, use a semicolon to separate the patterns (for example, “*,TXT;*,DOC;*,BAK”), A pattern string can be a combination of valid filename characters and the asterisk (*) wildcard character, Do not include spaces in the pattern string, Filter strings are separated with character ' | ', Filter Format Example: "PocketC Source (*,pc)|*,pc" Make sure it has a semicolon at the end, The operating system does not change the order of the filters, It displays them in the File Types combo box in the order specified in FileFilter, "
Return: return filepath user just selected
SaveFileDlg(string FileFilter) : use to initialize an Open or Save As common dialog box, After the user closes the dialog box, the system returns information about the user’s selection, In our case, the selected file path, If user hits cancel, the return string has string len = 0, if you don't want to add any fill filter, just call SaveFileDlg("")
- [ string text] : a short string, The first string in each pair is a display string that describes the filter (for example, “Text Files”), and the second string specifies the filter pattern (for example, “*,TXT”), To specify multiple filter patterns for a single display string, use a semicolon to separate the patterns (for example, “*,TXT;*,DOC;*,BAK”), A pattern string can be a combination of valid filename characters and the asterisk (*) wildcard character, Do not include spaces in the pattern string, Filter strings are separated with character ' | ', Filter Format Example: "PocketC Source (*,pc)|*,pc" Make sure it has a semicolon at the end, The operating system does not change the order of the filters, It displays them in the File Types combo box in the order specified in FileFilter,
Return: return filepath user just selected
writebytes(int handle, string s) : Writes a string to the output stream. For every character in the string s, taken in order, one byte is written to the output stream
- [ int handle] : file or serial connection stream
- [ string s] : output string
Return: None
writechar(int handle, int v) : Writes a char value, wich is comprised of two bytes.
- [ int handle] : output handle for file or serial connection
- [ int v] : value
Return: None
writechars(int handle, string s) : Writes every character in the string s, to the output stream, in order, two bytes per character
- [ int handle] : output handle for file or serial connections
- [ string s] : output string
Return: None
writeint(int handle, int v) : Writes an int value, which is comprised of four bytes, to the output stream
- [ int handle] : output handle for file or serial connections
- [ int v] : value
Return: None
readint(int handle) : Reads four input bytes and returns an int value
- [ int handle] : input handle for file or serial connections
Return: an integer
readchar(int handle) : Reads an input char and returns the char value
- [ int handle] : input handle for file or serial connections
Return: an Unicode char read
wndmove(int handle, int x, int y, int width, int height) : move a control or window to a new position/size. Units is in pixel.
- [ int handle] : window/control identifier
- [ int x] : position x
- [ int y] : y position
- [ int width] : width
- [ int height] : height
Return: If the function succeeds, the return value is nonzero. If the function fails, the return value is zero.
wndshow(int handle, int flag) : show/hide a control on screen. Remark* the flag value can be many other values. In most cases, SW_SHOW and SW_HIDE would be enough. If you care to investigate all possible values, Microsoft documentation on Win32 API programming would be the only way to go.
- [ int handle] : window identifier
- [ int flag] : indicates how the window state. SW_SHOW = 5 SW_HIDE = 0
Return: If the window was previously visible, the return value is nonzero. If the window was previously hidden, the return value is zero.
menudel(int handle, int flag, int id) : Delete a menu item from the menu bar. You can delete a menu by its position or its id.
- [ int handle] : the main menu handle, must be 0 right now.
- [ int flag] : menu flag. MF_BYCOMMAND or MF_BYPOSITION.
- [ int id] : menu id or position depend on the flag.
Return: none
menuins(int handle, int id_after, int flag, int id_new, string name); : Insert a menu into current existing menu bar. Right now you can only insert menu under Program menu.
- [ int handle] : the main menu handle, right now it must be 0.
- [ int id_after] : the new menu is inserted behind the menu with id_after.
- [ int flag] : menu flag. See control documentation.
- [ int id_new] : the new menu item's id.
- [ string name] : the new menu name
Return: none
lbrstcnt(int nID) : reset the contents of a list box
- [ int nID] : user control ID
Return: None
lbdelstr(int nID, int nIndex) : delete a string from the list box
- [ int nID] : user control ID
- [ int nIndex] : the zero-based index of the string to be deleted,
Return: A count of the strings remaining in the list, The return value is LB_ERR -1 if nIndex specifies an index greater than the number of items in the list,
lbgetcnt(int nID) : Returns the number of strings in a list box,
- [ int nID] : user control ID
Return: number of strings in a listbox
lbgetcur(int nID) : Get current selection in a listbox
- [ int nID] : user control ID
Return: return current selection string's zero-based index value, LB_ERR -1 if none is selected,
lbsetcur(int nID, int nIndex) : Set current selection in a listbox
- [ int nID] : user control ID
Return: return LB_ERR -1 is an error occurred,
lbgettxt(int nID, int nIndex) : get a string from a list box
- [ int nID] : user control ID
- [ int nIndex] : the zero-based index of the string to be deleted,
Return: return the string is at zero-based index location,
lbfndstr(int nID, string str) : find a string from a list box
- [ int nID] : user control ID
- [ int findindex] : Zero-based index of the item before the first item to be searched. When the search reaches the bottom of the list box, it continues from the top of the list box back to the item specified by the indexStart parameter. If indexStart is –1, the entire list box is searched from the beginning
- [ string str] : a string
Return: return the founded string's zero-based index location, LB_ERR -1 if none is founded,
sendmsg(int nID, int nMsg, anytype wparam, anytype lparam) : sendmsg sends a specific message to a window control, and it will not return until the message has been processed.
- [ int nID] : window control ID
- [ int nMsg] : window control message
- [ anytype wparam] : message dependent value
- [ anytype lparam] : message dependent value
Return: return value is depend on the specific message is sent
createctrl(string strCtrl, string strName, int nStyle, int nExStyle, int xpos, int ypos, int width, int height, int nID) : create a window control. All of that work, you just created one control. If you want to create user interface quickly, Visual Form Buddy or PCForms would be make UI design much easier.
- [ string strCtrl] : Following control names are acceptable. "BUTTON" "COMBOBOX" "EDIT" "LISTBOX" "SCROLLBAR" "STATIC"
- [ string strName] : the control title.
- [ int nStyle] : each control has its own specific styles. For each control, consult the control documentat
- [ int nExStyle] : Extra styles.
- [ int xpos] : x position
- [ int ypos] : y position
- [ int width] : control width
- [ int height] : control hight
- [ int nID] : control ID.
Return: -1 indicates failed. Otherwise, it returns the windows ID.
cbaddstr(int nID, string str) : add a string to the combobox
- [ int nID] : user control ID
- [ string str] : a short string
Return: zero based index value of the added string in the combobox
cbinsstr(int nID, int nIndex, string str) : insert a string to the combobox at a specific position
- [ int nID] : user control ID
- [ int nIndex] : zero based index value
- [ string str] : a short string
Return: zero based index value of the inserted string in the combobox
cbrstcnt(int nID) : reset the contents of a combobox
- [ int nID] : user control ID
Return: None
cbdelstr(int nID, int nIndex) : delete a string from the combobox
- [ int nID] : user control ID
- [ int nIndex] : the zero-based index of the string to be deleted,
Return: A count of the strings remaining in the list, The return value is LB_ERR -1 if nIndex specifies an index greater than the number of items in the list,
cbgetcnt(int nID) : Returns the number of strings in a combobox,
- [ int nID] : user control ID
Return: number of strings in a combobox
cbgetcur(int nID) : Get current selection in a combobox
- [ int nID] : user control ID
Return: return current selection string's zero-based index value, LB_ERR -1 if none is selected,
cbsetcur(int nID, int nIndex) : Set current selection in a combobox
- [ int nID] : user control ID
Return: return LB_ERR -1 is an error occurred,
cbgettxt(int nID, int nIndex) : get a string from a combobox
- [ int nID] : user control ID
- [ int nIndex] : the zero-based index of the string to be deleted,
Return: return the string is at zero-based index location,
cbfndstr(int nID, int findindex string str) : find a string from a combobox.
- [ int nID] : user control ID
- [ int findindex] : Zero-based index of the item before the first item to be searched. When the search reaches the bottom of the list box, it continues from the top of the list box back to the item specified by the indexStart parameter. If indexStart is –1, the entire list box is searched from the beginning
- [ string str] : a string
Return: return the founded string's zero-based index location, LB_ERR -1 if none is founded,
cbselstr(int nID, int nStart, string str) : select a string if the string is found in the combobox
- [ int nID] : user control ID
- [ int nStart] : Specifies the zero-based index of the item preceding the first item to be searched. When the search reaches the bottom of the list, it continues from the top of the list back to the item specified by the indexStart parameter. If indexStart is -1, the entire list is searched from the beginning.
- [ string str] : a short string
Return: return the founded string's zero-based index location, LB_ERR -1 if none is founded.
guisetfocus(int guiid) : set input focus to that GUI control.
- [ int nID] : user control ID
Return: Returns the previous window control's ID. We reserved 0 for the main window, 1 for console window
guigetfocus() : check which GUI control has the input focus right now,
Return: returns GUI identifier
delgui(int id) : delete User Interface control from the window
- [ int nID] : user control ID
Return: None
delallgui(int from, int to) : delete gui control from the window with ID in range less than TO and greater than FROM
- [ int nIDfrom] : user control ID starting value
- [ int nIDto] : user control ID end value
Return: None
cbxset(int id, int state) : set check box's state,
- [ int nID] : user control ID
- [ int nState] : checkbox state 1 means checked, 0 means unchecked
Return: None
cbxget(int id) : get check box's current state
- [ int nID] : user control ID
Return: return check box's state, 1 means checked, 0 means unchecked
editget(int id) : get current editbox's string
- [ int nID] : user control ID
Return: return edit box's string value
editset(int id,string str) : set edit box's value by giving the gui's id and the string value
- [ int nID] : user control ID
- [ string str] : a short string
Return: None
lbaddstr(int nID, string str) : add a string to the listbox
- [ int nID] : user control ID
- [ string str] : a short string
Return: zero based index value of the added string in the listbox
lbinsstr(int nID, int nIndex, string str) : insert a string to the listbox at a specific position
- [ int nID] : user control ID
- [ int nIndex] : zero based index value
- [ string str] : a short string
Return: zero based index value of the inserted string in the listbox
menupop(string strmenu) : create a popup menu on screen where the pen tabs. The input is a very simple string that presents the entire menu item list.
- [ string strmenu] : For each menu item, the string representation is "MenuName|MenuID". The name and the ID is separated by character '|'. A menu separator is "---|0". For example: "Chicago|40020|Cleveland|40021" For more, see Chapter2.
Return: return user's selection, 0 if none
menu_off() : hide menu bar
Return: None
menu_on() : show menu bar
Return: None
menupopex(string strmenu, int x, int y) : create a popup menu on screen where the pen tabs. The input is a very simple string that presents the entire menu item list.
- [ int handle] : the main menu handle, right now it must be 0.
- [ int id_after] : the new menu is inserted behind the menu with id_after.
- [ int flag] : menu flag. See control documentation.
- [ int id_new] : the new menu item's id.
- [ string name] : the new menu name
- [ int x] : screen horizontal position
- [ int y] : screen vertical position
Return: return user's selection, 0 if none
rand() : returns a random float between 0 and 1,
Return: a float value
random(int n) : returns a random int between 0 and n-1
Return: a integer value
floor(float x) : returns a floating point value representing the largest integer that is less than or equal to x,There is no error return,
- [ float ft] : a float value
Return: a integer value
ceil(float x) : returns a floating point value representing the smallest integer that is greater than or equal to x, There is no error return,
- [ float ft] : a float value
Return: a integer value
abs(floag x) : returns an absolute value
- [ float ft] : a float value
Return: a integer value
cos(float x) : returns the expected trigonometric value, using radians,
- [ float ft] : a float value
Return: a float value
sin(float x) : returns the expected trigonometric value, using radians,
- [ float ft] : a float value
Return: a float value
tan(float x) : returns the expected trigonometric value, using radians,
- [ float ft] : a float value
Return: a float value
acos(float x) : returns the expected trigonometric value, using radians,
- [ float ft] : a float value
Return: a float value
asin(float x) : returns the expected trigonometric value, using radians,
- [ float ft] : a float value
Return: a float value
atan(float x) : returns the expected trigonometric value, using radians,
- [ float ft] : a float value
Return: a float value
cosh(float x) : returns the expected trigonometric value, using radians,
- [ float ft] : a float value
Return: a float value
sinh(float x) : returns the expected trigonometric value, using radians,
- [ float ft] : a float value
Return: a float value
tanh(float x) : returns the expected trigonometric value, using radians,
- [ float ft] : a float value
Return: a float value
pow(float x, float y) : returns x
- [ float x] : a float value
- [ float y] : a float value
Return: y,
sqrt(float x) : returns square root of x,
- [ float ft] : a float value
Return: a float value
log(float x) : returns natural log of x,
- [ float ft] : a float value
Return: a float value
log10(float x) : returns log base 10 of x,
- [ float ft] : a float value
Return: a float value
exp(float x) : returns e
- [ float ft] : a float value
Return: x,
regwstr(int root,string keypath,string keyname, string sval) : write string to registry database,
- [ int root] : root is defined as following define statement, {define HKEY_CLASSES_ROOT 0, define HKEY_CURRENT_USER 1, define HKEY_LOCAL_MACHINE 2 , define HKEY_USERS 3}
- [ string keypath] : keypath is defined with double backslash Sample: regrstr(0,"pcapp\\Shell\\Open\\Command","default"); ,
- [ string keyname] : keyname,
- [ string str] : key value
Return: return 0 for success, Otherwise fail,
regwint(int root,string keypath,string keyname, int ival) : write integer to registry database,
- [ int root] : root is defined as following define statement, {define HKEY_CLASSES_ROOT 0, define HKEY_CURRENT_USER 1, define HKEY_LOCAL_MACHINE 2 , define HKEY_USERS 3}
- [ string keypath] : keypath is defined with double backslash Sample: regrstr(0,"pcapp\\Shell\\Open\\Command","default"); ,
- [ string keyname] : keyname,
- [ int value] : key value
Return: return 0 for success, Otherwise fail,
regrstr(int root,string keypath,string keyname) : read string from registry database
- [ int root] : root is defined as following define statement, {define HKEY_CLASSES_ROOT 0, define HKEY_CURRENT_USER 1, define HKEY_LOCAL_MACHINE 2 , define HKEY_USERS 3}
- [ string keypath] : keypath is defined with double backslash Sample: regrstr(0,"pcapp\\Shell\\Open\\Command","default"); ,
- [ string keyname] : keyname
Return: string
regrint(int root,string keypath,string keyname) : read integer from registry database
- [ int root] : root is defined as following define statement, {define HKEY_CLASSES_ROOT 0, define HKEY_CURRENT_USER 1, define HKEY_LOCAL_MACHINE 2 , define HKEY_USERS 3}
- [ string keypath] : keypath is defined with double backslash Sample: regrstr(0,"pcapp\\Shell\\Open\\Command","default"); ,
- [ string keyname] : keyname
Return: integer
regdelkey(int root, string keypath) : function deletes a subkey
- [ int root] : root is defined as following HKEY_CLASSES_ROOT 0, HKEY_CURRENT_USER 1, HKEY_LOCAL_MACHINE 2 , HKEY_USERS 3
- [ string keypath] : SubKey string
Return: return 0 if it succeed, otherwise fail.
regdelval(int root, string keypath) : removes a named value from the specified registry key.
- [ int root] : root is defined as following HKEY_CLASSES_ROOT 0, HKEY_CURRENT_USER 1, HKEY_LOCAL_MACHINE 2 , HKEY_USERS 3}
- [ string ValueName] : string that names the value to remove
Return: return 0 if it succeed, otherwise fail.
commsetmask(int handle,int mask) : specifies a set of events to monitor for a communications device
- [ int handle] : serial connection handle
- [ int mask] : specifies the events to be enabled. A value of 0 disable all events.
- [ int mask] : This parameter can be a combination of the following values:
- EV_BREAK -- a break was detected on input
- EV_CTS -- The CTS (clear-to-send) signal changed state
- EV_DSR -- The DSR (data-set-ready) signal changed state
- EV_ERR -- a line-status error occurred. Line-status errors are CE_FRAME, CE_OVERRUN, and CE_RXPARITY
- EV_RING -- a ring indicator was detected
- EV_RLSD -- the RLSD(receive-line-signal-detect) signal changed state.
- EV_RXCHAR--a character was received and placed in the input buffer
- EV_TXEMPTY--The last character in the output buffer was sent.
Return: Nonzero indicates success. Zero indicates failure
commwait(int handle, int nblock) : waits for the data. If nblock is 0, it returns immediately. When the data is in the buffer, the main event will receive an event message PM_COMM (12). If nblock is 1, the function will not return until there is data in the buffer.
- [ int handle] : connection handle
- [ int nblock] : value 0 or 1
Return: None
rawiropen(int baud,string settings,int timeout) : open a serial port for infraRed. It searchs through user's registry, and use correct port for infraRed transfer.
- [ int baud] : integer value represents the speed of the connection, (300-56000),
- [ string settings] : a 4 characters string represents the connection setting, { bits/char (6,7,8), parity (N,E,O), stop bits (1,2) , flow control (N, NoFlowControl X-software, C-CTS, R-RTS) }
- [ int timeout] : integer value for timeout, It is ignored at this point, Description:""open a serial port, *Note: Port number is default to ""COM:1:"" for simplicity"
Return: 1 means for success, 0 means fail
seropen(int baud, string settings, int timeout) : open a serial port, *Note: Port number is default to "COM:1:" for simplicity, Due to user requests, an addition function has been added for other port accesses, Please use seropenex if you have multiple ports
- [ int baud] : integer value represents the speed of the connection, (300-56000),
- [ string settings] : a 4 characters string represents the connection setting, { bits/char (6,7,8), parity (N,E,O), stop bits (1,2) , flow control (N, NoFlowControl X-software, C-CTS, R-RTS) }
- [ int timeout] : integer value for timeout, It is ignored at this point, Description:"open a serial port, *Note: Port number is default to "COM:1:" for simplicity
Return: 1 means for success, 0 means fail
OBSOLETE serdata() : check if there is data available in the buffer
Return: return 1 if data is waiting, 0 otherwise,
OBSOLETE serrecv() : receive a byte, right now the data type is a character,
Return: return a character value
OBSOLETE sersend(char byte) : send a byte,
- [ char byte] : a character to be send
Return: None
OBSOLETE serclose() : close serial port,
Return: None
seropenex(string comport, int baud, string settings, int timeout) : open the serial port, *Note: for Infrared Port: please obtain the port number from the registry key \\HKEY_LOCAL_MACHINE\\COMM\\IrDA\\Port, The Port number may not be the same on all devices.
- [ string strPort] : "COM1:" "COM2:" "COM3:" or any port you want to use,
- [ int baud] : integer value represents the speed of the connection, (300-56000),
- [ string settings] : a 4 characters string represents the connection setting, { bits/char (6,7,8), parity (N,E,O), stop bits (1,2) , flow control (N, NoFlowControl X-software, C-CTS, R-RTS) }
- [ int timeout] : integer value for timeout, It is ignored at this point
Return: 1 means for success, 0 means fail
commclrerr(int handle, void v) : This function retrieves information about a communications error and reports the current status of a communications device. The function is called when a communications error occurs, and it clears the error flag of the device to enable additional input and output (I/O) operations.
- [ int handle] : Handle to the communications device
- [ int void] : reserved. Must use 0 for now.
Return: A 32-bit variable to be filled with a mask indicating the type of error. This parameter can be one or more of the following error codes:- CE_BREAK--The hardware detected a break condition.
- CE_FRAME The hardware detected a framing error.
- CE_IOE An I/O error occurred during communications with the device.
- CE_MODE The requested mode is not supported, or the hFile parameter is invalid. If this value is specified, it is the only valid error.
- CE_OVERRUN A character-buffer overrun has occurred. The next character is lost.
- CE_RXOVER An input buffer overflow has occurred. There is either no room in the input buffer, or a character was received after the end-of-file (EOF) character.
- CE_RXPARITY The hardware detected a parity error.
- CE_TXFULL The application tried to transmit a character, but the output buffer was full.
commsetbrk(int handle) : This function suspends character transmission for a specified communications device and places the transmission line in a break state until the commclrbrk function is called.
- [ int handle] : Handle to the communications device
Return: Nonzero indicates success. Zero indicates failure
commclrbrk(int handle) : This function restores character transmission for a specified communications device and places the transmission line in a nonbreak state
- [ int handle] : serial communication handle
Return: Nonzero indicates success. Zero indicates failure
commesc(int handle, int ext) : This function directs a specified communications device to perform an extended function.
- [ int hande] : communication handle
- [ int ext] : Specifies the code of the extended function to perform. It can be one of the following values:
- SETIR --Sets the serial port in infrared (IR) mode.
- CLRIR--Sets port to normal serial mode.
- CLRDTR--Clears the DTR (data-terminal-ready) signal.
- CLRRTS--Clears the RTS (request-to-send) signal.
- SETDTR--Sends the DTR (data-terminal-ready) signal.
- SETRTS--Sends the RTS (request-to-send) signal.
- SETXOFF--Causes transmission to act as if an XOFF character has been received.
- SETXON--Causes transmission to act as if an XON character has been received.
- SETBREAK -- Suspends character transmission and places the transmission line in a break state until the commclrbrk function is called (or commesc is called with the CLRBREAK extended function code). The SETBREAK extended function code is identical to the commsetbrk function. Note that this extended function does not flush data that has not been transmitted.
- CLRBREAK--Restores character transmission and places the transmission line in a nonbreak state. The CLRBREAK extended function code is identical to the commclrbrk function.
Return: Nonzero indicates success. Zero indicates failure. To get extended error information
commgetmask(int handle) : This function retrieves the value of the event mask for a specified communications device. The commgetmast function uses a 32-bit mask variable to indicate the set of events that can be monitored for a particular communications resource. A handle to the communications resource can be specified in a call to the commwait function, which waits for one of the events to occur. To modify the event mask of a communications resource, use the commsetmask function.
- [ int handle] : serial connection handle
Return: The return value can be a combination of the following values: - EV_BREAK -- a break was detected on input
- EV_CTS -- The CTS (clear-to-send) signal changed state
- EV_DSR -- The DSR (data-set-ready) signal changed state
- EV_ERR -- a line-status error occurred. Line-status errors are CE_FRAME, CE_OVERRUN, and CE_RXPARITY
- EV_RING -- a ring indicator was detected
- EV_RLSD -- the RLSD(receive-line-signal-detect) signal changed state.
- EV_RXCHAR -- a character was received and placed in the input buffer
- EV_TXEMPTY--The last character in the output buffer was sent.
recentdoc(string path) : add document to recent document menu, Parameter path, pathname for the document, For example: recentdoc("\\windows\\alarm2,wav");
- [ string filepath] : full file path to the file
Return: None
shortcut(string lnkpath,string filepath) : add a shortcut to executable or file, For example: shortcut("\\windows\\Programs\\PocketC,lnk", "\\pocketc\\pceditor,exe"); shortcut("\\windows\\Desktop\\PocketC,lnk", "\\pocketc\\pceditor,exe");
- [ string lnkpath] : shortcut file location,
- [ string filepath] : full file path to your target file or execute
Return: None
debugout(string debugstring) : send a string through OutputDebugString (win32 function) for debug purpose only, you can catch these strings by using HPC trace or other debug utility that monitor OutputDebugString,
- [ string debugstring] : debug message to be catched by debug utilities that monitor OutputDebugString functions,
Return: None
getcurpath() : obtain current PocketC applet's file location
Return: return a string
quit() : exit your applet gracefully,
Return: None
showabout() : popup about window.
Return: None
graph_off() : popup console window, the appearance of the graphics is not preserved if keepscreen_off() is called,
Return: None
graph_on() : switches to the graphics window
Return: None
MessageBox(string text,string caption,int icon,int buttons) : buttons style can be 1= OKCANCLE, 2=YESNO, 3=YESNOCANCEL.
- [ string text] : a short string
- [ string caption] : Messagebox's caption
- [ int icon] : Icon identifier, Information 1, Asterisk 2, and Hand 3,
- [ int buttons] : button layout identifier,
Return: Return value -1 means Cancel, 0 means NO, 1 means Yes,
about(string text) : set about box's contents, example string: "MyAppName\r\nMyName"
- [ string text] : a short string
Return: None
confirm(string text) : pops up an alert dialog with the given text and Yes/No buttons,
- [ string text] : a short string
Return: Returns 1 for Yes, 0 for No,
alert(string text) : pops up an alert dialog with the given text,
- [ string text] : a short string
Return: None
title(string text) : give your applet a name! So it will appear on the taskbar on the bottom. It will also keep your application single instance. When a new PocketC application launchs, it will check if any existing same application running. If it is, it will terminate itself, and switch to the running application. It is important feature to have for PPC users.
- [ string text] : a short string
Return: None
runapptime(string path, int month, int day, int hour, int min) : run application at specific time in the future, Parameter path is the application location, For example:"\\pocketc\\pceditor,exe" or "/pocketc/pceditor,exe" *Note: current implementation is just a simple translation of the actual Win32 shell function,
- [ string filepath] : file path to the executable,
- [ int month] : month (1-12)
- [ int day] : day
- [ int hour] : hour, (0-24)
- [ int min] : minutes, (0-60)
Return: None
sleep(int len) : A thread can relinquish the remainder of its time slice by calling this function with a sleep time of zero milliseconds
- [ int len] : : Specifies the time, in milliseconds, for which to suspend execution. A value of zero causes the thread to relinquish the remainder of its time slice to any other thread of equal priority that is ready to run. If there are no other threads of equal priority ready to run, the function returns immediately, and the thread continues execution. A value of (-1) INFINITE causes an infinite delay
Return: None.
exec(string action, string path, string parameter) : execute a file or an application from PocketC applets
- [ string action] : action, It can be "open"
- [ string filepath] : file path to the executable
- [ string parameter] : executable's parameter
Return: None
loadres(int resourceid) : First, define resource by using preprocessor #resource. The format is #resource id "valid file path". During runtime use function loadres(int resourceid) to obtain the resource file path. The resource file is compiled with the application
- [ int resourceid] : Resource ID.
Return: valid file path to the resource file
showhelp(string filepath) : Launch help file
- [ string filepath] : a valid filepath to a help file.
Return: 1 for success, 0 for fail.
beep(int soundtype) : generates a system sound,
- [ int soundtype] : between 0 and 3, Available sounds are default 0, asterisk 1, exclamation 2, hand 3
Return: None
wave(string wavfile,int flag) : play a wave file, SND_ASYNC The sound is played asynchronously and sndPlaySound returns immediately after beginning the sound, To terminate an asynchronously played sound, call wave with flag set to -1, SND_LOOP The sound plays repeatedly until wave is called again with the flag parameter set to -1, SND_NOSTOP If a sound is currently playing, wave immediately returns FALSE, without playing the requested sound, SND_SYNC The sound is played synchronously and wave does not return until the sound end
- [ string wavfile] : full filepath to a wavfile
- [ int flag] : integer flag value for how to play the wave file SND_SYNC 0, SND_ASYNC 1,SND_LOOP 2,SND_NOSTOP 3,SND_STOP -1
Return: None
strgetc(string str, int index) : get a character at index position from a string, index starts at 0, For example: strgetc("Hello", 4); it will return character 'o';
- [ string str] : a short string ,
- [ int index] : zero based index value
Return: Returns a character,
string strsetc(string str,int index, char ch) : returns a string value with modified character at index position, For example: string retstr; retstr = strsetc("Hello",4,'e'); retstr will have string value "Helle",
- [ string str] : a short string ,
- [ int index] : zero based index value ,
- [ int ch] : a character
Return: Returns a modified string
strlen(string str) : returns the length of a string,
- [ string str] : a short string
Return: return string length
strmid(string str, int first, int len) : returns a string which consists of len characters from the original string starting at first character, (e,g, strmid(“Hello”, 1, 3) returns “ell”)
- [ string str] : a string
- [ int first] : start index position
- [ int len] : length
Return: return a substring
strleft(string str, int len) : returns the len leftmost characters from the string,
- [ string str] : a short string
- [ int len] : integer length
Return: return a substring
strright(string str, int len) : returns the len rightmost characters from the string,
- [ string str] : a short string
- [ int len] : integer length
Return: return a substring
strupr(string str) : returns the original string in all uppercase,
- [ string str] : a short string
Return: return an uppercased string
strlwr(string str) : returns the original string in all lowercase,
- [ string str] : a short string
Return: return an lowercased string
strrchr(string str,char ch) : Scan a string for the last occurrence of a character,
- [ string str] : a short string
- [ char ch] : character to search for
Return: return -1 if not found, otherwise char index value in the string
strchr(string,char) : Scan a string for the first occurrence of a character,
- [ string str] : a short string
- [ char ch] : character to search for
Return: return -1 if not found, otherwise char index value in the string
strspn(string src,string charset) : Find a substring in a string, Returns an integer value specifying the length of the initial segment of string that consists entirely of characters not in strCharSet,
- [ string str] : a short string
- [ string chset] : a set of character to search for,
Return: If string begins with a character that is in strCharSet, the function returns 0, No return value is reserved to indicate an error,
strrvrs(string) : reverse string order
- [ string str] : a short string
Return: retuns the input string in reverse order
isalphanum(char ch) : routines returns true if c is a particular representation of an alphabetic or numeric character
Return: return nonzero means it is a alphabetic or numeric character, 0 means it is not,
isalpha(char ch) : routines returns true if c is a particular representation of an alphabetic character
Return: return nonzero means it is a alphabetic character, 0 means it is not,
strncmp(string1,string2,int count) : Compare characters of two strings at first count characters, string1, string2 Strings to compare, count Number of characters to compare,
- [ string str1] : a short string
- [ string str2] : a short string
- [ int count] : number of characters to compare
Return: return 0 means equal, -1 means str1 less than str2, 1 means str1 greater than str2
hex(int ival) : convert an integer to a hex representations string
Return: return value in hex string
format(float fval, int precision) : format a float value to a string
- [ float fval] : a float value
- [ int precision] : decimal places.
Return: return a string
islower(char ch) : routines returns true if c is lower case
Return: return 0 means false, 1 means true
isupper(char ch) : routines returns true if c is upper case
Return: return 0 means false, 1 means true
getmonth() : return current month number
Return: return current month number
getyear() : return current year number, ex: 1998
Return: return current year number, ex: 1998
ticks() : the number of clock ticks since last reset
Return: return the number of clock ticks since last reset
getsec() : return current second
Return: return current second
getmin() : return current minute
Return: return current minute
gethour() : return current hour
Return: return current hour
getday() : return current day
Return: return current day
dbenum(int bFirst, int dbtype) : Enumerate all the databases.
- [ int bFirst] : Use 1 to get the first database. After that, just keep using 0 until dbenum returns 0.
- [ int dbtype] : use 0 if you want to see all database. If you want to see one type of database, use that type's id.
Return: dbenum returns one database object id each time it is called. Once all of the databases are enumerated, dbenum returns 0. You will need the object id to find out more about the database.
dbname(int oid) : Find out database name base on its OID
Return: database name as a string
dbsize(int oid) : Find out database physical storage size in bytes.
- [ int oid] : database object ID
Return: returns database physical storage size in bytes. If failed, returns 0
dbnrecs(int oid) : Find out database records count.
- [ int oid] : Database Object ID
Return: return total records in the database. If failed, return 0
dbrecpropcnt() : Find out the number of properties in the current record.
Return: returns number of properties in the current record. If failed, return -1.
dbrecproptype(int index) : Each property has a type. CEVT_I2 A 16-bit signed integer. CEVT_I4 A 32-bit signed integer. CEVT_LPWSTR A null-terminated string. CEVT_UI2 A 16-bit unsigned integer. CEVT_UI4 A 32-bit unsigned integer.
- [ int index] : index position of one property
Return: returns the property type by using its index
dbrecpropval(int index) : Find out property value by using its index
- [ int index] : index position for the property
Return: possible return type is int and string for the property value
dbseek(int seektype, int dwValue) : seek the record depends on the seek type and seek value
- [ int seektype] : determine the type of seek operation
- [ int dwValue] : input value depend on the seek operation.
Return: Returns record object id. If failed, return 0.
dbrecwrite(int rec_oid, int prop_type, int prop_id, void prop_value) : You can obtain the rec_oid by using dbrecnow(). If rec_oid is 0, a new record will be written.
- [ int rec_oid] : Each record in the database has its own object identifier.
- [ int prop_type] : each property has a property value.
- [ int prop_id] : each property can have its own identification. This id is simply an positive integer value which can be decided by the developer.
- [ void prop_value] : depends on the type you supplied in prop_type. If prop_type is a CEVT_I4 a 32 bit signed integer, you better have an integer for prop_value.
Return: an integer which is record object id for the record you just wrote in.
dbrecread(int proptype, int propid) : Read one specific property from the database
- [ int proptype] : property type
- [ int propid] : property object id
Return: return the value for the property. You can cast the return valuet into the type of value you wanted.
dbrecdelprop(int recoid, int proptype, int propid) : Delete one property from the record.
- [ int recoid] : record object id
- [ int proptype] : record property type
- [ int propid] : the property ID.
Return: returns record id if successful. If function failed, return 0.
dbrecdel(int recoid) : Delete one record
- [ int recoid] : record object ID
Return: 1 indicates success. 0 indicates failure. The function could fail when you pass into a wrong or invalid record object id
dbrecnow() : Get current record object id. When you are iterating through the database, you can obtain the current record object id by call dbrecnow.
Return: 0 indicates failure. The function should return the record object id for the current reading/writing record
dbdelete(int dboid) : delete one database
- [ int dboid] : database object id
Return: 1 indicates success. 0 indicates failure. The function could fail when you pass into a wrong or invalid database object id or another program is using the database at this moment.
dbcreate(string name, int dbtype) : Create a new database. For detail information check out detailed database documentation online
- [ string name] : database name
- [ int dbtype] : database type. The database type is up to developer to define.
Return: if dbcreate is successful, it returns an integer. This integer is the object identifier for your database. It can be used to open the database you just created. see dbopen for detail.
dbopen(int oid, string name) : You can specify either object id or name to open the database. If you know the function name only, just use 0 for the object ID. If you know the function object ID only, just use an empty string "" for the database name parameter.
- [ int oid] : Object ID which identify one database. Database Object ID: An integer which identify the database. It can be obtained by using dbcreate or dbenum.
- [ string name] : database name.: The name can be up to 32 characters long. If you pass a longer name, the first 32 characters will be treated as the database name. All databases will be placed in the \Database folder.
Return: If the database is opened, the return value is the object id of this database. Otherwise, the return value is 0.
dbclose() : Close database
Return: 1 means the database is closed. 0 means the function failed to close the database
free(pointer ptr) : releases the memory of the block pointed to by ptr which was previously allocated by malloc(). When the program exits, all blocks that are still allocated will automatically be freed to prevent memory leaks.
- [ pointer ptr] : memory pointer obtained by using malloc(int size) function.
Return: None.
settype(pointer ptr, int size, char type) : set the memory block variable type. Use this function only on memory allocated by malloc().
- [ pointer ptr] : pointer to memory allocated by malloc(int size) function.
- [ int size] : memory size.
- [ char type] : the type of the variable. ('i' for int, 'f' for float, 'c' for char, 's' for string)
Return: Returns 0 if an error occurred
typeof(pointer ptr) : find out the type of dynamic allocated variable's type
- [ pointer ptr] : pointer to memory allocated by malloc(int size)
Return: returns the type of the value pointed to by ptr, ('i' for int, 'c' for char, 'f' for float, 's' for string, 'o' for other)
memcpy(pointer dest, pointer src, int size) : copies the data from the block of size size pointed to by src to the block pointed to by dest. The types of the destination values is not preserved. (i.e. if dest points to a string, and src points to an int, the memory pointed to by dest will be changed to an int)..
- [ pointer desk] : destination memory pointer
- [ pointer src] : source memory pointer
- [ int size] : memory size that needs to be copied.
Return: None
malloc(int size) : Allocates a block of size values of type [int], but of undefined value.
- [ int size] : size of memory block
Return: Returns a pointer to the block or 0 on failure.