用Delphi怎么实现QQ的消息提示

来源:百度知道 编辑:UC知道 时间:2024/05/04 15:12:09
平时上QQ的时候右下角经常会有一个小窗体从下而上(即平时出些新闻那个).这种效果在Delphi中如何实现?他的原理是什么呢?如有代码,那就追分....

1.新建工程并在FORM1中添加一个按钮
2.添加新窗体 并在Form2中添加SHOW过程 (覆盖原有的)
type
TForm2 = class(TForm)
procedure show(var Msg:string); //添加这行
private
.....
3.在implementation部分填写
procedure tform2.show(var Msg:string);
var
hApp :HWND;
rcApp:TRect;
RenG :integer;
begin
hApp := FindWindow('Shell_TrayWnd', '');

if hApp <> 0 then
GetWindowRect(hApp, rcApp);

Reng:= rcApp.Bottom-rcApp.Top; //得到任务栏高度

BorderStyle:=bsDialog;

//设置大小 你可以自己设置

Left:=screen.Width-width; //设置窗口的位置
Top :=screen.Height-Reng-height;

Visible:=true; //显示窗口

Canvas.TextOut(5,5,Msg);//窗口显示传进的字符串 用别的组建也可以

end;

4.回到UNIT1单元 双击刚才FORM1上的按钮并填写
//声明 这个
var
n:string;
//begin下写
n:='Hiyali';
form2.show(n);

5.运行 按BUTTON1 看到