随笔分类 - Delphi
摘要:{ "班级1": { "classid": "101", "teacher": "Lee", "age": 25, "books": [ "book1", "book2", "book3" ] }, "班级2": { "classid": "102", "teacher": "Lee", "
阅读全文
摘要:线程同步SendMessage
阅读全文
摘要:Thread{*******************************************************}{ }{ Delphi Thread Sample } { Creation Date 2012.08.25 }{ Created By: ming ...
阅读全文
摘要:View Code type TfrmMain = class(TForm) mmoMsg: TMemo; btnNewThread: TButton; btnShutdownAll: TButton; procedure btnNewThreadClick(Sender: TObject); procedure FormCreate(Sender: TObject); procedure btnShutdownAllClick(Sender: TObject); private { Private declarations } public ...
阅读全文
摘要:View Code interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs;type TMsgReceiver = class(TObject) private fMsgHandlerHWND : HWND; WM_MY_UNIQUE_MESSAGE : Cardinal; procedure WndMethod(var Msg: TMessage); public Point : TPoint; constructo...
阅读全文
摘要:今天写给别人的一段代码。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; //X Coordinate YY=100; //Y Coordinate _SLEEP = 100; //Sleep times procedure MySleep(ms:Cardinal); var ...
阅读全文
摘要: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;begin Result := 0; for I := Low(Args) to High(Args) do case Args[I].VType of vtInteger: Result := R...
阅读全文
摘要:Union部分只能放在最后,这和C的不太一样,要放在前面先用Type定义一个单独的Union类型就可以了。unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs;type TForm1 = class(TForm) procedure FormCreate(Sender: TObject); private { Private declarations } public { Public declaratio...
阅读全文
摘要:{*******************************************************}{ }{ Remote Inject }{ Creation Date 2010.12.23 }{ Created By: ming }{ ...
阅读全文
摘要://use Tlhelp32function GetProcessIDEx(List:TStrings; ProcessName: string = ''): TProcessEntry32;var ret: Boolean; processID: Cardinal; _processName: string; FSnapshotHandle: HWND; FProcessEntry32: TProcessEntry32;begin FSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0); FProce
阅读全文
摘要:interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, OleCtrls, SHDocVw, ActiveX; type IDocHostShowUI = interface(IUnknown) ['{c4d244b0-d43e-11cf-893b-00aa00bdce1a}'] function ShowMessage(hwnd: THandle; lpstrText: POLESTR; lpstrCaption: POLESTR;dw
阅读全文
摘要:var hMutex: HWND;begin //hMutex := CreateMutex(nil,True,'_MingTest'); hMutex := CreateEvent(nil,False,False,'_MingTest'); if GetLastError = ERROR_ALREADY_EXISTS then begin MessageBox(0,'This program has executed!','Error!',0); Exit; end; Application.Initialize; Applic
阅读全文
摘要:View Code {*******************************************************}{ }{ Delphi Thread Sample 2 } { Creation Date 2011.06.30 }{ Created By: ming }{ }{*******************************************************}unit unitWorkThread;interfaceuses Classes,Windows, Messages, SysUtils, Graphics, StdCtrls;type
阅读全文
摘要:View Code {*******************************************************}{ }{ Delphi Thread Sample } { Creation Date 2011.06.29 }{ Created By: ming }{ }{*******************************************************}unit unitWorkThread;interfaceuses Classes,Windows, Messages, SysUtils, Graphics, StdCtrls;type TW
阅读全文
摘要:View Code TCriticalSection = class(TObject) protected FSection: TRTLCriticalSection; public constructor Create; destructor Destroy; override; procedure Enter; procedure Leave; function TryEnter: Boolean; end;{TCriticalSection}constructor TCriticalSection.Create;begin InitializeCriticalSection(FSecti
阅读全文
摘要: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 TForm1.Button1Click(Sender: TObject);var i: Integer; aByte: Byte; bitArr: array [0..7] of Byte;begin aByte := $0F; ZeroMemory(@bitArr,SizeOf(bitArr)
阅读全文

浙公网安备 33010602011771号