Funcky's Using Zhang Jianzi 01-6-26 04:31:30
Funcky is a PowerBuilder application library that provides 16-bit and 32-bit application libraries, which contain a large number of underlying functions, eliminating developers to write dynamic link libraries to process dynamic link libraries to handle many commonly used, such as files. Operation, string operation, bit operation, and so on. Use Funcky to greatly increase the opening effect. This is a simple explanation of what is in PowerBuilder to use funcky.
Add Funcky to your application
Funcky provides 16-bit and 32-bit RV Funcky.dll, Funcky16.PBL and Funcky32.dll, Funcky32.pbl, the function or processes of the application program call and the PBL file are in the dynamic link. After installation of Funcky, two dynamic link libctions are copied to the SYSTEM directory of Windows, and the two PBLs are in the installation of the installation. If you use the function that will be used in the Global External Function or Local External Function that is used, if you need to use a full function, you can add the entire PBL file to the search library you applicable. Function prototype definitions can be obtained from the help of the correspondence.
In addition to the functions provided in the help file, some unappneated functions in Funcky.dll are called in Funcky.PBL, which can also be used.
What do you want to use in funcky?
· In applications, only the functionality of the function will be added to the function protocol, do not speak too much function, no, the runtime system can report the function of the prototype.
· If you only need to use a small amount of functions, users don't add funcky.pbl to applications, because it will require a large amount of function protocol to compile;
· Some function prototypes are defined in "_", these functions are defined in funcky.pbl, and the user can use the function directly, copy the code in Funcky.pbl to your own PBL, or yourself Write related PowerBuilder functions.
Funcky function classification
Funcky has a total of 12 functions:
· Bit Operation Function
· Block and memory operation functions
· Data conversion function
· DBF file access function
· Disk access function
· DOS ring function
· Japanese function
· Low-level file operation function
· Transform function
· String operation function
· System resource function
· Time exercise function
for example
Let me give a few examples under the next side to explain the use of these functions. We have focused on DBF file access, block operation and memory operation, low-level document operation, etc. This is the most used in applications, while Powerbuilder is not available. 1. We often encounter problems in PowerBuilder to meet the status of the image storage and display, and in this, Powerbuilder's processing is weak, and in practice, there is often no way to reach the user's requirements in practical applications. We can use the function of FuNcky to handle the image file.
For example, storage, query, display, and print photos are required in applications. The general developers use OLE embedded methods, but if the specifications of each photo obtained is not exactly exactly, the effect of displaying and printing is very poor, using This method is almost unavailable in making a pass or ID card. To solve this problem, the simpler method used is to store image data in the database in the database format, display / print, and save the data locally to a temporary file, and the equivalence zoom display according to the size of the image. On the image control, it can achieve the requirements of the interface and achieve high quality images. We can solve this several issues by helping the Funcky function:
o Bitmap image file storage efficiency is not high, the space occupied in the database is too large, and can use the fcompress function to compress the image file before departure:
Function sound:
Function Long FcomPress (String S, String D)
Library "funcky32.dll"
/ / Define the compression function original
Script:
Retcode = fcompress (ls_path, "_tmp.tmp")
//Compressed file
Choose Case Retcode
... // Check the return value
End chaoose
... // Save the compressed file to the database
Fdcompress is not high, but the speed is very fast, or the value is used.
o Bitmap image The width and high preservation of the article In Section 18 and 22 of this document, it is difficult to read the two bytes of information without the Funcky function. The next step is to decompress and calculate the width and high of the BMP image.
Function sound:
/ / Define the prototype of reading a long molding function from binary data
Function long _blope (Ref blob b, uint o)
Library "funcky32.dll"
// Define the decompression function original
Function Long Fdcompress (String S, String D)
Library "funcky32.dll"
Script:
... // Save data from the database in file $ fd.bmp
Status = fdcompress ("$ fgd.bmp", "_ fgg.bmp") // decompression
Choose Case Status
... // Check the return value
End chaoose
... // Read _fgd.bmp to BLOB Variable PIC
Ll_width = _blob2long (pic, 18) // read image width
LL_HEIGHT = _blob2long (PIC, 22) // Read Image Height
/ / According to the specified wide and high computational zoom
BILI_WIDTH = INTEGER (SLE_WIDTH.TEXT) / LL_WIDTH
Bili_height = INTEGER (SLE_HEIGHT.TEXT) / LL_HEIGHT
/ / Get display width and height
P_Width = LL_WIDTH * min (bili_width, bili_height)
p_HEight = ll_height * min (bili_width, bili_height)
We can see the use of the Funcky function, which is uncommon, and can easily make it difficult to act in PowerBuilder.
2. In the application, you may have two cases of reading the DBF file. The method of processing such a problem generally has two classic methods: First, read the DBF file using the data window, and the other is to specify a disk directory as the data area. Connect this directory with ODBC, specify that the user must copy the DBF file to this directory when using. But these two methods are lack of spiritual activity, but in Funcky, it provides a function of direct reading DBF files. There is a DBFFIELDGET () function in Funcky32.pbl to obtain the field name of the DBF file. It is not possible to write a code that implements the functionality from your own hand.
Defining external functions:
Function Long DBFOPEN (String F, INT O)
Library "funcky32.dll"
Function Boolean DBFEOF (Long D)
Library "funcky32.dll"
Function Int dbfclose (long d)
Library "funcky32.dll"
Function Long DBFSKIP (Long D, Long C)
Library "funcky32.dll"
Function uint DBFFIELDSIZE (long D, INT P)
Library "funcky32.dll"
Subroutine_dbffieldget (Long D, Int P, Ref string b)
Library "funcky32.dll"
Function Int dbffieldpos (Long D, String N)
Library "funcky32.dll"
Script:
// Open the DBF database in a way to read and refuse other users
Do while 1 = 1
DBF = DBFOPEN (LS_FILE, 2 32)
IF dbf <> 0 THEN
exit
END IF
loop
// read DBF data
// ii_xx_count is the total number of DBF fields that need to be read
// is_dbf [] is a field name array do while not dbfeof (dbf)
For i = 1 to II_xx_count
P = dbffieldpos (DBF, Upper (is_dbf [i])))
// Get the location of the field
LS_TMP = Space (DBFFIELDSIZE (DBF, P) 1)
/ / Initialize the variable stored data according to the size of the field
_DBFFIELDGET (DBF, P, LS_TMP)
// Read the data into the LS_TMP
NEXT
DBFSKIP (DBF, 1)
/ / Make DBF operations to the next record
loop
DBFClose (DBF)
// Close the open DBF file
This is straightforward to read DBF information, which gives the good place to use to use it.
3. For the user of the data library, we will use information on the data library to build a table, record user name, password, etc., when the user logs record, the information to be retrieved, the same user input is entered. According to the regulations of the general system, each user's password is not available in the system. Even the system management is only the right to delete the login, and the password of the user is not acquired. It can be made by the systemic managers to read each table in the database, because he is an organic will see the user's login mouth order, and this should be encrypted before the downtrend is stored in the password. Funcky provides an Encrypt () function and decrypt () function can be used to finish this work, which avoids the number of joys of program workers to write an encryption algorithm.
In addition, Funcky has many underlying operations under the 16-bit Windows, including the interrupted calls and direct operations of the magnetic disk, can be used in software, which is not described in detail here. In general, Funcky provides more functional capabilities, and the conditional readers can try to use in the subsequent application, and the letter will give the PowerBuilder's open band.