小编Bil*_*ill的帖子

获取Delphi 2010 Comandline编译器行号

有没有办法让Delphi 2010命令行编译器(dcc32.exe)行号传回管道中的GUI应用程序进度条?

作为替代方案,从以下字符串返回(行号)是一个很好的函数:

C:\Components\Dabbler\Pipes\Demos\Demo3\TestUnit\uGlobal.pas(20) 
C:\Components\Dabbler\Pipes\Demos\Demo3\TestUnit\uGlobal.pas(339) 
C:\Components\Dabbler\Pipes\Demos\Demo3\TestUnit\uGlobal.pas(341) 
C:\Components\Dabbler\Pipes\Demos\Demo3\TestUnit\uGlobal.pas(512) 
C:\Components\Dabbler\Pipes\Demos\Demo3\TestUnit\uGlobal.pas(1024) 
C:\Components\Dabbler\Pipes\Demos\Demo3\TestUnit\uGlobal.pas(1536) 
C:\Components\Dabbler\Pipes\Demos\Demo3\TestUnit\uGlobal.pas(2048) 
C:\Components\Dabbler\Pipes\Demos\Demo3\TestUnit\uGlobal.pas(2560) 
C:\Components\Dabbler\Pipes\Demos\Demo3\TestUnit\uGlobal.pas(3072) 
C:\Components\Dabbler\Pipes\Demos\Demo3\TestUnit\uGlobal.pas(3342)  
Run Code Online (Sandbox Code Playgroud)

delphi delphi-2010

1
推荐指数
1
解决办法
256
查看次数

TClientDataSet 缺少数据提供程序

这个问题没有任何代码,但我必须寻求帮助,因为我无法解决这个问题。我在 SO 上搜索了类似的问题,发现了几个答案并没有帮助我解决这个问题。

我在用我的主开发电脑创建 TClientDataSet 项目时遇到问题,所以我尝试在我的 Windows 平板电脑上创建一个项目。两台电脑都运行带有 DelphiXE4 的 Windows 8.1。

我在一个新项目中添加了一个 TClientDataSet、一个 TDataSource 和一个 TDatasetProvider。我在设计时在 FieldDefs 中添加了 3 个字段,然后从 TClientDataSet 的弹出菜单中选择了 CreateDataset。数据集创建得很好,所以我继续添加一个 TDBGrid,TDBNavigator,输入一些数据并将 TClientDataSet 保存到一个文件中。

小型演示应用程序运行良好,没有任何问题。我可以查看和输入数据,保存到文件并从文件加载,所以我压缩了项目并将其复制到我的开发电脑。我尝试运行演示,但是当 LoadFromFile 被调用时,会发生缺失数据提供程序异常。我尝试删除 xml 文件,然后尝试使用我在平板电脑上使用的相同过程重新创建该文件,但我再次收到缺少数据提供程序的消息。

在跟进 SO 答案时,我按照几个 SO 答案中的建议添加了 MidasLib,但未能解决问题。我搜索了 Midas.DLL 并发现它们存在。

我的问题:dsnap180.bpl 是否可能已损坏或我的开发电脑中缺少其他东西?我的目标是能够在我的开发电脑上创建和打开 TClientDataset。任何建议或指导表示赞赏。

编辑 Kens 演示

