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

Delphi U盘插入拨出检测

Delphi U盘插入拨出检测:
1、新建工程;
2、在form1上放一个Label;
3、定义一个私有过程
     procedure WMDeviceChange(var Msg: TMessage); message WM_DEVICECHANGE;
完整代码如下:
unit Unit1;
interface
uses
   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
   Dialogs, AppEvnts, ExtCtrls, StdCtrls;
type
   TForm1 = class(TForm)
     Label1: TLabel;
   private
     { Private declarations }
     procedure WMDeviceChange(var Msg: TMessage); message WM_DEVICECHANGE;
   public
     { Public declarations }
   end;
var
   Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.WMDeviceChange (var Msg: TMessage);
var
   myMsg : String;
begin
   Case Msg.WParam of
   32768:
     begin
       myMsg :='U盘插入';
       Label1.Caption:=myMsg
     end;
   32772:
     begin
       myMsg :='U盘拔出';
       Label1.Caption:=myMsg;
     end;
   end;
end;
end.


相关文档:

使用Delphi调用WebServices接口的简单应用实例


Delphi从6.0就开始支持Web Services的开发和应用了,本文通过使用Delphi 7.0调用新浪发送短信的Web Service进行短信应用程序开发这一实例详细的介绍在Delphi中如何开发基于Web Services的应用系统。
第一步,准备工作,了解新浪短信Web Service。新浪发送短信的Web Service地址是http://smsinter.sina.com.cn/ws/smswebs ......

Delphi中取整函数Round的Bug解决

Delphi中 Round函数有个Bug
一旦参数是形如 XXX.5这样的数时
如果 XXX 是奇数 那么就会 Round up
如果 XXX 是偶数 那么就会 Round down
例如 Round(17.5)=18
但是 Round(12.5)=12
下面的函数即可纠正这个 Bug 但是是临时性的
执行 DoRound(12.5) 结果为 13 正确
 function DoRound(Value: Extended): Int64;
......

Delphi 关键字详解[整理于 "橙子" 的帖子]


Delphi 关键字详解[整理于 "橙子" 的帖子]
absolute
//它使得你能够创建一个新变量, 并且该变量的起始地址与另一个变量相同.
var
Str: string[32];
StrLen: Byte absolute Str;
//这个声明指定了变量StrLen起始地址与Str相同.
//由于字符串的第0个位置保存了字符串的长度, 所以StrLen的值即字符串长度.
begin ......

Delphi的bug

最近在调试代码,发现一个问题.应该算是bug吧. 呵,如果不算bug,那就是我对其实现原理的误解.
如果把返回参数Result作为另一函数的输入参数,result的初值是不确定...
function fun(str:string):string;
begin
  fun2(result);
end; ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号