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

Delphi 我的代码之窗体移动

技术交流,DH讲解. 这个工具是好早好早以前写的,我这个喜欢在家边看电影边写写代码或者看电子书,所以经常会将网页移到屏幕的左上角或者右上角,而且要置顶.所以就写了这样一个工具,这个工具主要是对句柄的操作,还有就是窗体样式以及几个API的例子,比较基础. 整个文件在 here(Can't Input Chinese:() 下面把代码贴出来,希望有什么不懂的,结合MSDN,OK? Var
Form2: TForm2;
H: Cardinal = 0;
Implementation
{$R *.dfm}
//------------------------------------------------------------------------------
// 取得鼠标所在处窗体的句柄
//------------------------------------------------------------------------------
Procedure TForm2.BtnGetHandleClick(Sender: TObject);
Var
Pt: TPoint;
Begin
If GetCursorPos(Pt) Then
H := WindowfromPoint(Pt)
Else
H := 0;
End;
//------------------------------------------------------------------------------
// 将窗体置顶
//------------------------------------------------------------------------------
Procedure TForm2.BtnTopMostClick(Sender: TObject);
Var
Rc: TRect;
Begin
If H = 0 Then
Exit;
If GetWindowRect(H, Rc) Then
SetWindowPos(H, HWND_TOPMOST, Rc.Left, Rc.Top, Rc.Right - Rc.Left,
Rc.Bottom - Rc.Top, SWP_SHOWWINDOW)
End;
//------------------------------------------------------------------------------
// 去掉窗体的边框
//------------------------------------------------------------------------------
Procedure TForm2.BtnNoBorderClick(Sender: TObject);
Var
WsStyle: Cardinal;
Begin
If H = 0 Then
Exit;
WsStyle := GetWindowLong(H, GWL_STYLE);
WsStyle := WsStyle And (Not WS_BORDER) And (Not WS_CAPTION);
SetWindowLong(H, GWL_STYLE, WsStyle);
End;
//------------------------------------------------------------------------------
// 移动窗体
//------------------------------------------------------------------------------
Procedure TForm2.BtnMoveClick(Sender: TObject);
Var
Dx, Dy: Integer;
Rc: TRect;
Begin
If H = 0 Then
Exit;
Dx := StrToIntDef(TxtDx.Text, 0);
Dy := StrToInt


相关文档:

Delphi与XML文档

同步程序案例
procedure TGetOrderThread.PostDB(webnr:WideString);
var
  Err: String;
  SetWebnr:WideString;
  xmlDoc: IXMLDocument;
  root: IXMLNode;
  rowc: IXMLNode;//记录数
  rows: IXMLNodeList;//主记录列表
  row: IXMLNode;
  drows: IXMLNodeList;// ......

Delphi 实现程序 动态 类名

1、首先将delphi中Controls单元提取
2、修改Controls单元中如下部分:
procedure TWinControl.CreateParams(var Params: TCreateParams);
begin
FillChar(Params, SizeOf(Params), 0);
with Params do
begin
    Caption := FText;
    Style := WS_CHILD or WS_CLIPSIBLINGS;
&nbs ......

Delphi 日期函数

Day 开头的函数

Unit
DateUtils
function DateOf(const Avalue: TDateTime): TDateTime;
描述
使用 DateOf 函数用来把一个 TDateTime 类型的变量转变成一个
只带有日期的 TDateTime 类型变量。
例如:
showmessage(DateTimetostr(dateof(now())));
你得到的是 2003/03/19
而 showmessage(DateTime ......

Delphi Copy函数效率的问题

技术交流,DH讲解. 最近和肥鸟交流了下关于字符串方面的知识,而这篇文章是很久以前写的,现在发出来吧. 我们写两段代码来对比下:
第一个用Copy函数:
procedure TForm1.Button1Click(Sender: TObject);
var
a,c:Cardinal;
n:Integer;
D:Double;
i:Integer;
b:string;
begin
c:=0; ......

Delphi拾遗(7) 参数与返回值

unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm2 = class(TForm)
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号