帕斯

    unit Unit1;

    interface

    uses
      Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
      System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.Grids,
      Vcl.DBGrids, Data.DB, Datasnap.DBClient;

    type
      TForm1 = class(TForm)
        ClientDataSet1: TClientDataSet;
        DataSource1: TDataSource;
        DBGrid1: TDBGrid;
        procedure FormCreate(Sender: TObject);
      private
        { Private …
Run Code Online (Sandbox Code Playgroud)

delphi delphi-xe4

1
推荐指数
1
解决办法
7152
查看次数

如何在使用ShellExecute创建的电子邮件中包含换行符?

我可以使用ShellExecute成功发送电子邮件.收件人地址是正确的,发件人地址是正确的,主题是正确的.电子邮件的正文是正确的,除了根本没有换行符,所有内容都显示为单个段落,没有换行符.我的默认电子邮件客户端是Windows 8.1邮件.

我的问题是,可以使用ShellExecute以保留换行符吗?我不打算直接发送电子邮件给Indy.我需要做的就是向默认的电子邮件客户端发送电子邮件并正确格式化.

procedure TForm1.Email1Click(Sender: TObject);
var
  iGridTableItem: TcxCustomGridTableItem;
  iName, iDate, iEmail, iSubject, iBody, iParam: string;
begin
  iGridTableItem := cxGrid1DBTableView1.DataController.
    GetItemByFieldName('EMail');
  if iGridTableItem.EditValue <> null then
  iEmail := iGridTableItem.EditValue;
  iGridTableItem := cxGrid1DBTableView1.DataController.
    GetItemByFieldName('Name');
  if iGridTableItem.EditValue <> null then
  iName := iGridTableItem.EditValue;
  iGridTableItem := cxGrid1DBTableView1.DataController.
    GetItemByFieldName('Date');
  if iGridTableItem.EditValue <> null then
  iDate := DateToStr(iGridTableItem.EditValue);
  iSubject := 'ImageEn EBook';
  iBody := 'Dear Mr. ' + iName + ',' + sLineBreak + sLineBreak +
    'PayPal has advised me that you purchased …
Run Code Online (Sandbox Code Playgroud)

mailto delphi shellexecute delphi-xe7

1
推荐指数
1
解决办法
329
查看次数

如何在运行时在HTML文档中插入链接?

在网上搜索了很多createElement和insertAdjacentHTML后,我想出了这段代码.执行代码时,链接不会插入HTML.该链接是本地文件的链接.我究竟做错了什么?

var
  HTMLDocument2Ifc: IHTMLDocument2;
  iLinkString: string;
  iTopicString: string;
  iLink: IHTMLElement;
begin
  FormInsertLink := TFormInsertLink.Create( Self );
  try
    if FormInsertLink.ShowModal = mrOk then
    begin
      // <A HREF="file://..\html\author.htm">Author</A>
      HTMLDocument2Ifc := TopicWebBrowser1.Document as IHTMLDocument2;
      iLinkString := FormInsertLink.EditLink1.Text; // file://..\html\author.htm
      iTopicString := FormInsertLink.EditTopic1.Text; // Author
      iLink := HTMLDocument2Ifc.createElement('a');
      iLink.InnerText := iLinkString;
      iLink.insertAdjacentHTML('afterEnd', '<A HREF="' + iLinkString + '">' + iTopicString + '</A>');
    end;
  finally
    FormInsertLink.Free;
  end;
Run Code Online (Sandbox Code Playgroud)

delphi

0
推荐指数
1
解决办法
2859
查看次数

如何在没有Synchronize的情况下使用Delphi版本(Pre Delphi 2010)更新GUI控件

我有一些使用Delphi 2010和XE4构建的应用程序,它们在一个线程中使用Synchronize.我认为在Delphi 2010中将Synchronize引入了Delphi.我的线程运行得很好,所以这不是问题.

我的问题是:有没有办法在Delphi 2010之前与Delphi版本"同步"或者以不同的方式询问它,如何在没有Synchronize的情况下更新这些早期版本的Delphi中的GUI控件?

下面显示的代码是实际代码的子集,以减少此帖子的长度.

type
  { A TThread descendent for loading Images from a folder }
  TFolderLoadingThread = class(TThread)
  private
    { Private declarations }
    AspectRatio: double;
  protected
    { Protected declarations }
    procedure Execute; override;
  public
    { Public declarations }
    constructor Create(CreateSuspended: Boolean);
  end;

procedure TFolderLoadingThread.Execute;
{ Load images ImageEnView in the thread. }
begin
  inherited;
  { Free the thread onTerminate }
  FreeOnTerminate := True;
  if not Terminated then
  begin
    { Set the Progressbar.Max Value }
    **Synchronize**(
      procedure
      begin …
Run Code Online (Sandbox Code Playgroud)

delphi multithreading vcl delphi-2010 delphi-xe4

0
推荐指数
1
解决办法
1932
查看次数

如何使用dupError处理StringList中的重复项

这是尝试将文件名添加到字符串列表.如果向列表中添加重复的文件名,则引发异常并从列表中删除原始文件.我从帮助文件中了解到,如果找到重复文件,将返回现有条目的索引,然后可以使用该索引删除现有条目.

此代码的问题是,当找到重复时,不执行EListError异常中的代码.

我的问题是,如果存在重复的文件名,你如何从列表中删除原始文件名?实质上,如果在添加副本时检测到重复,我想从列表中删除原始文件.不幸的是,当将重复文件添加到列表时,异常陷阱中的代码不会执行.

{ Create a list of files to delete }
iListOfImagesToDelete := TStringList.Create;
try
  { Get a ListOfFiles in each collection }
  iCollectionList := TStringList.Create;
  try
    iListOfImagesToDelete.Duplicates := dupError;
    iListOfImagesToDelete.Sorted := True;
    { Add filenames to a stringlist with Duplicates set to dupError and Sorted set to True }
    iFileCount := iCollectionList.Count;
    for j := 0 to iFileCount - 1 do
      begin
        iFilename := iCollectionList[j];
        if FileExists(iFilename) then
        begin
           try
             iFileIndex := iListOfImagesToDelete.Add(iFilename);
           except
           { file exists in …
Run Code Online (Sandbox Code Playgroud)

delphi delphi-xe4

-2
推荐指数
1
解决办法
944
查看次数