随笔分类 -  delphi技巧文章

delphi word转pdf两种方法。
摘要:1 uses ComObj; 2 procedure TForm1.Button1Click(Sender: TObject); 3 var 4 wdo,wdoc,wdocs : OleVariant; 5 begin 6 wdo := CreateOleObject('Word.Application'); 7 wdocs := wdo.Documents; 8 ... 阅读全文
posted @ 2016-05-26 10:36 东睿软件工作室 阅读(4213) 评论(0) 推荐(0)
解决delphi安装出现内部错误的办法!(所有安装都有这个问题)
摘要:For "Object already exists" or "Access denied" errors when installing try opening Control Panel > Programs and Features > View installed updates then ... 阅读全文
posted @ 2014-12-12 10:04 东睿软件工作室 阅读(389) 评论(0) 推荐(0)
HMACSHA512算法!
摘要:function EncryptHMACSha512(Input, AKey: String): String; var SHA512 : TIdHMACSHA512; tmp:String; begin SHA512:=TIdHMACSHA512.Create; try SHA512.Key:=TIdDecoderMIME.DecodeBytes(AKey); Result:=TIdEncoderMIME.EncodeBytes(SHA512.HashValue(bytesof(Input))); finally SHA512.Free; end;end;结果与此网址一致:http://ca 阅读全文
posted @ 2013-08-28 12:58 东睿软件工作室 阅读(1675) 评论(0) 推荐(1)
其实是很基本的用户登录检测sql,怕自己忘记备注一下
摘要:selectisnull(sum(casewhenpassword='input_password'then2else1end),0)asOKfromuserid='input_userid'OK=0用户名不存在OK=1密码错误OK=2验证成功 阅读全文
posted @ 2013-08-21 11:14 东睿软件工作室 阅读(174) 评论(0) 推荐(0)
mysql 返回email地址里的域名后缀
摘要:SUBSTRING( email, INSTR( email, '@' ) ) 阅读全文
posted @ 2013-05-18 17:10 东睿软件工作室 阅读(329) 评论(0) 推荐(0)
[转] delphi 数据导出到word!
摘要:1 procedure TFrmWeekAnalysisQry.BtnExportToExcelClick(Sender: TObject); 2 var wordApp,WordDoc,WrdSelection:variant; 3 strAdd:string; 4 i,j,iRangeEnd,iStart,iEnd : integer; 5 wdPar,wdRange:OleVariant; 6 oShape, oChart,myCol: OleVariant; 7 SumJHTonCount, SumWCTonCount, PJTS, PJZCSJ, ... 阅读全文
posted @ 2013-03-31 00:33 东睿软件工作室 阅读(3296) 评论(1) 推荐(0)
分割字符串 ExtractStrings
摘要://分割字符串 ExtractStringsvar s: String; List: TStringList;begin s := 'about: #delphi; #pascal, programming'; List := TStringList.Create; ExtractStrings([';',',',':'],['#',' '],PChar(s),List); //第一个参数是分隔符; 第二个参数是开头被忽略的字符 ShowMessage(List.Text); //about //d 阅读全文
posted @ 2013-03-07 15:32 东睿软件工作室 阅读(363) 评论(0) 推荐(0)
文件查找与日期转换
摘要:const Model='yyyy-mm-dd,hh:mm:ss'; { 设定时间格式 }implementation{$R *.dfm}function CovFileDate(Fd:_FileTime):TDateTime;{ 转换文件的时间格式 }var Tct:_SystemTime; Temp:_FileTime;begin FileTimeToLocalFileTime(Fd,Temp); FileTimeToSystemTime(Temp,Tct); CovFileDate:=SystemTimeToDateTime(Tct);end;function IsVal 阅读全文
posted @ 2012-08-17 15:35 东睿软件工作室 阅读(195) 评论(0) 推荐(0)
Idhttp友好错误信息的捕获
摘要:我们在捕获Idhttp的错误信息的时候通常只能捕获到类似http1.1 403 Error的信息,而在IE中有时可以显示友好HTTP错误信息,跟踪发现Idhttp在输出exception.message时,只取了错误信息的第一行信息,而把后面的内容都删除掉了。其实后面的信息并没有被完全抛掉,而是存在了EIdHTTPProtocolException的ErrorMessage中,我们通过此字段可以获得。示例代码如下: try FIdhttp.Get('http://www.prize8.com', newHtmlStream); except on... 阅读全文
posted @ 2012-04-21 10:27 东睿软件工作室 阅读(1212) 评论(0) 推荐(0)
检测线程是否存活代码!
摘要:在delphi处理线程的时候常常会造成某些未知的bug,搞得程序无法继续往下走,所以此时我们必需要有应对手策,否则的话,很容易造成我们的工作无法完成 unit Unit1;interfaceusesWindows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,Dialogs, StdCtrls, Tlhelp32;typeTDemoThread = class(TThread)private FOnHintText: TNotifyEvent;protected procedure Execute... 阅读全文
posted @ 2012-03-29 16:01 东睿软件工作室 阅读(1731) 评论(0) 推荐(0)
判断IP地址是否非法!
摘要:判断IP地址是否非法的代码: 1 function TForm1.IsIPString(IPStr: string): Boolean; 2 var 3 i,DotNum:integer; 4 Tmpstr:string; 5 begin 6 Result:=true; 7 DotNum:=0; 8 for i:=1 to Length(IPStr) do 9 Case IPStr[i] of10 '0'..'9','.':11 ... 阅读全文
posted @ 2012-03-06 16:33 东睿软件工作室 阅读(892) 评论(0) 推荐(0)
用API测试是否连接网络!
摘要:uses Wininet;{$R *.dfm}function NetWorkIsConnect(Url:string='http://www.microsoft.com/'): Boolean;var ConTypes : Integer;begin Result := false; ConTypes := INTERNET_CONNECTION_MODEM + INTERNET_CONNECTION_LAN + INTERNET_CONNECTION_PROXY; if InternetGetConnectedState(@ConTypes, 0) then //Con.. 阅读全文
posted @ 2011-11-26 08:54 东睿软件工作室 阅读(388) 评论(0) 推荐(0)
WebBrowser这个控件实现去除滚动条,边框,右键
摘要:有时侯为了界面的简洁好看还有程序的安全性,我们都希望WebBrowser这个控件可以实现去除滚动条,边框,右键,下面这两个方法可以充分满足我们的需求://去除边框,滚动条Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->1 procedure WB_Set3DBorderStyle(Sender: TObject; bValue: Boolean);2 var3 Document : IHTMLDocument2;4 Element : IHT 阅读全文
posted @ 2011-01-11 21:21 东睿软件工作室 阅读(3407) 评论(0) 推荐(0)