中国IT动力,最新最全的IT技术教程
最新100篇 | 推荐100篇 | 专题100篇 | 排行榜 | 搜索 | 在线API文档 | 网通镜像
首 页 | 程序开发 | 操作系统 | 软件应用 | 图形图象 | 网络应用 | 精文荟萃 | 教育认证 | 硬件维护 | 未整理篇 | 站长教程
ASP JS PHP工程 ASP.NET 网站建设 UML J2EESUN .NET VC VB VFP 网络维护 数据库 DB2 SQL2000 Oracle Mysql
服务器 Win2000 Office C DreamWeaver FireWorks Flash PhotoShop 上网宝典 CorelDraw 协议大全 网络安全 微软认证
硬件维护  CPU  主板  硬盘  内存  显卡  显示器  键盘鼠标  声卡音箱  打印机  机箱电源  BIOS  网卡  C#  Java  Delphi  vs.net2005
  当前位置:> 程序开发 > 编程语言 > Delphi > 综合文章
Delphi使用三则
作者:未知 时间:2006-07-29 12:56 出处:不详 责编:月夜寒箫
              摘要:Delphi使用三则
隐藏和显示Windows的任务条
  如果隐藏和显示Windows的任务条,仅仅调用以下的函数就可以:
  procedure hideTaskbar; //隐藏
  var
  wndHandle : THandle;
  wndClass : array[0..50] of Char;
  begin
  StrPCopy(@wndClass[0], ′Shell—TrayWnd′);
  wndHandle:=FindWindow(@wndClass[0],nil);
  ShowWindow(wndHandle, SW—HIDE);
  End;
  procedure showTaskbar;
  var
  wndHandle : THandle;
  wndClass : array[0..50] of Char;
  begin
  StrPCopy(@wndClass[0], ′Shell—TrayWnd′);
  wndHandle:=FindWindow(@wndClass[0], nil);
  ShowWindow(wndHandle, SW—RESTORE);
  end;

  控制窗体
  如何在Delphi中把Form控制成不能放大/缩小/移动/关闭的窗体,可进行如下步骤:
  1.把Form的BorderIcons下的几个子属性值全改为False;
  2.修改Form的BorderStyle的值为bsSingle;
  3.为了让窗口不能移动,可以自已拦下WM—NCHITTEST消息,对该消息的处理为:一概回应鼠标点在窗口的Client区域, 相信这个视窗就不会动了。
  下面是一个例子, 请参考:
  unit Unit1;
  interface
  uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls,Forms, Dialogs, StdCtrls;
  type
  TForm1 = class(TForm)
  Button1: TButton;
  procedure Button1Click(Sender: TObject);
  private
  { Private declarations }
  procedure WMNCHitTest(var Msg: TMessage); message WM—NCHITTEST;
  public
  { Public declarations }
  end;
  var Form1: TForm1;
  implementation {$R *.DFM}
  procedure TForm1.Button1Click(Sender: TObject);
  begin
  Close; // 不可少, 因为已经没有其他方法能关闭此捶ň褪恰捌燮毕低?让它认为点中的是窗体的标题行:
  unit Dragmain;
  interface
  uses
   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
   Forms, Dialogs, StdCtrls;
  type
   TForm1 = class(TForm)
  Button1: TButton;
  procedure Button1Click(Sender: TObject);
   private
    procedure WMNCHitTest(var M: TWMNCHitTest); message wm—NCHitTest;
   end;
  var Form1: TForm1;
  implementation {$R *.DFM}
  procedure TForm1.WMNCHitTest(var M: TWMNCHitTest);
  begin
   inherited;    
  { call the inherited message handler }
   if M.Result = htClient then
  { is the click in the client area? }
    M.Result := htCaption;  
   { if so, make Windows think it′s   }
      { on the caption bar.  }
  end;
  procedure TForm1.Button1Click(Sender: TObject);
  begin
   Close;
  end;
  end.
  { 下面是这个窗体的设置}
  object Form1: TForm1
   Left = 203
   Top = 94
   BorderIcons = []
   BorderStyle = bsNone
   ClientHeight = 273
   ClientWidth = 427
   Font.Color = clWindowText
   Font.Height = -13
   Font.Name = ′System′
   Font.Style = []
   PixelsPerInch = 96
   TextHeight = 16
   object Button1: TButton
    Left = 160
    Top = 104
    Width = 89
    Height = 33
    Caption = ′Close′
    TabOrder = 0
    OnClick = Button1Click
   end
  end
关闭本页
 
首页 | 投资与合作 | 服务条款 | 隐私政策 | 收藏本站 | 设为首页 | 新用户注册 | 免责声明 | 使用帮助
Copyright ©2005-2008 chinaitpower.com All rights reserved. www.chinaitpower.com 版权所有