I personally think that Delphi is the best Windows visual development tool today. Its variety of features will develop such as tiger. However, if you want to play Delphi's true internal performance, such as development controls, implement some special features, you must call the Win32 API directly. Win32 API is primarily included in a Windows95 / 98 / NT / 2K system dynamic connection library such as kernel32.dll, user32.dll, gdi32.dll, shell32.dll, etc. We only join Windows and other units in the code section of the code. The statement is easy to use the WIN32 API function as using the Delphi built-in function. However, this is sometimes incompetent, it will bring some unexpected trouble. Specifically, well known, Windows has a very large version, only Win95 has Win95A, Win95B, etc., and their implementation of Win32 API is fine, although they are Win32 platforms. Some Win32 API functions have a bit different in a particular Windows version, or it is not existent. This brings problems: Delphi's Windows and other units correspond to the complete works of the latest Win32 API at the time, and Delphi always dynamically connects the Windows function library when compiling (all Windows Compilation Development Tools is like this). There is no problem with compile, which cannot be used on a specific Windows platform. Due to Windows executable file loading mechanism, it is unable to track such potential problems in the Delphi integration environment. Below, two examples: Example 1: Win32 API declaration: Function BroadcastsystemMessage; External USER32 Name 'BroadcastsystemMessagea'; (from Delphi 5 Enterprise Windows.pas: 29408) Note that after using this function, the program cannot be in the early version of Win95. Use (like Win95A) to declare the function declaration to the following, problem solving: function BroadcastsystemMessage; External USER32 name 'BroadcastsystemMessage'; // Note here! ! Example Two: Win32 API statement: function SHGetSpecialFolderPath; external shell32 name 'SHGetSpecialFolderPathA' (from Delphi 5 Enterprise ShlObj.pas: 3333) Note that the compiler use this function, the program can not be used (the Shell32.dll a Win95 version version: 4.00 .1111), because this function does not exist at all! ! At present, I have no solution to avoid such problems, there are two ways: 1: I don't directly use the Win32 API, find a third-party control (this method seems to be nonsense) 2: Dynamically add functions.
The method is as follows: ANIMATEWINDOW in Win2k as an example (for a detailed discussion of the AnimateWindow function, please go to www.9cbs.net document, VB Find Keyword AnimateWindow, thanks: iprogram) Unit XXXX; ..... TYPE FANIMATEWINDOW = Function Const hwnd: hwnd; // Only the window is valid for the window Const dwtime: DWORD; // Animation duration, default 200ms const dwflags: dword: dword; stdcall; function animatewindow (const): hwnd; const dwtime: dWord; const dwflags: DWORD): DWORD;
IMPLEMentation
function AnimateWindow (const hWnd: HWND; const dwTime: DWORD; const dwFlags: DWORD): DWORD; var DLLHandle: THandle; AnimateWindow: FAnimateWindow; begin Result: = 0; DLLHandle: = LoadLibrary ( 'user32.dll'); @AnimateWindow : = GetProcaddress (DLLHANDLE, 'AnimateWindow'); Result: = AnimateWindow (HWND, DWTIME, DWFLAGS); END;
..... End.
How is it, it's a bit of trouble, it is worth it. If you don't want your program to pick three, if you don't want yourself being called waste programmer, huh, try it.