Funcky is a PowerBuilder application library that provides 16-bit and 32-bit application libraries that contain a large number of underlying functions, eliminating the ability of developers to write in the C language themselves The dynamic link library handles many common functions such as file manipulation, string manipulation, bit manipulation, and so on. The use of funcky can greatly improve the development efficiency. This article briefly describes how to use Funcky in PowerBuilder. Add Funcky to your application Funcky provides 16-bit and 32-bit runtime Funcky.dll, FUNCKY16.PBL and Funcky32.dll, FUNCKY32.PBL, application-called functions Or procedure is in the dynamic link library and the PBL file. After installing Funcky, two dynamic link libraries are copied to the Windows system directory, and two PBL is under the installed directory. The function to be used in the application of the global External function or the local External function in the corresponding declaration can be used, if you need to use all the functions of the entire PBL The file is added to the search library you are applying. The function prototype definition can be obtained from the corresponding function help. In addition to the functions provided in the Help file, there are other non-public functions in the funcky.dll that are called in FUNCKY.PBL and can be used by the user of the function. Some points to be noted in using Funcky · In the application, the function is added to the function prototype declaration, do not declare too many function prototypes, otherwise the runtime system may report the function prototype mismatch error; · If you want to use only a small number of functions, users should try not to add FUNCKY.PBL to the application, because that will require a large number of function original Type declaration can be compiled through; · Some function prototypes are defined as "_", which are defined in FUNCKY.PBL and can be used directly by the user to copy the code in FUNCKY.PBL directly to their own PBL , or write the related PowerBuilder function yourself. Funcky function Classification Funcky provides 12 classes of functions altogether: · Bitwise action Function · Block and memory operation functions · Data Conversion Functions · DBF File Access function · Disk Access function · DOS Environment Function · Date function · Low-level file manipulation functions · Conversion Functions · String manipulation functions · System Resource Functions · Examples of time operation functions let me give you a few examples to illustrate the use of these functions. We focus on the DBF file access, block operations and memory operations, low-level file operations, such as these types of functions, which are often used in applications, and PowerBuilder itself does not provide The operation. 1. We often encounter problems with image storage and display in PowerBuilder applications, and in this regard, the PowerBuilder itself is weak in its handling function and often cannot be reached in practical applications. To the user's request. We can use the Funcky function to process the image file. For example, when you need to store, query, display, and print photos in your application, the general developer uses OLE embedding to do it, but if you get a different specification for each picture , so that the display and printing of the effect is very poor, the use of this method to make a pass or ID on the photo is almost not available. The simpler way to solve this problem is to store the graph in the database in bitmap format Like data, display/print, the data will be taken out of the local save as a temporary file, according to the size of the image scaling zoom display on the image control, so as to meet the requirements of the interface , and the quality of the image can be obtained. We can use the Funcky function to solve such a few problems: O Bitmap image file storage efficiency is not high, the space occupied in the database is too large, can be stored before the Fcompress function to Image file compression: function declaration: Functions Long Fcompress (String s,string D) LIBRARY "FUNCky32.DLL"//define compression function prototype Script:retcode = FCOMPR ESS (Ls_path, "_tmp.tmp")/zip file choose case retcode...//Check return value end choose...//Save compressed file to database fdcompress compression efficiency is not high, but the speed is very Fast, or it's worth using. o Bitmap image width and height preserving the 18th and 22nd bytes of the file, it is difficult to read the two-byte information without the Funcky function. The following is a program that is to decompress and compute BMP images with wide and high function declarations://definition reads a long shaping function from binary data the prototype functions long _blob2long (ref blob B, uint O) LIBRARY "FUNCky32.DLL"//defines the Decompression function prototype function long fdcompress (string s,string D) LIBRARY "FUNCky32.DLL" SCRIPT: ...// Remove data from database save in file $fgd.bmp status = Fdcompress ("$FGD. bmp", "_fgd.bmp")/decompression Choose case status...//Check return value End choose...//will _fgd.bmp read into blob variable picll_width = _blob2long (pic,18Height = integer (sle_height.text)/ll_height//Get display width and height p_width = ll_width * min (bili_width, bili_height) p_height = ll_he ight * min (bili_width, bili_height) we can see the Funcky function is very simple to use, can easily do in the powerbuilder of operations difficult to implement. 2. In the application you may encounter directly read the DBF file, the method of dealing with this kind of problem generally has two kinds of classical methods: first, using the Data window to read DBF files , the second is to specify a disk directory as the data area, with ODBC connection to this directory, the user must be used to copy DBF files to this directory. However, both methods lack flexibility, while in Funcky, the function of directly reading DBF file is provided. There is a dbffieldget () function in FUNCKY32.PBL to get the name of the field for the DBF file. However, according to our "Try not to use FUNCKY32.PBL" principle, we write a code that implements this function by hand. Define external functions: Function long Dbfopen (string f, int o) library "FUNCky32.DLL" function Boolean dbfeof (long D) Library "funcky32.d LL "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 "Funcky 32.DLL "FUNCTION int dbffieldpos (long d,string N) LIBRARY" FUNCky32.DLL "script://open DBF database in read-write and deny-write to other users do while 1 = 1DBF = Dbfopen (Ls_file, 2 +) if DBF <> 0 thenexitend ifloop//read DBF data//ii_xx_count is the total number of DBF fields that need to be read//is_dbf[] is an array of field names doing while Not dbfeof (DBF) for i = 1 to ii_xx_countp = Dbffieldpos (DBF, Upper (Is_dbf[i))//Get the position of the field ls_tmp = Space (Dbffieldsize (DBF, p) + 1)//depending on the size of the field initialize the variables that hold the data _dbffieldget (DBF, p, ls_tmp)//Read the data into the Ls_tmp Nextdbfskip (DBF, 1)//Make the DBF operation point to the next record Loopdbfclose ( DBF)//Close open DBF file so that directly read DBF information, the benefits to the application is obvious. 3. For the database user management, we generally use in the database to create a table, record the user name, password and other information, in the user login, application to retrieve this table information , check with the user input content. According to the general system management, each user's password, other people can not be found in the system. Even a system administrator can only remove the user's password by removing the rights of the logged-on user. However, because the system administrator can read each table in the database, he will have the opportunity to see the user's login password, so we should encrypt the password field before it is stored in the database. Funcky provides the Encrypt () function and the decrypt () function to complete this work, which avoids the trouble of programmers writing cryptographic algorithms by hand. In addition, Funcky has many low-level operations under 16-bit Windows, including interrupt calls and functions that directly manipulate the disk, which can be used for software encryption, which cannot be described in detail here. In short, Funcky provides more function functions, conditional readers can be used in future applications, I believe that the development of PowerBuilder will bring certain convenience.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.