易截截图软件、单文件、免安装、纯绿色、仅160KB

Delphi PureAPIWindow program

program PureAPIWindow;
uses
SysUtils,
Windows,
Messages;
const
WinClassName = 'DvsClass';
StrOut = 'Davis TextOut';
//窗口回调函数
function MyWinProc(
hWindow: HWND;
aMessage: UINT;
WParam: WPARAM;
LParam: LPARAM): LRESULT; stdcall; export;
var
dc: HDC;
ps: TPaintStruct;
rect: TRect;
begin
MyWinProc := 0;
case aMessage of
WM_PAINT:
begin
dc := BeginPaint(hWindow,ps);
GetClientRect(hWindow,rect);
DrawText(dc,StrOut,Length(StrOut),rect,DT_SINGLELINE or DT_CENTER or DT_VCENTER);
//TextOut(dc,0,0,StrOut,Length(StrOut));
EndPaint(hWindow,ps);
end;
WM_LBUTTONDOWN:
begin
dc := GetDC(hWindow);//GetDC(0);
TextOut(dc,0,0,'Left Button Down',Length('Left Button Down'));
ReleaseDC(hWindow,dc);
//ReleaseDC(0,dc);
end;
WM_CLOSE:
if ID_YES = MessageBox(0,'Are you sure exit ?','Propmt info',MB_YESNO) then
begin
DestroyWindow(hWindow);
end;
WM_DESTROY:
begin
PostQuitMessage(0);
end;
else
Result := DefWindowProc(hWindow,aMessage,WParam,LParam);
end;
end;
function WinRegister: Boolean;
var
wndClass: TWndClass;
hInstance: Cardinal;
begin
hInstance := GetModuleHandle(0);
//
wndClass.style := CS_VREDRAW or CS_HREDRAW;
wndClass.lpfnWndProc := TFNWndProc(@MyWinProc); //Callback function
wndClass.cbClsExtra := 0;
wndClass.cbWndExtra := 0;
wndClass.hInstance := hInstance;//Same as System.MainInstance; //实例句柄
wndClass.hIcon := LoadIcon(0,IDI_INFORMATION);
wndClass.hCursor := LoadCursor(0,IDC_CROSS);
wndClass.hbrBackground := HBRUSH(GetStockObject(BLACK_BRUSH));
wndClass.lpszMenuName := nil;
wndClass.lpszClassName := WinClassName;
//
Result := Windows.RegisterClass(wndClass) <> 0;
end;
function WinCreate: HWND;
var
hWindow: HWND;
hInstance: Cardinal;
begin
hInstance := GetModuleHandle(0);
hWindow := C


相关文档:

Using COM+ object pooling with Delphi 6

 URL: http://edn.embarcadero.com/article/27568
Abstract: Delphi 6 introduces support for COM+ object pooling, which can provide significant performance improvements under some circumstances. We take a look at Delphi 6s object pooling support. By Vincent Parrett.
Typically, when a client appl ......

delphi发送焦点移动消息的函数及参数


procedure TForm_BaseMDI.FormKeyPress(Sender: TObject; var Key: Char);
begin
  if Key = #13 then
     begin
     Key := #0;
     SendMessage(Handle, 48384, 9, 0);     
     end;
end; ......

Delphi的命令行编译命令

Borland出品的Delphi,有着闪电般的编译速度,但是在界面控件使用较多、工程项目较大的时候,编译一个工程仍需要一段时间,打开庞大的Delphi IDE,也需要时间。其实,在一个工程开发结束,调试完成之后的Release编译,完全可以用命令行来执行,因为Delphi的编译器参数不像C++编译器那样复杂。
  笔者把Delphi联机手册 ......

Delphi Excel to Sql Server

 unit Unit1;
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, Grids, DBGrids, DB, ADODB,comobj, OleServer,
  ExcelXP;
type
  TForm1 = class(TForm)
    ADOConn: TADOConnection;
& ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号