Mnemonics "G"
From CometWiki
(Difference between revisions)
Badge (Talk | contribs)
(New page: == (Get Connection Info) == <pre> Mnemonic: (Get Connection Info=server-number, node-name) Discussion: Example: </pre> == (Get Extract Info) == <pre> Mnemonic: (Get Extract ...)
Newer edit →
(New page: == (Get Connection Info) == <pre> Mnemonic: (Get Connection Info=server-number, node-name) Discussion: Example: </pre> == (Get Extract Info) == <pre> Mnemonic: (Get Extract ...)
Newer edit →
Revision as of 00:19, 1 June 2009
Contents |
(Get Connection Info)
Mnemonic: (Get Connection Info=server-number, node-name) Discussion: Example:
(Get Extract Info)
Mnemonic: (Get Extract Info=server-number, extracted-key, filename, directory) Discussion: Example:
(Get ROP2)
Mnemonic: (GetROP2) Discussion: Retrieves the foreground mix mode of the specified device context. The mix mode specifies how the pen or interior color and the color already on the screen are combined to yield a new color. The resulting mode is returned in LoWord.
(Get Server Time)
Mnemonic: (Get Server Time=server-number) Discussion: Example:
(Get Session ID)
Mnemonic: (Get Session ID) Discussion: The (GetSessionID) mnemonic returns the 32 byte ClientID and 5 byte SessionInstance (<= 99,999). History: This mnemonic was added in REL Version 02.04 and Comet Build 312. Example: If (Num(Sub(Version$, 5, 3), Err) LT 312) Then_ Return ! Error; not supported ! New COSW Version check (Comet 309) Work$ = Sts(0) CoswMajVer = Asc(Sub(Work$, 17, 1)) CoswMinVer = Asc(Sub(Work$, 18, 1)) If (CoswMinVer < 24) Return ! Error; not supported Print (GetSessionID) Input SessionID$ ! Length 37 ! Uniquely identifies computer (Never changes) ClientID$ = Sub(SessionID$, 1, 32) ! Uniquely identifies COSW session ! (Incremented each time COSW is started) SessInstance = Num(Sub(SessionID$, 33, 5), Err)
(GetBkColor)
Mnemonic: (GetBkColor) Discussion: This mnemonic returns the current background color. The return value for this function is obtained by requesting the result of the previous operation with the (GetFuncResult) mnemonic and then performing an input of the 4 byte return value. History: This mnemonic is valid in Comet98 and greater.
(GetBkMode)
Mnemonic: (GetBkMode) Discussion: The mnemonic returns the current background mode. The return value for this function is obtained by requesting the result of the previous operation with the (GetFuncResult) mnemonic and then performing an input of the 4 byte return value. History: This mnemonic is valid in Comet98 and greater
(GetDirAlias)
Mnemonic: (GetDirAlias=alias,flags) Discussion: This mnemonic returns the path name of a directory alias. Be aware that some versions of Comet include a null terminator at the end of the pathname followed by blanks for Comet Anywhere clients. The coding example below includes code to accommodate this inconsistency. This mnemonic may be used by foreground programs only. The alias is the "alias identifier" as specified in COSW (e.g., CATEMP). Flags is decimal value from the following chart: Flag Description 1 Perform function at CometAnywhere client system 2 Perform function at CometAnywhere host system. If the program is connected to CometAnywhere client, there may be two sets of directory aliases of interest. The first set is relative to the CometAnywhere HOST and the second to the CometAnywhere CLIENT. The flag values specify which set of DirAliases to access. After this mnemonic is issued, your program can issue an INPUT on LUN (0) to retrieve the path name and error information. For example: Length 2 & Local ax$,dx$ Length 254 & Local result$,alias$ Length 5.0 & Local Flags,FuncError,FileError ResultFmt: Format ax$;dx$;result$ . . Print (GetDirAlias=alias$,Flags) Input (0,ResultFmt) The first field, AX$, contains the function error code, and the second field, DX$, contains the suberror code (aka the Windows file error code). Both of these fields are in Intel 2's complement format, and should be processed as follows: FuncError = IHexDec(ax$) ! Function error code (decimal) FileError = IHexDec(dx$) ! File error code (decimal) ! For unexpected values, convert to 2's complement signed integer If (FuncError > 32767) FuncError = FuncError-65536 If (FileError > 32767) FileError = FileError-65536 result$ = strip(result$) If RSub(result$,1,1) = "@00@" result$ = RSub(result$,2,254) ! Strip null terminator if there (before Build 392 only) Here is a list of the function error codes in decimal form: Error (FuncError) Description 0 Function not supported 1 Success 2 CometAnywhere required 3 Source file error (see suberrors) 4 Aborted by user 5 Function in progress Here is a list of the suberror codes (common Windows file errors) in decimal form: Suberror (FileError) Description 0 Success 2 File not found 3 Path not found 5 Access denied 12 Invalid access 15 Invalid drive 16 An error has occurred in the current directory 18 No more files 32 Sharing violation 33 Lock violation 80 File exists 161 Bad pathname History: This mnemonic was added in Comet Build 299 and REL Version 01.07. Trailing @00@ was removed in build 392.
(GetFontInfo)
Mnemonic: (GetFontInfo = item-code) Discussion: This mnemonic returns the font information specified by item-code. Where item-code is: PTR.FONT.HEIGHT - Specifies the height (ascent + descent) of characters PTR.FONT.EXTLEADING - Specifies the amount of extra leading (space) that the application adds between rows. Since this area is outside the font, it contains no marks and is not altered by text output calls in either OPAQUE or TRANSPARENT mode. May be 0. PTR.FONT.AVECHARWIDTH - Specifies the average width of characters in the font (generally defined as the width of the letter x). This value does not include the overhang required for bold or italic characters. PTR.FONT.MAXCHARWIDTH - Specifies the width of the widest character in the font. PTR.FONT.WEIGHT - Specifies the weight of the font. History: This mnemonic is valid in Comet98 and greater.
(GetFuncResult)
Mnemonic: (GetFuncResult) Discussion: Requests the 32 bit (4 byte) result of the last printer or GDI function. This function must be followed immediately by an INPUT statement to receive the value into the Internet Basic program. History: This mnemonic is valid in Comet98 and greater. Example 1: ! Variables for GetFuncResult Length 2 & Local Word$ ! Temporary 2 byte word holder Length 4 & Local Result$ ! 4 byte string result Length 5.0 & Local LoResult, HiResult ! Lower/upper 16 bit value Length 10.0 & Local BigResult ! 32 bit value ! Variables for GetPageSize Length 5.0 & Local PageWidth, PageHeight ! Printable page size ! Program segment . . Gosub GetPageSize ! Define printer page size . . GetPageSize: Print (LUN) (GetPageInfo = PTR.PAGEINFO.PRINTABLESIZE) Gosub GetFuncResult ! Get low and high 16 bit results PageWidth = LoResult ! Store resulting page width PageHeight = HiResult ! Store resulting page height Return GetFuncResult: Print (LUN) (GetFuncResult) ! Request result Input (LUN) Result$ ! Input result Word$ = SUB(Result$,2,1)+ Result$ ! Get and reverse 1st 2 bytes LoResult = HEXDEC(Word$) ! Convert to numeric Word$ = SUB(Result$,4,1)+SUB(Result$,3,1) ! Get and reverse 2nd 2 bytes HiResult = HEXDEC(Word$) ! Convert to numeric BigResult = HiResult*65536+LoResult ! Combined 32 bit numeric value Return Example 2: ! Variables for GetFuncResult Length 2 & Local Word$ ! Temporary 2 byte word holder Length 4 & Local Result$ ! 4 byte string result Length 5.0 & Local LoResult, HiResult ! Lower/upper 16 bit value Length 10.0 & Local BigResult ! 32 bit value ! Variables for GetBkMode Length 5.0 & Local PrevBkMode ! Program segment . . Gosub GetBkMode . . GetBkModeSize: Print (GetBkMode) Gosub GetFuncResult ! Get lresults PrevBkMode = LoResult ! Store resulting mode Return GetFuncResult: Print (LUN) (GetFuncResult) ! Request result Input (LUN) Result$ ! Input result Word$ = SUB(Result$,2,1)+ Result$ ! Get and reverse 1st 2 bytes LoResult = HEXDEC(Word$) ! Convert to numeric Word$ = SUB(Result$,4,1)+SUB(Result$,3,1) ! Get and reverse 2nd 2 bytes HiResult = HEXDEC(Word$) ! Convert to numeric BigResult = HiResult*65536+LoResult ! Combined 32 bit numeric value Return
(GetPageInfo)
Mnemonic: (GetPageInfo = item-code) Discussion: This mnemonic returns the information specified in item-code. Valid PtrItem values: PTR.PAGEINFO.PRINTABLESIZE Dimensions of printable area (Width, Height) PTR.PAGEINFO.PHYSICALSIZE Physical page size (Width, Height) PTR.PAGEINFO.PHYSICALOFFSET Offset to start of printable area (Left, Top) PTR.PAGEINFO.LOGPIXELS Number of pixels per inch (Width, Height) The return value for this function is obtained by requesting the result of the previous operation with (GetFuncResult) and then performing an input of the 4 byte return value. The paired values are returned in LoResult and HiResult respectively. History: This mnemonic is valid in Comet98 and greater.
(GetSessionPrinter)
Mnemonic: (GetSessionPrinter) Discussion: The (GetSessionPrinter) mnemonic returns the current name of the session printer. The returned printer name will be either the printer name established by the user via the File/Print Setup dialog, or a temporary name established by an Internet Basic program that issued via the SetSessionPrinter mnemonic. See (SetSessionPrinter). History: This mnemonic was added in Comet2000 Build 300 and requires require REL Version 02.01 or greater. Example: Print (GetSessionPrinter) Input Data$ Print "The current session printer is: ";Data$
(GetSystemTime)
Mnemonic: (GetSystemTime=FormatString) Discussion: The (GetSystemTime) mnemonic returns the system date and time in one of many formats depending on the FormatString supplied as the parameter. When issued to LUN 0 (the terminal) it returns the information for the client computer. When issued to a LUN where the system device "X00" has been opened, it returns the information for the host. If you are not a CometAnywhere client either format returns your workstation's local time. If the (GetSystemTime) mnemonic fails it returns an empty string. The possible FormatString values and their meanings are: %a Abbreviated weekday name %A Full weekday name %b Abbreviated month name %B Full month name %c Date and time representation appropriate for locale %d Day of month as decimal number (01 – 31) %H Hour in 24-hour format (00 – 23) %I Hour in 12-hour format (01 – 12) %j Day of year as decimal number (001 – 366) %m Month as decimal number (01 – 12) %M Minute as decimal number (00 – 59) %p Current locale’s A.M./P.M. indicator for 12-hour clock %S Second as decimal number (00 – 59) %U Week of year as decimal number, with Sunday as first day of week (00 – 53) %w Weekday as decimal number (0 – 6; Sunday is 0) %W Week of year as decimal number, with Monday as first day of week (00 – 53) %x Date representation for current locale %X Time representation for current locale %y Year without century, as decimal number (00 – 99) %Y Year with century, as decimal number %z,%Z Time-zone name or abbreviation; no characters if time zone is unknown %#c Long date and time representation, appropriate for current locale %#x Long date representation, appropriate to current locale %#d, %#H, %#I, %#j, %#m, %#M, %#S, %#U, %#w, %#W, %#y, %#Y = Remove leading zeros History: This mnemonic was added in REL Version 07.04 and Comet Build 380. Example: Length 100 & Local SysTime$ Length 20 & Local Format$ Set HostLun = 1 . . . Open(HostLun) "X00" Format$ = "%#c" ! Get long date and time representation appropriate for locale Print (GetSystemTime = Format$) Input SysTime$ if (SysTime$ EQ "") Goto FmtError Print "Client Time = ";SysTime$ Print (HostLun) (GetSystemTime = Format$) Input (HostLun) SysTime$ if (SysTime$ EQ "") Goto FmtError Print "Host Time = ";SysTime$ . . . FmtError: Print "Invalid format string for GetSystemTime" wait stop
(GetTextAlign)
Mnemonic: (GetTextAlign) Discussion: Returns the current text alignment Flags. The resulting flags are returned in LoWord. History: This mnemonic is valid in Comet98 and greater.
(GetTextColor)
Mnemonic: (GetTextColor) Discussion: Returns the current text color. History: This mnemonic is valid in Comet98 and greater.
(GetTextExtent)
Mnemonic: (GetTextExtent);printable-text Discussion: This mnemonic measures the size (width and height) of the specified printable-text. The resulting width and height are returned in LoWord and HiWord (respecively). The return value for this function is obtained by requesting the result of the previous operation with (GetFuncResult) and then performing an input of the 4 byte return value. History: This mnemonic is valid in Comet98 and greater. == Graphics Device Interface (GDI) mnemonics == Miscellaneous Functions Mnemonic Description (AllowMaximize = state) Disables/enables the maximize controls on the COSW window (PlaySound = WavFileName, flags) Plays the specified WAV file (GetFuncResult) Requests the 32 bit (4 byte) result of the last GDI function Metafile Functions Mnemonic Description (BeginMetafile = filename) Create and begin using the specified metafile (EndMetafile = flags) End the metafile collection process by saving and/or executing the currently active metafile (ExecuteMetafile = filename) Executes the previously saved metafile (AutoMetafile = state) Enables/disables the automatic use of un-named metafiles Wallpaper Functions Mnemonic Description (TransparentColor = QCRT color) Determines the QCRT field color that will be transparent to the underlying wallpaper (WallpaperBitmap = filename) Creates a wallpaper (background) bitmap by tiling the specified bitmap file to fit the currently active Comet window (WallpaperColor = Red,Green,Blue) Creates a wallpaper (background) bitmap using the specified RGB colors to fit the currently active Comet window (WallpaperClear) Clears the wallpaper bitmap in the currently active Comet window to its original state (WallpaperRemove) Removes the wallpaper bitmap in the currently active Comet window, restoring the window to its normal QCRT operation Text & Font Functions Mnemonic Description (MapMode = Mode) Sets the current coordinate mapping mode (SelectFont);LogFontData Selects the font specified by the LogFontData structure (GetFontInfo = ItemCode) Returns the font information specified by ItemCode (SetTextColor = Red,Green,Blue) Sets the current text color as specified by Red, Green, Blue (GetTextColor) Returns the current text color (SetBkColor = Red,Green,Blue) Sets the current background color as specified by Red, Green, Blue (GetBkColor) Returns the current background color (SetBkMode = Mode) Sets the background mode specified by Mode (GetBkMode) Returns the current background mode (SetTextAlign = Flags) Sets the text alignment mode to that specified by Flags (GetTextAlign) Returns the current text alignment mode (GetTextExtent);Printable Text Measures the size (width and height) of the specified Printable Text (TextOut = X,Y);Printable Text Prints the specified Printable Text at the location specified by X and Y (DrawText = Left,Top,Right,Bottom,Flags);Printable Text Prints the specified Printable Text into the rectangle specified by the coordinates Left, Top, Right, and Bottom using the format codes specified in Flags Graphics and Drawing Functions Mnemonic Description (SelectPen = Style,Width,Red,Green,Blue) Selects the pen described by Style, Width and Red, Green, Blue (SelectSolidBrush = Red,Green,Blue) Selects the solid brush described Red, Green, Blue (SelectHatchBrush = Style,Red,Green,Blue) Selects the hatched brush described Style and Red, Green, Blue (MoveTo = X,Y) Moves the current location pointer to the location specified by X and Y (LineTo = X,Y) Draws a line using the currently selected pen from the current location pointer to the location specified by X, Y (Ellipse = Left,Top,Right,Bottom) Draws an ellipse bound by the rectangle specified by Left, Top, Right, Bottom using the currently selected pen and brush (Rectangle = Left, Top, Right, Bottom) Draws a the rectangle specified by Left, Top, Right, Bottom using the currently selected pen and brush (RoundRect = Left,Top,Right,Bottom,CornerWidth,CornerHeight) Draws a rectangle with corners rounded using the ellipse specified by CornerWidth and CornerHeight at the location specified by Left, Top, Right, Bottom using the currently selected pen and brush (DrawBitmap = Left,Top,Right,Bottom,ScaleX,ScaleY,Flags); Draws the bitmap contained in the file (.BMP/.JPG) specified in FileName in the rectangle specified by Left, Top, Right, Bottom using the format codes contained in Flags. Scaling factors can be specified in ScaleX, ScaleY (SetROP2 = Mode) Sets the current foreground mix mode (GetROP2) Returns the current foreground mix mode