随笔分类 - Delphi
摘要:还是老问题,保存PDF字体时字体名编码错误,和2.x/3.x时一样的错误,修正其实很简单。用下面的替换TfrxPDFFont.GetFontName:AnsiString中的同名函数functionHexEncode7F(Str:WideString):AnsiString;vars:AnsiString;//addbyijia2010-04-05t:AnsiString;Index,Len:Integer;begins:='';//addbyijia2010-04-05t:=Str;Len:=Length(t);Index:=0;whileIndex<Lendobegi
阅读全文
摘要://静态加载SwitchToThisWindowprocedure SwitchToThisWindow(hWnd:Thandle;fAltTab:boolean);stdcall;external 'User32.dll'; procedure TForm1.Button1Click(Sender: TObject);varh:thandle;beginh:=findwindow(nil,'te...
阅读全文
摘要:我们经常能看到360安全卫士进行windows系统升级时,执行windows升级程序,当升级程序执行完成后,360马上弹出提示框。这样的程序是如何做到的呢?下述代码就能完成!uses shellAPI;procedure TForm1.Button1Click(Sender: TObject);varSEInfo: TShellExecuteInfo;ExitCode: DWORD;Execute...
阅读全文
摘要:--删除IE缓存记录uses WinInet;procedure DeleteIECache;var lpEntryInfo: PInternetCacheEntryInfo; hCacheDir: LongWord; dwEntrySize: LongWord;begin dwEntrySize := 0; FindFirstUrlCacheEntry(nil, TInternetCacheEn...
阅读全文
摘要:procedure TForm1.Timer1Timer(Sender: TObject);var vLastInputInfo: TLastInputInfo;begin vLastInputInfo.cbSize := SizeOf(vLastInputInfo); GetLastInputInfo(vLastInputInfo); if GetTickCount - vLastInp...
阅读全文
摘要://取本机的 IP 地址function ComputerLocalIP: string;var ch: array[1..32] of char; wsData: TWSAData; myHost: PHostEnt; i: integer;begin Result := '';if WSAstartup(2,wsData)<>0 then Exit; // can’t ...
阅读全文
摘要:1.在private添加procedure ComponentControl(Control: TControl; Shift: TShiftState; X,Y,Precision: integer);2.添加代码procedure TForm1.ComponentControl(Control: TControl; Shift: TShiftState; X, Y, Precision: in...
阅读全文
摘要:在实际工作中,需要把窗体的BorderStyle设置为bsNone,但这样窗体却无法拖动了.那只好自己写代码实现:private {Private declarations} OldX,OldY:integer; //定义变量procedure TForm1.FormMouseDown(Sender:TObject;Button:TMouseButton; Shift:TShiftState;X,...
阅读全文
摘要:以前调用关机对话框时,一般有两种方法,一种是利用shell的com对象,另一种是声明这个API,这个api是以序号导出的,delphi并没有声明,要自己写.今天发现的方法如下:查找桌面句柄标题为Program Manager类名为Progman 或者为Shell_TrayWnd 向这个窗口发送WM_Close消息就会出现关机对话框. procedure TForm1.Button1Click(Se...
阅读全文
摘要:最近用C#做一个根据自定义条件Search file 的工具, 查找相关方面的资料:function GetFilenames(FilePath,ExtMask: String):TStrings; //遍历目录var FileRec :TSearchrec;begin if DirectoryExists(FilePath) then begin if FilePath[Length(FileP...
阅读全文
摘要:转自:http://hi.baidu.com/rarnu/blog/item/c186e1dde2e9d6ea77c638d4.html以往删除目录时,都需要先用递归删干净目录下的文件和子文件夹,这样做的时候,如果文件数量大,那么删除会非常慢于是找了个方便一点的方法,直接使用API将目录删除代码如下:function DelDirectory(const Source: string): bool...
阅读全文
摘要://判断文件是否存在 FileExists//判断文件夹是否存在 DirectoryExists//删除文件 DeleteFile; Windows.DeleteFile//删除文件夹 RemoveDir; RemoveDirectory//获取当前文件夹 GetCurrentDir//设置当前文件夹 SetCurrentDir; ChDir; SetCurrentDirectory//获取指定驱...
阅读全文
摘要:一个修改系统时间的函数,超简单[代码]
阅读全文
摘要:最近在做个项目,客户要求终端用户退出系统则关机,于是在网上找到这段代码:[代码]
阅读全文
摘要:一、环境 1、Delphi 2006 (Version10.0.2151.25345) 2、FastReport4.5 full source,下载地址(www.ccrun.com) 这个版本支持Delphi 4~7, 2005, C++Builder 4~6, BDS2006, RAD Studio 2007 3、目录结构D:\EFine\控件\FastReport4.5,解压后目录结构...
阅读全文
摘要:元件名稱:StringGrid ●固定行及固定列: StringGrid.FixedCols:=固定行之數; StringGrid.FixedRows:=固定列之數; StringGrid. FixedColor:=固定行列之顏色; StringGrid.Color:=資料區之顏色; ●資料行列之寬高度: ...
阅读全文
摘要:本文来自刘艺的Blog ] Delphi惹谁了 最早的时候就有C++程序员做Win32的产品没有Delphi程序员快,不服气地说Delphi的不好,理由是Delphi只能拖拉控件,不能OOP。几年以前,当Java刚刚火起来的时候,Java程序员说Delphi不行,理由是Delphi不能开发web。后来有一本《Java与模式》的书让Java程序员大开眼界,他们常常在与Delphi程序员论战时使出撒...
阅读全文
摘要:unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, DB, ADODB, Mask, DBCtrls, ExtCtrls, jpeg, ExtDlgs; type TForm1 = class...
阅读全文
摘要:转自 http://mydelphi.5d6d.com/thread-302-1-2.html 注意要USES DB 单元 主要代码: procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawSta...
阅读全文

浙公网安备 33010602011771号