ZQLIB1.1 library introduction
Not long ago, I organized some similar and routine-natureful applets that I used to write programs, said big, but many programs often used, so I took a little time. I'm sorting, put it here and the beautiful name of ZQLIB1.1. If you use it well, you can indeed reduce the lot of program code, I have had such an experience. ZQLIB1.1 is a library that is only suitable to BCB, I am debugged in WinXP BCB6, if you are interested in this library, try it. The zqlib library is mainly composed of many functions. I will be classified according to the function. If I don't follow the way, I think a single function is better to use, and these functions are not well formed.
The following table is the classification of the zqlib library http://www.zccfamily.com/zqget/zqlib/zqlib.asp
Unit Name Function The zqstrings string handles related functions, compensate for the deficiencies of the Ansistring object ZQWindows and system-related functions, such as reconstruction system icons, and verify that the current system is the Win98 et al. ZQFiles and file names, path processing related functions ZQGraphics and images , Color, font-related function zqregiSTRYS with the registry processing related function zqdate and date related functions, this is provided in a class
ZQStrings
INT Countwords (Ansistring Str, Ansistring Delimiters = ");
The calculation string STR returns 2 of the single word Delimiters split, such as Countwords ("Hello, World", ",") function. If the Delimiters split is not specified, the default segment is space.
Ansistring GetSubstr (Ansistring Str, Int Start, Ansistring Delimiter = ");
The function of this function is to take a string STR to split the START sub-string after separator Delimiters, such as GetSubstr ("I am A Boy!", The return value is am, note the number as the starting number of.
Ansistring getFilenamewithoutext (ANSISTRING FILENAME);
C Builder6 provides a number of functions starting with extract, which is very useful for processing file names, but I have never found that if you get a file name without an extension, just write one, in fact, according to the name of the function. It can be seen that its function can be seen. Such as: GetFileNameWithoutext ("C: //Test.txt") function returns Test.
Ansistring EXTDOWITH (ANSISTRING FILENAME, ANSISTRING EXT);
When saving files, you typically need to handle the filename of the user with an extension, such as the user input filename = "c: / test", if this file type is txt, this call function EXTDOWITH (FileName, "TXT") The return value is c: /test.txt.
ZQWindows
Void rebuildoncache ();
According to the name of this function, you can see the function of the function. Its function is to rebuild the system icon cache. What is the use? Maybe someone will ask? This is available, when your program changes some settings of the system, such as: system color, when the system is still not updated, then the user needs to press the F5 button to refresh, but your program will not run after running. Press the F5 key to see the results, then the rebuildoncache () function will help you. Bool iswin98 ();
Even if Microsoft has been claiming "unified Win32 platform", I feel that it is only a slogan, because I rarely write software that does not need to correct the different Windows version, so I offer the function iswin98 () To determine if Win98 system is used, because Win98 is often different from the future Windows system, it needs to be handled separately.
Void delay (DWORD MSEC);
Most of the Windows programmer have used the SLEEP function. Its function is delay time, but it has a defect, that is, the thread of the program will continue to return to the Sleep function, that is to say this In the time, the program will not process the window message, so we will not make the user's operation, but there are many times we need a function, which can act as a delay time, and can handle the window message, this is delay The function is a choice.
ZQFiles
// file association
Ansistring GetAssociatedExec (Ansistring FileExt, Ansistring & FileDesc, Ansistring & MimeType);
Bool setasociatedexec (ANSISTRING FileExt, Ansistring FileType, Ansistring FileDesc, Ansistring Mimetype, Ansistring Execname);
File association plays a very important role in the program, there are many programs that have the ability to identify file types, such as Flash recognize SWF type files, how is this completed, the function of the setasSociatedExec function is the completion of the file and the corresponding program. The role of the GetAssociatedExec this function is to obtain the application associated with the file type.
Ansistring getsystempath ();
Ansistring getWindowsPath ();
Ansistring gettemporarypath ();
There is a similar function in the Win32 API, and I have to provide these functions, it is very simple, that is, it is more convenient than calling the API function, from the name of the function, it should know its function.
// Process file name and path
Ansistring getshortfilenname (ANSISTRING FILENAME);
Ansistring getParentPath (ANSISUSTRING PATH);
Ansistring getLastDirectoryName (ANSISTRING PATH);
// These three functions work separately to the short term name of the file name, get the parent path of the path PATH, get the last directory name of the path PATH
GetLasetdirectoryName ("Hello // World") Returns World String
getParentPath ("Software // ZQGet // Hello // World") Returns Software / ZQGet / Hello / String
GetshortFileName ("E: // RESOURCE // Sample // Utility // New Text Document .txt") Returns E: / Resource / Program Design / Utility / New Ask ~ 1.TXT string, the main purpose of this function is In order to compatibility with 8.3 format file name zqgraphics
Ansistring Colorgbstring (Tcolor Color);
Tcolor RGBStringTocolor (ANSISUSTRING STRGB);
Many applications need to store color information, convert color information into strings, is a good way, the two functions of this can meet this need, and the role of ColORTORGBSTRING is to convert the color of the TColor type to Red Green. Blue three primary color decimal strings, such as: Function Colorgbstring (CLRED) Returns "255 0 0",
RGBStringTocolor ("0 255 0") returns the CLGREEN value.
Void BMPTOJPEG (ANSISTRING BMPFILE, ANSISTRING JPEGFILE);
Void JPEGTOBMP (ANSISUSTRING JPEGFILE, ANSISTRING BMPFILE);
From their names, they can see their functions, BMP is converted with images of the JPG type.
// Set the tablecloth wallpaper
Void setWallpaper (INSISUSTRING WALLPAPER, INT WALLPAPERSTYLE);
The function of this function is to change the wallpaper of the desktop, which will set wallpaper according to WallPaperstyle Wallpaper style.
// font object is converted with a string, so that the current font properties can be saved, and if the font properties are used in the future, you can use StringTofont to convert the font string to TFont objects in the program. Note that the FontTostring (TFont * font) function saves the font object's Font-name, size, a style (underscore, bold, delete line, slope), color properties, and other font properties will not be saved.
Ansistring FonttoString (tfont * font)
Void StringTofont (Ansistring Fontstr, TFont * font);
// font TLogFont structure and string conversion
Ansistring logfonttoTString (Tlogfont logfont);
Void StringTologFont (Ansistring Fontstr, Tlogfont * logfont);
There is a TFONT object with a string conversion, while we are not using the TFont object in Win32, but use the TLogFont font structure to represent the font. If you want to save this information, you can use these two functions. Mutual conversion
// Translate the mouse pointer into icon
Hicon CursorToicon (HCURSOR HCURSOR);
ZQREGISTRYS
Ansistring GetKeyValue (Ansistring Regpath, Ansistring Key, Bool Isllusers);
Void SetKeyValue (Ansistring Regpath, Ansistring Key, Ansistring Value, Bool Isllusers);
These two functions get or set the character string value of the REGPATH path.
DWORD GETDWORD (Ansistring Regpath, Ansistring Key, Bool IsllUsers);
Void SetDWord (Ansistring Regpath, Ansistring Key, DWORD DWORD, BOOL ISALLUSERS);
These two functions get or set the need of the REGPATH path, the DWORD value void readsection (ANSISUSTRING Section, Tstrings * Strings, Bool IsllUsers);
Read all KEY values under section to store it in strings
Void deleteKey (ANSISUSTRING Section, Ansistring Key, Bool Isllusers);
Delete key value in the registry
Void deletesection (ANSISSTRING RegPath, Bool IsllUsers);
Delete the item specified in Regpath in the registry
INT GetSubKeynum (Ansistring Regpath, Bool Isllusers);
Get the number of subcoules of the regPath item in the registry
Int getValuenum (Ansistring Regpath, Bool Isllusers);
Get the number of keys in a certain item in the registry
ZqvClctrl
// Set the color of the VCL control
Void SetCtrlcolor (TControl * Ctrl, Tcolor Color);
Set the color of the CTRL control to Color
Void SetCtrlchildsColor (TControl * Ctrl, Tcolor Color);
Setting the CTRL control contains the color of all controls for the Color value, which is useful for setting the interface's interface.
Void SetClassCtrlColor (TControl * Ctrl, Tcolor Color);
Set the color value of the CTRL control under Ctrl controls
// Set the VCL control enabled attribute
Void setctrlenable (tcontrol * ctrl, bool enable);
Set Ctrl includes all the enabled properties of all controls under all Ctrls for Enable
Void setCtrlChildsenable (TControl * Ctrl, Bool Enable);
Enabled attributes for all controls included in Ctrl are enabled
zqdate
This file provides a class called Zqdate, you can get the current system through this class, which provides the following methods:
INT getYear (); // Get the year of the system's current date
INT getMonth (); // Get the month of the current date of the system
INT getday (); // Get the date of the system's current date
INT gethour (); // Get the hour of the system's current time
INT getminute (); // Get minutes of the system's current time
INT getsecond (); // Get the second time of the system
INT getDayofweek (); // Get the current week of the system
INT getMilisecond (); // Gets the number of milliseconds in the system current time
In use, you need to introduce zqdate.h header files, the following statement gets the year of the current date of the system.
/ / Get the year of the current date of the system
Int year = zqdate (). getYear ();