2007-07-06 11:28 | Posted by Sunshow | Filed Under Delphi
IdFTP1.List; ShowMessage(IntToStr(IdFTP1.ListResult.Count)); ShowMessage(IntToStr(IdFTP1.DirectoryListing.Count)); 前者是正确的数值,后者是0。 看了一下网上的代码都是List完了就直接用,DirectoryListing会自动解析ListResult 放狗搜了半天,终于找到原因,原来是Indy10的一个设计上的变化,以下引用官网内容: TIdFTP.DirectoryListing is returning nothing for my FTP server. Why? We restructured the way FTP directory listing is done. The code is now a plug in system with various parsers in their own units which register themselves into a framework. To add support for a particular type of FTP server, [...]
2007-07-06 08:32 | Posted by Sunshow | Filed Under Delphi
function TScanFileThread.MoveFile(FileName: string): Boolean;var F: TShFileOpStruct;begin with F do begin Wnd := Handle; wFunc := FO_MOVE; pFrom := PChar(Directory + FileName + #0#0); pTo := PChar(SaveDirectory + FileName + #0#0); fFlags := FOF_RENAMEONCOLLISION or FOF_NOCONFIRMMKDIR; end; if ShFileOperation(F) = 0 then begin Result := True; end else begin Result := False; end;end; 一开始pFrom和pTo没有以“#0#0”结尾,结果发现在有的机器上能移动成功,有的机器上SHFileOperation返回1026无法转移,查了一下资料 ShFileOperation中的pFrom和pTo中可以包含多个文件名,文件名之间用 '\0' [...]
2007-07-02 18:45 | Posted by Sunshow | Filed Under Delphi
uses ActiveX, MSHtml; var Document: IHtmlDocument2; V: OleVariant; begin WebBrowser1.Navigate('about:blank'); Document := WebBrowser1.Document as IHtmlDocument2; V := VarArrayCreate([0, 0], varVariant); V[0] := 'Hello World'; Document.Write(PSafeArray(TVarData(v).VArray)); end; 标签:Delphi, html, TWebBrowser 相关日志 TTreeView的使用 (0) 有时候注释也不能乱写 (1) Delphi 2007 for Win32企业版安装方法 (10) 大杂烩ActionScript3 (0) 打印 HTML 网页强制换页的方式 (0)
2007-06-28 16:43 | Posted by Sunshow | Filed Under Delphi
按照yyyy-m-d的方式插入时候,也就是个位数的月份不补零,插入正确,读取的时候直接报错或者直接是1899的默认日期了 按照yyyy-mm-dd的方式则插入读取都正常 因为用sqlite自己的命令行读取操作两种方式都没有问题,所以只能怀疑是ASQLite3封装的有问题了,lol 标签:SQLite, 日期 相关日志 看上去不错的日期控件 (1)
2007-05-31 19:39 | Posted by Sunshow | Filed Under Delphi
先说一下我要达到的目的,一个Form分成两个Panel,左边放置TTreeView,右边根据TTreeView的不同选择切换不同的Frame或Form。 首先定义一个数据结构来保存每一个TTreeNode的数据,可以根据需要放更多的数据进去: unit TreeNodeDataUnit; interface uses Classes; type TreeNodeData = Record id: Int64; InstanceClass: TComponentClass; end; implementation end. 其中InstanceClass字段用来保存每个TTreeNode所对应的Frame或Form。 以如下定义为例: type TForm1 = class(TForm) Panel1: TPanel; Panel2: TPanel; TreeView1: TTreeView; procedure FormCreate(Sender: TObject); procedure TreeView1Change(Sender: TObject; Node: TTreeNode); private { Private declarations } public { Public declarations } end; 开始创建TTreeView,在Form的OnCreate中创建: procedure TForm1.FormCreate(Sender: TObject); var items: [...]
Recent Comments