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
相关文档:
community.csdn.net/Expert/topic/3423/3423580.xml?temp=.7675897
主 题: 怎样用DELPHI接收摄像头的图象
作 者: benbenpear (笨笨)
等 级:
信 誉 值: 100
所属社区: Delphi GAME,图形处理/多媒体
问题点数: 0 ......
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 ......
屏幕的分辨率用这个
x=GetSystemMetrics(SM_CXSCREEN)
y=GetSystemMetrics(SM_CYSCREEN)
同上。
.而且获得屏幕上的像素好像应该使用
screen.pixelsperinch函数
int GetDeviceCaps(
  ......
名称 类型 说明
--------------------------------------------------------- ......
Delphi字符串加密解密函数
功能:字符串加密和解密
首先定义一个常量数组
const
XorKey:array[0..7] of Byte=($B2,$09,$AA,$55,$93,$6D,$84,$47); //字符串加密用
在程序里加入以下两个函数,
function Enc(Str:String):String;//字符加密函數 這是用的一個 ......