delphiÏ̳߳ء¾×ª¡¿
[code=Delphi(Pascal)]
unit uThreadPool;
{ aPool.AddRequest(TMyRequest.Create(RequestParam1, RequestParam2, ...)); }
interface
uses
Windows,
Classes;
// ÊÇ·ñ¼Ç¼ÈÕÖ¾
// {$DEFINE NOLOGS}
type
TCriticalSection = class(TObject)
protected
FSection: TRTLCriticalSection;
public
constructor Create;
destructor Destroy; override;
// ½øÈëÁÙ½çÇø
procedure Enter;
// À뿪ÁÙ½çÇø
procedure Leave;
// ³¢ÊÔ½øÈë
function TryEnter: Boolean;
end;
type
// ´¢´æÇëÇóÊý¾ÝµÄ»ù±¾Àà
TWorkItem = class(TObject)
public
// ÊÇ·ñÓÐÖظ´ÈÎÎñ
function IsTheSame(DataObj: TWorkItem): Boolean; virtual;
// Èç¹û NOLOGS ±»¶¨Ò壬Ôò½ûÓá£
function TextForLog: string; virtual;
end;
type
TThreadsPool = class;
//Ïß³Ì״̬
TThreadState = (tcsInitializing, tcsWaiting, tcsGetting, tcsProcessing,
tcsProcessed, tcsTerminating, tcsCheckingDown);
// ¹¤×÷Ï߳̽öÓÃÓÚÏ̳߳ØÄÚ£¬ ²»ÒªÖ±½Ó´´½¨²¢µ÷ÓÃËü¡£
TProcessorThread = class(TThread)
*******
// ´´½¨Ïß³ÌʱÁÙʱµÄEvent¶ÔÏó, ×èÈûÏß³ÌÖ±µ½³õʼ»¯Íê³É
hInitFinished: THandle;
// ³õʼ»¯³ö´íÐÅÏ¢
sInitError: string;
// ¼Ç¼ÈÕÖ¾
procedure WriteLog(const Str: string; Level: Integer = 0);
protected
// Ïß³ÌÁÙ½çÇøͬ²½¶ÔÏñ
csProcessingDataObject: TCriticalSection;
// ƽ¾ù´¦Àíʱ¼ä
FAverageProcessing: Integer;
// µÈ´ýÇëÇóµÄƽ¾ùʱ¼ä
FAverageWaitingTime: Integer;
// ±¾Ïß³ÌʵÀýµÄÔËÐÐ״̬
FCurState: TThreadState;
// ±¾Ïß³ÌʵÀýËù¸½ÊôµÄÏ̳߳Ø
FPool: TThreadsPool;
// µ±Ç°´¦ÀíµÄÊý¾Ý¶ÔÏñ¡£
&
Ïà¹ØÎĵµ£º
ÔÚDelphi×Ô´øµÄIndy¿Ø¼þÖÐÆäʵÊÇÌṩÁËMD2,MD4,MD5¶ÔÏóµÄ£¬ÎÒÃÇ¿ÉÒÔÖ±½ÓʹÓÃËüÃÇÀ´Íê³ÉMD5µÄÇ©ÃûËã·¨¡£¶ø²»ÐèÒªÔÙÈ¥ÕÒÆäËüµÄ
DLL»òÊÇPasÁË¡£
ÔÚUsesµ¥ÔªÖÐÒýÓà IdHashMessageDigest,IdGlobal, IdHash µ¥Ôª£¬ÔÙдÈçÏ´úÂë¼´¿ÉÒÔ´ïµ½MD5µÄʵÏÖ¡£
ʾÀý´úÂë
procedure TForm1.Button1Click(Sen ......
Ã÷Ìì¾ÍÊÇÎåÒ»½ÚÁË£¬ÐÁ¿àÁ˺ü¸¸öÔ£¬½è´Ë»ú»áÓ¦¸Ã¾¡Çé·ÅËÉÒ»·¬¡£¿ÉÊÇÏëµ½BlogºÃ¾ÃûÓÐдÎÄÕ£¬ËƺõȱЩʲôËƵġ£Õ⼸¸öÔÂÀ´ÔÚÏîÄ¿ÖÐÓÖÔö³¤ÁËÐí¶à¾Ñ飬ѧµ½Ðí¶àʵ¼ÊÓ¦ÓõÄ֪ʶ¡£²»Èç°ÑһЩ±È½ÏÓÐÓõļǼÏÂÀ´£¬¹©ÅóÓÑÃDzο¼¿ÉºÃ¡£
ÎÒÏëµ½DelphiµÄʼþ£¬ÄÇ¿ÉÕæÊǸö·½±ãµÄ¶«Î÷£¬³õѧÕßÔÚ´°ÌåÉÏÀ¼¸¸ö¿ ......
C# Delphi´¦Àí·ÖÎöQQÐÒé
¡¡´ó¼Ò˵µ½QQÐÒ鶼¾õµÃºÜÉñÃØ£¬ÊÇÒòΪQQ²»ÏñMSN»òÕßICQÐÒ鶼ÒѾ¹Ù·½¹«²¼ÁË£¬¶øQQµÄûÓй«²¼¡£Ñо¿ËüµÄÈËÒ²²»ÊÇÌرðµÄ¶à£¬ËäÈ»ÒѾÓÐÁË»ùÓÚ QQÐÒéËùд³ÉµÄµÚÈý·½Èí¼þ foicq, qq plugins for gaim, LumaQQ£¬µ«ÊÇÓÉÓÚËûÃÇÊÇ»ùÓÚ¶þ½øÖÆStreamµÄÐÒé¹ýÓÚ¸´ÔÓ£¬´ó¼ÒÔĶÁ´úÂëÒ²ÓÐÒ ......
µÚÒ»ÖÖ·½·¨£º
µÚÒ»²½£º ÐÞ¸ÄÊôÐÔ
1¡¢kind -> dtktime Ò²¿ÉÒÔÊÇdtkdate µ«ÊÇÔÚÓÃdtkdateµÄʱºòÐèÒª½«datemodeÊôÐÔÐ޸ijÉdmUpDown
2¡¢parseinput -> true
µÚ¶þ²½£ºÔÚonUserInputʼþÖÐдһ¾ä´úÂë
DateTimePicker1.DateTime:=DateAndTime;
×¢£ºÒÔÉÏ·½·¨ËäÈ»¿ÉÒԴﵽĿµÄ£¬µ ......
unit MyADO;
interface
uses
SysUtils, Classes,ADODB,DB,Variants,StdCtrls,Dialogs;
type
TMyADO = class(TComponent)
private
Connection: TADOConnection;
Query: TADOQuery;
Table: TADOTable;
FConnectio ......