- 博客(62)
- 收藏
- 关注
转载 多个线程的同步执行,优先级控制
实现多个线程共用一个资源的同步问题,并且根据优先级别高低,获取执行权限。线程类例子三个在execute方法中根据自己的优先级获取令牌:Thread1unit unitWorkThread1;{*******************************************************}{ ...
2013-03-30 10:01:00
240
转载 Delphi线程同步(SendMessage)
Delphi线程同种的方法有很多种,除了常用的Synchronize方法,也可以使用SendMessage向主窗口发送消息,因为SendMessage是阻塞的,可以达到同步的效果。主线程可以直接定义消息类型的procedure接收消息,也可以重写TControl类的WndProc窗口过程,在窗口过程里面截取自己想要的消息。Thread{********************...
2012-12-30 12:26:00
322
转载 Delphi线程类(四)
View Code {*******************************************************}{ }{ Delphi Thread Sample 4 }{ ...
2012-12-23 15:41:00
169
转载 简单窗体振动
Thread{*******************************************************}{ }{ Delphi Thread Sample } ...
2012-08-25 15:35:00
142
转载 Delphi线程类(三)
View Code type TfrmMain = class(TForm) mmoMsg: TMemo; btnNewThread: TButton; btnShutdownAll: TButton; procedure btnNewThreadClick(Sender: TObject); procedure FormC...
2012-04-23 10:58:00
104
转载 Receive Windows Messages In NonWindowed Control
View Code interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs;type TMsgReceiver = class(TObject) private fMsgHandlerHWN...
2012-04-21 15:19:00
134
转载 位图异或操作
今天写给别人的一段代码。View Code procedure TfrmMain.btnXorClick(Sender: TObject);var dc: HDC; x,y: Integer; bmp1,bmp2,bmp3: TBitmap; pt: TPoint;const WW=100; //Width HH=100; //Height XX=100; ...
2012-02-05 20:20:00
233
转载 类型变化的开放数组参数
View Code procedure ShowMsg(const fmtStr:string; const params: array of const);begin ShowMessageFmt(fmtStr,params);end;function SumAll(const Args: array of const): Extended;var I: Integer;b...
2012-01-17 17:17:00
96
转载 过虑窗体最小化消息
很久没写随笔,今天在写一个托盘程序的时候,要捕获窗口最小化的消息,在WndProc里面没有捕获到,后面在TWinControl找到实现WM_SYSCOMMAND的过程。重写就可以了,其实WndProc里面也是可以的,刚开始写错了。WndProcprocedure TfrmMain.WndProc(var aMsg: TMessage);begin if aMsg.Msg =...
2012-01-11 21:07:00
110
转载 Delphi Union 使用
Union部分只能放在最后,这和C的不太一样,要放在前面先用Type定义一个单独的Union类型就可以了。unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs;type TFor...
2011-09-08 10:55:00
560
转载 Remote Inject
{*******************************************************}{ }{ Remote Inject }{ Creation...
2011-08-28 16:50:00
331
转载 枚举进程for in
//use Tlhelp32function GetProcessIDEx(List:TStrings; ProcessName: string = ''): TProcessEntry32;var ret: Boolean; processID: Cardinal; _processName: string; FSnapshotHandle: H...
2011-08-16 10:50:00
86
转载 Delphi中WebBrowser拦截网页Alert对话框消息(转)
interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, OleCtrls, SHDocVw, ActiveX; type IDocHostShowUI = interface(IUnkn...
2011-08-09 16:05:00
241
转载 让程序只运行一个实例
var hMutex: HWND;begin //hMutex := CreateMutex(nil,True,'_MingTest'); hMutex := CreateEvent(nil,False,False,'_MingTest'); if GetLastError = ERROR_ALREADY_EXISTS then begin ...
2011-08-04 10:17:00
102
转载 Delphi线程类(二)
View Code {*******************************************************}{ }{ Delphi Thread Sample 2 } ...
2011-06-30 10:28:00
141
转载 Delphi线程类(-)
View Code {*******************************************************}{ }{ Delphi Thread Sample } ...
2011-06-29 10:47:00
109
转载 Class TRTLCriticalSection
View Code TCriticalSection = class(TObject) protected FSection: TRTLCriticalSection; public constructor Create; destructor Destroy; override; procedure Enter; procedure L...
2011-06-06 10:25:00
90
转载 获取字节中的bit值
procedure getBits(aByte:Byte; bitArr: array of Byte);asm mov ecx,0 @@1: shr al,1 jnc @@2 mov [edx],1 @@2: inc cx inc edx cmp ecx,8 jnz @@1end;procedure T...
2011-05-23 11:09:00
221
转载 IOCP简单例子
Server:View Code {*******************************************************}{ }{ IOCP Server Sample ...
2011-03-23 09:59:00
190
转载 Socket IO重叠模型(完成例程)
Server:View Code {*******************************************************}{ }{ Overlap IO Server ...
2011-03-22 20:47:00
183
转载 Socket IO重叠模型(事件通知)
Server:View Code {*******************************************************}{ }{ Overlap IO Server }{...
2011-03-22 20:33:00
139
转载 Get Main Thread ID
通过TEB结构获取主线程ID,XP系统下测试通过,不同系统的TEB结构可能有所不同。View Code function GetThreadID:DWORD;asm xor esi,esi mov eax,fs:[esi+$18] mov eax,[eax+$24]end;procedure TForm1.Button1Click(Sender: TObject);va...
2011-03-19 13:57:00
182
转载 简单的socket通信TCP
Tcp Server:View Code #include <stdio.h>#include <Winsock2.h>#pragma comment(lib,"ws2_32.lib")void main(){WORD wVersionRequested;WSADATA wsaData;int err;wVersionRequested = MAK...
2011-03-13 10:32:00
101
转载 Table隔行变色JavaScript
Table隔行变色代码function showtable(){ var color1 = "rgb(234,240,255)"; var color2 = "rgb(255,255,255)"; var bgColor = "rgb(255,255,193)"; var trs = document.getEl...
2011-01-16 15:50:00
90
转载 Php Image Resize
image resize:代码function my_image_resize($src_file, $dst_file, $dst_width=32, $dst_height=32) { if($dst_width <1 || $dst_height <1) { echo "params width or height error !...
2011-01-16 11:29:00
165
转载 php连接mssql 2005
1.下载以下两个文件,放入php ext目录及system32php_sqlsrv_52_ts_vc6.dll (线程安全)php_sqlsrv_52_nts_vc6.dll (非线程安全)vc6用于Apache,vc9用于IIS2.修改php.iniextension=php_sqlsrv_52_ts_vc6.dll3.下载sqlncli.msi,微软官方可...
2011-01-07 11:07:00
74
转载 Delphi子过程参数传递
默认调用方式Register,传递参数的顺序前三个为al,dl,cl / ax,dx,cx / eax,edx,ecx分别对应一个字节,两个字节,四个字节,当参数>3个时,多出的参数入栈,所以第四个参数的地址为[esp+8],第五个参数的地址为[esp+12],[esp+4]至[esp+0]这四个字是函数的返回地址。以上针对类以外的子过程,在类里面定义的过程参数传递有所改变,主要改...
2010-12-30 15:06:00
145
转载 TFont,TLogFont使用
TFont,TLogFont使用代码procedure RotateText(ACanvas:TCanvas);var LF: TLogFont; aFont: TFont;begin with ACanvas do begin Font.Name := 'Arial'; Font.Size := 18; aFont := TFont.Creat...
2010-12-30 14:27:00
207
转载 Register HotKey
Register HotKey代码{*******************************************************}{ }{ Module Name: unitHotKey.pas ...
2010-12-30 09:20:00
178
转载 删除Delphi临时文件的Bat
删除Delphi临时文件的Bat,保存成Bat文件,请注意以下代码同时删除了*.dcu文件。代码Rem Delete Delphi temporary fileRem ****************************@echo Delete Delphi temporary file@dir/w/s *.~* *.dcu@echo 以上为当前目录及子目录临时文件,...
2010-12-29 11:06:00
219
转载 构造自己的StringGrid
构造自己的StringGrid代码{*******************************************************}{ }{ Module Name: unitStringGrid.pas ...
2010-12-29 10:45:00
163
转载 构造自己的双向链表
双向链表类代码{*******************************************************}{ }{ Module Name: unitLinkClass.pas }{ ...
2010-12-28 15:19:00
101
转载 一个简单的系统托盘程序
Delphi System Tray Application,版本高于D7时设置Application.ShowMainForm := False;在隐藏的时候,任务栏不显示。代码unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Fo...
2010-12-28 11:22:00
125
转载 BMP2JPG,JPG2BMP
BMP2JPG,JPG2BMP代码//uses jpegprocedure BMP2JPG(const BMPFile: string);var BMP: TBitmap; JPG: TJpegImage; FileName: string;begin FileName := BMPFile; BMP := TBitmap.Create; JPG := TJp...
2010-12-28 10:50:00
195
转载 CaptureComponentToBmp
CaptureComponentToBmp代码{*******************************************************}{ }{ Created By: Ming.z ...
2010-12-28 10:44:00
63
转载 BeginPaint和GetDC的区别
BeginPaint和GetDC的区别代码unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Button1: TButto...
2010-12-28 10:25:00
174
转载 mouse_event,keybd_event
mouse_event代码procedure MyMouseClick();begin mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);end;procedure MyMouseDBClick()begin mouse_event(M...
2010-12-28 10:12:00
92
转载 $J的用法
$J相当于C里面的static类型procedure TForm1.Button1Click(Sender: TObject);const{$J+} i: integer = 0;{$J-}begin ShowMessage(IntToStr(i)); Inc(i);end;转载于:https://www.cnblogs.com/Jekhn/archi...
2010-12-28 09:41:00
6708
转载 Pure API Window
Pure API Window代码program APIWindow;uses SysUtils, Windows, Messages;const WinClassName = 'MingClass'; StrOut = 'Ming TextOut';function MyWinProc( hWindow: HWND; aMes...
2010-12-27 16:23:00
105
转载 DBGrid操作
DBGrid Column自动调整宽度,加行号,以及Override DrawColumnCell代码{--Author Ming--Version V01.001--Creation Date 2009/03/20--Last Updated Date 2009/03/20--Last Updated Date 2009/04/02 Add procedure Aut...
2010-12-27 14:07:00
108
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人