现在,DATASNAP倾向于使用JSON作为统一的数据序列格式,以期达到跨平台的效果。于是使用JSON便成为热点。unit uJSONDB; interface uses SysUtils, Classes, Variants, DB, DBClient, SuperObject, Dialogs; Read More
posted @ 2016-03-02 23:45 findumars Views(717) Comments(0) Diggs(0)
完全自定义窗体风格的实现 最小化到任务栏postmessage(Self.Handle,WM_SYSCOMMAND,SC_MINIMIZE,0); 最大化或还原procedure Tf_MainForm.RzToolButton1Click(Sender: TObject);var abd: TAp Read More
posted @ 2016-03-02 23:43 findumars Views(900) Comments(0) Diggs(0)
program Monitor; // {$APPTYPE CONSOLE} uses Winapi.Windows, System.SysUtils, ProcLib in 'ProcLib.pas'; var Mutex: HWND; const c_AppName = 'server.exe' Read More
posted @ 2016-03-02 23:41 findumars Views(399) Comments(0) Diggs(0)
对于一些小文件,用普通的文件流就可以很好的解决,可是对于超大文件,比如2G或者更多,文件流就不行了,所以要使用API的内存映射的相关方法,即使是内存映射,也不能一次映射全部文件的大小,所以必须采取分块映射,每次处理一小部分。 先来看几个函数 CreateFile :打开文件 GetFileSize Read More
posted @ 2016-03-02 23:39 findumars Views(2012) Comments(1) Diggs(0)
线程池的概念 单位时间内必须处理数目巨大的连接请求,但处理时间却相对较短。 传统多线程方案中,一旦接受到请求之后,即创建一个新的线程,由该线程执行任务。任务执行完毕后,线程退出。这就是即时创建,即时销毁的策略。尽管与创建进程相比,创建线程的时间已经大大的缩短,但是如果提交给线程的任务执行时间很短,而 Read More
posted @ 2016-03-02 23:39 findumars Views(327) Comments(0) Diggs(0)
// 定义结构体 typeTmyRec= recordname:string[10];password:string[10];end; function RawToBytes(const AValue; const ASize: Integer): TBytes;beginSetLength(Res Read More
posted @ 2016-03-02 23:38 findumars Views(434) Comments(0) Diggs(0)
unit Unit2;interfaceusesSystem.Classes, Windows, Messages;constWM_DO = WM_USER + 1;typeTDemoThread = class(TThread)private{ Private declarations }prot Read More
posted @ 2016-03-02 23:37 findumars Views(449) Comments(0) Diggs(0)
一,首先引入“mmsystem”单元。 二,启动定时器: var MMTimerID: Integer; // 定时器ID MMTimerID := timeSetEvent(1000, 0, @TimerProc, 0, TIME_PERIODIC); 三,定时器过程代码: procedure T Read More
posted @ 2016-03-02 23:36 findumars Views(488) Comments(0) Diggs(0)
如果我们不加上"/silent",那么Delphi在安装和卸载NT服务程序时候,都会出现一个提示信息,不希望出现这个提示信息,那么使用如下命令: 1,安装:“你的nt程序 /install /silent”。 2,卸载:“你的nt程序 /uninstall /silent”。 这是Delphi中注册 Read More
posted @ 2016-03-02 23:35 findumars Views(224) Comments(0) Diggs(0)
我今天把一个原来是Delphi2007的工程升级到了Delphi XE2,在编译ralease版本时候,发现无法添加UAC,我觉得可能是升级的原因,随后我用XE2新建了一个工程,但是在编译ralease版本时候,发现仍然无法添加UAC,但是debug版本可以加入UAC。通过多次尝试依然无法解决,最后 Read More
posted @ 2016-03-02 23:33 findumars Views(257) Comments(0) Diggs(0)
我在NT Service里,使用delphi的CompareDate函数出错,我怀疑这个函数有bug,总是说我的参数多了'',所以没办法自己弄了一个! [delphi] view plain copy { //功能:比较日期 //参数: //a:比较的日期,格式(2013-07-23) //b:要比 Read More
posted @ 2016-03-02 23:32 findumars Views(233) Comments(0) Diggs(0)
在win7下,开发的程序有的时候莫名其妙就不能正常工作了,其实都是因为权限不够,要想能够正常运行,就需要获得管理员权限,这就需要处理UAC。具体方法如下: 一,制作“uac.manifest”文件。新建一个名为“uac.manifest”的文件,在里面加入如下内容: [plain] view pla Read More
posted @ 2016-03-02 23:32 findumars Views(632) Comments(0) Diggs(0)
Gmail真的是一个很好的邮箱,一直是我的最爱!它有一个很独特的功能-别名,用这个功能,我们就可以把一个 邮箱当成很多个邮箱来使用了! 1.Gmail 不提供传统别名 ,但是你可以收到发送到 your.username+any.alias@gmail.com(您的用户名+任意别名@gmail.com Read More
posted @ 2016-03-02 23:31 findumars Views(2425) Comments(0) Diggs(0)
其实不论什么方法,归根揭底都是通过传递对象的指针来达到效果的。 方法一: procedure SendString(strMSG: string);var Data: tagCOPYDATASTRUCT; pBuf: PChar;begin GetMem(pBuf, Length(strMSG) + Read More
posted @ 2016-03-02 23:28 findumars Views(553) Comments(0) Diggs(0)
关于延迟时间的一点智慧 一般的做法: Sleep(2000); // 延迟2秒此种做法有俩个弊端:(1)如果实际需要的延迟时间不需要2秒,则明显有延迟时间浪费;(2)如果实际需要的延迟时间超过2秒,则很可能发生不可预料的错误。 改进的做法: repeat Sleep(10); until FileE Read More
posted @ 2016-03-02 23:27 findumars Views(257) Comments(0) Diggs(0)
procedure SplitFile(FileName : TFileName; FilesByteSize : Integer) ;// FileName == file to split into several smaller files// FilesByteSize == the siz Read More
posted @ 2016-03-02 23:26 findumars Views(256) Comments(0) Diggs(0)
如果WINDOWS系统的短日期格式为“yyyy/m/d”,执行下面的代码会报错:2013-01-29 00:00:00不是合法的日期procedure TFrmQuerySale.FormShow(Sender: TObject);varsDate: string;begininherited;// Read More
posted @ 2016-03-02 23:24 findumars Views(1321) Comments(0) Diggs(0)
//////////////////////////////////////////////////////////////////////////////////功能: STRING 的内容流化到 OLEVARIANT 中//参数:///////////////////////////////// Read More
posted @ 2016-03-02 23:23 findumars Views(849) Comments(0) Diggs(0)
对于守护中间件是非常有用的。中间件不可能绝对的稳定而不出问题,中间件有可能因比较严重的错误导致当机或者进程被人为地错误地关闭了中间件。 有了这个自动守护进程的存在,这一切的问题都可以迎刃而解。 program Monitor; // {$APPTYPE CONSOLE} usesWinapi.Win Read More
posted @ 2016-03-02 23:22 findumars Views(458) Comments(0) Diggs(0)
DELPHI XE7 的新功能列表里面增加了并行库System.Threading, System.SyncObjs。 为什么要增加新的并行库? 还是为了跨平台。以前要并行编程只能从TThread类继承进行多线程处理,大家知道TThread类是从WINDOWS的线程API封装起来的,它封装的是WIN Read More
posted @ 2016-03-02 23:19 findumars Views(451) Comments(0) Diggs(0)
DELPHI7在WIN8下安装后可以打开运行,但发现设置断点DEBUG运行DLL工程时会卡死(IDE长时间无反应,不报错)。 DELPHI7在WIN10下安装后打开的时候会报错,无法运行。 以上两种情况的解决办法: 设置DELPHI32.EXE以WINDOWS XP SP2的兼容模式下运行后一切正常 Read More
posted @ 2016-03-02 23:18 findumars Views(12780) Comments(0) Diggs(1)
string,DELPHI2009以前的版本string=ansistring,一个字符占一个字节,DELPHI2009及以上版本string=unicodestring,一个字符占二个字节。 char,DELPHI2009以前的版本char=ansichar,一个字节,DELPHI2009及以上版 Read More
posted @ 2016-03-02 23:17 findumars Views(518) Comments(0) Diggs(0)
IdHttpServer实现webservice 朋友有个项目,通信协议使用HTTP,数据序列使用BIN(二进制)。他不知道要选用何种技术方案。 REST webservice是http+json,SOAP webservice是http+xml,好像都不适合。 于是想到了使用INDY的TidHtt Read More
posted @ 2016-03-02 23:13 findumars Views(1583) Comments(0) Diggs(0)
Delphi代码 unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class( Read More
posted @ 2016-03-02 22:19 findumars Views(457) Comments(0) Diggs(0)
java中的反射机制使我们能够在运行期间获取运行期类的信息,那么在delphi中有没有这样的功能呢?答案是有,实现这种功能的机制在delphi中叫做RTTI,废话少说,先来一段demo: 1.先定义一个demo类,注意这个类必须要以TPersistent为基类,代码如下: Delphi代码 unit Read More
posted @ 2016-03-02 22:17 findumars Views(535) Comments(0) Diggs(0)
最近在做的一个软件,其中有一部分功能需要调用其它的软件来完成,而那个软件只有可执行文件,根本没有源代码,幸好,我要做的事不难,只需要在我的程序启动后,将那个软件打开,在需要的时候,对其中的一个文本矿设置一些文字,再点击一个按钮就可以了。说到这里,相信你也有了对该功能的一些初步设想了,没错,其基本思路 Read More
posted @ 2016-03-02 22:16 findumars Views(7881) Comments(1) Diggs(4)
前言:网上有很多介绍delphi创建闪屏的代码,大多只是在程序开启前显示一个闪屏,但是却没有说如何在闪屏上显示程序加载的进度,于是笔者有意思介绍一下这种闪屏方式。 1.创建一个窗体(TfrmSplash),放入一个TImageBox,加载一幅图片,调整好TImageBox与图片的大小,然后在其上放入 Read More
posted @ 2016-03-02 22:14 findumars Views(1114) Comments(0) Diggs(0)
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Bu Read More
posted @ 2016-03-02 22:13 findumars Views(1222) Comments(0) Diggs(0)
最近做了一个英汉小翻译的东东,用的是VC,ADO + Access访问数据库,单词数据库是从金山打字通2002弄来的。后来想了想,想再加个在线翻译的功能,记得经常使用GOOGLE翻译网站的在线翻译,也蛮好用的。于是用Ethereal抓包工具抓了一下它的包,发现浏览器发出去的包格式如下:POST /t Read More
posted @ 2016-03-02 21:42 findumars Views(1577) Comments(0) Diggs(0)
作者: 阮一峰 日期: 2015年12月15日 如果你经常使用互联网,可能知道有一种东西叫做Flash。 它是一种软件,用来制作网页游戏、动画,以及视频播放器。只要观看网络视频,基本都会用到它。 七八年前,它是最热门的互联网技术之一。如果不安装Flash,很多网站根本打不开。那时还流行用它制作动画, Read More
posted @ 2016-03-02 19:36 findumars Views(308) Comments(0) Diggs(0)
http://www.ruanyifeng.com/blog/2014/05/oauth_2_0.html http://blog.unvs.cn/archives/oauth-qq1.0-developer.html http://blog.unvs.cn/archives/oauth-qq2-0 Read More
posted @ 2016-03-02 18:46 findumars Views(207) Comments(0) Diggs(0)
http://www.ruanyifeng.com/blog/2010/11/cpu_autopsy.htmlhttp://bbs.mydigit.cn/read.php?tid=110272http://itbbs.pconline.com.cn/notebook/11026377.html Read More
posted @ 2016-03-02 17:26 findumars Views(336) Comments(0) Diggs(0)