抛出异常的时间太长了 怎么缩短响应时间?
摘要://在界面上放一个Timer控件,设置Interval为1000即1秒,当然也可以根据实际情况设置为100,500,以缩短判断时间。//然后在Timer执行时,记录流逝时间。//最后在你要处理的过程中,加入对流逝时间的判断,如果大于你预期的时间,则抛出异常。//---------------------------------------------------unit Unit1;interfa...
阅读全文
posted @
2010-02-01 15:58
oKmAn.Org
阅读(308)
推荐(0)
取本机MAC地址
摘要:function NBGetAdapterAddress(a: integer): String; //a指定多个网卡适配器中的哪一个0,1,2... Var NCB:TNCB; //NetBios控制块 ADAPTER:TADAPTERSTATUS; //取网卡状态 LANAENUM:TLANAENUM; //Netbios lana intIdx:Integer; //Temporar...
阅读全文
posted @
2010-01-31 23:41
oKmAn.Org
阅读(269)
推荐(0)
取本机IP地址
摘要:function LocalIP: String;type TaPInAddr = Array[0..10] of PInAddr; PaPInAddr = ^TaPInAddr;var phe: PHostEnt; pptr: PaPInAddr; Buffer: Array[0..63] of AnsiChar; i: Integer; GInitData: TWSAData;b...
阅读全文
posted @
2010-01-31 23:39
oKmAn.Org
阅读(346)
推荐(0)
delphi注册表操作(读取、添加、删除、修改)完全手册
摘要:32位Delphi程序中可利用TRegistry对象来存取注册表文件中的信息。 一、创建和释放TRegistry对象 1.创建TRegistry对象。为了操作注册表,要创建一个TRegistry对象:ARegistry := TRegistry.Create; 2.释放TRegistry对象。对注册表操作结束后,应释放TRegistry对象所占内存:ARegistry.Destroy。...
阅读全文
posted @
2010-01-31 03:12
oKmAn.Org
阅读(616)
推荐(0)
利用远程线程注入DLL Delphi版
摘要:SDK文档里是这样描述的:进程是一个正在运行的程序,它拥有自己的地址空间,拥有自己的代码,数据和其他系统资源.一个进程包含了一个或者多个运行在此进程内的线程. 从定义上看出进程一定要有线程,线程是进程内存中的独立实体. 线程插入技术就是把一个线程弄到别的进程中执行的技术。 远程线程插入代码之DLL注入技术: 我们先编写个简单的DLL:library TestDll; uses Windows;{$...
阅读全文
posted @
2010-01-27 16:22
oKmAn.Org
阅读(898)
推荐(0)
5种运行程序的方法具体应用实例(带参数)
摘要:介绍5种比较常用的运行程序的方法,包括WinExec、ShellExecute、CreateProcess、CreateProcessAsUser、CreateProcessWithLogonW//以下为完整源代码unit Unit1;inte***ceusesWindows, Messages, SysUtils, Variants, Classes, Graphics, Controls, F...
阅读全文
posted @
2010-01-21 21:56
oKmAn.Org
阅读(1119)
推荐(0)
下载远程文件
摘要:uses urlmon; procedure TForm1.Button1Click(Sender: TObject);var url:Pchar; LocalFilePath:string;begin LocalFilePath :=ExtractFilePath(application.ExeName)+'ServerList.txt'; url := 'http://ver.bo.sohu....
阅读全文
posted @
2010-01-21 17:02
oKmAn.Org
阅读(182)
推荐(0)
ShowWindow
摘要:public static extern int ShowWindow ( int hwnd, int nCmdShow ); hwnd ----------- Long,窗口句柄,要向这个窗口应用由nCmdShow指定的命令 nCmdShow ------- Long,为窗口指定可视性方面的一个命令。请用下述任何一个常数 public const int SW_HIDE = 0 p...
阅读全文
posted @
2010-01-20 23:59
oKmAn.Org
阅读(358)
推荐(0)
获取程序所在目录
摘要:procedure TForm1.Button1Click(Sender: TObject);begin ShowMessage(ExtractFilePath(ParamStr(0))); //获取程序所在目录 ShowMessage(ExtractFilePath(Application.ExeName)); //获取程序所在目录 ShowMessage(GetCurrentDir +...
阅读全文
posted @
2010-01-17 21:39
oKmAn.Org
阅读(203)
推荐(0)
Dll 使用 PChar 参数的小例子
摘要:Dll 文件:-------------------------------------------------------------------------------- library Lib;uses SysUtils, Classes;{$R *.res}procedure Test(p: PChar);const Title = 'Title ';var str: string;...
阅读全文
posted @
2010-01-17 21:35
oKmAn.Org
阅读(248)
推荐(0)
使用 IXMLHTTPRequest 简单获取网页源代码
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Memo1: TMemo; Button1: TButton; procedure Button1Cli...
阅读全文
posted @
2010-01-17 21:21
oKmAn.Org
阅读(268)
推荐(0)
读取文件系统信息
摘要://声明:GetVolumeInformation( lpRootPathName: PChar; {磁盘驱动器代码字符串} lpVolumeNameBuffer: PChar; {磁盘驱动器卷标名称} nVolumeNameSize: DWORD; {磁盘驱动器卷标名称长度} lpVolumeSerialNumber: PDWORD; {磁盘驱动器卷标序列号} var lpMaximu...
阅读全文
posted @
2010-01-17 21:06
oKmAn.Org
阅读(265)
推荐(0)
读取软件的版本信息 GetFileVersionInfo
摘要:function GetBuildInfo(FileName: string; var V1, V2, V3, V4: Word): Boolean;var VerInfoSize, VerValueSize, Dummy: DWORD; VerInfo: Pointer; VerValue: PVSFixedFileInfo;begin if not FileExists(FileName) t...
阅读全文
posted @
2010-01-17 17:26
oKmAn.Org
阅读(643)
推荐(0)
检测USB设备接入和移除
摘要:// ========================================================================== // USB - Insertion and Removal Detection Class // Mike Heydon 2007 // // Assignable Events // eg. procedure TForm1.MyOnIns...
阅读全文
posted @
2010-01-17 17:22
oKmAn.Org
阅读(1011)
推荐(0)
截屏
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls,JPEG, ExtCtrls;type TForm1 = class(TForm) Button1: TButton; Button2: TButton; B...
阅读全文
posted @
2010-01-17 17:06
oKmAn.Org
阅读(206)
推荐(0)
断点续传
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, IdHTTP, ComCtrls; ...
阅读全文
posted @
2010-01-17 16:36
oKmAn.Org
阅读(288)
推荐(0)
读写EXE文件
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Button1: TButton; Edit1: TEdit; Button2: TButton; Ed...
阅读全文
posted @
2010-01-17 16:28
oKmAn.Org
阅读(357)
推荐(0)
关闭进程
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs,Tlhelp32, StdCtrls;type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Se...
阅读全文
posted @
2010-01-17 15:23
oKmAn.Org
阅读(208)
推荐(0)
SendMail
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, IdMessage, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, IdMessageClient, ...
阅读全文
posted @
2010-01-17 15:06
oKmAn.Org
阅读(301)
推荐(0)
在Richedit上进行Delphi代码语法加亮显示
摘要:Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--procedure CodeColors(Form : TForm;Style : String; RichE : TRichedit;InVisible : Boolean); const // sym...
阅读全文
posted @
2010-01-17 15:01
oKmAn.Org
阅读(585)
推荐(0)