小编Pie*_*Wyk的帖子

日志文件监视器

是否可以打开文本文件并在另一个应用程序更新文件时读取内容,这样它不会导致锁定冲突?

我需要监视来自一个应用程序的日志文件,每次事件发生时由另一个应用程序更新.

我在尝试阅读之前检查文件是否正在使用,但这似乎并不适用于所有情况.

谢谢,彼得

delphi file-io file-locking

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

是否有针对后Delphi 2007的WmiSet的替换或更新?

我们目前使用WmiSet从网上联系到远程机器上运行的WMI查询和查询注册表设置.

问题是它只支持Delphi直到RAD Studio 2007.

我们目前正在升级到Delphi XE,需要知道是否有人知道 - 或者有 - 更新版本的WmiSet组件或类似的东西.

我们已尝试与供应商联系,但到目前为止,我们的任何查询都没有任何回复.

delphi wmi wmi-query

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

delphi xpath xml查询

我正在尝试<Link role="self">使用XPath查询在以下XML文件中找到值.

<?xml version="1.0" encoding="utf-8"?>
<Response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns:xsd="http://www.w3.org/2001/XMLSchema"
          xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1">
    <Copyright>Copyright © 2011 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.</Copyright>
    <BrandLogoUri>http://spatial.virtualearth.net/Branding/logo_powered_by.png</BrandLogoUri>
    <StatusCode>201</StatusCode>
    <StatusDescription>Created</StatusDescription>
    <AuthenticationResultCode>ValidCredentials</AuthenticationResultCode>
    <TraceId>ID|02.00.82.2300|</TraceId>
    <ResourceSets>
        <ResourceSet>
            <EstimatedTotal>1</EstimatedTotal>
            <Resources>
                <DataflowJob>
                    <Id>ID</Id>
                    <Link role="self">https://spatial.virtualearth.net/REST/v1/dataflows/Geocode/ID</Link>
                    <Status>Pending</Status>
                    <CreatedDate>2011-03-30T08:03:09.3551157-07:00</CreatedDate>
                    <CompletedDate xsi:nil="true" />
                    <TotalEntityCount>0</TotalEntityCount>
                    <ProcessedEntityCount>0</ProcessedEntityCount>
                    <FailedEntityCount>0</FailedEntityCount>
                </DataflowJob>
            </Resources>
        </ResourceSet>
    </ResourceSets>
</Response>
Run Code Online (Sandbox Code Playgroud)

我在上一篇文章中看到了一个XPath查询,但我 …

xml delphi xpath

4
推荐指数
3
解决办法
6156
查看次数

delphi比较文本文件内容

我们需要比较两个(或更多)文本文件的内容,以确定是否需要创建备份.如果它们不同,我们会创建一个新备份.

我目前使用每个文件的CRC值来检查差异,但我想知道是否有更有效或更优雅的方法来检测文件之间的差异.

//Use madZIP to calculate the CRC fior this file
GetUncompressedFileInfo(Filename_1, Size_1, NewCRC);

//Use madZIP to calculate the CRC fior this file
GetUncompressedFileInfo(Filename_2, Size_2, OldCRC);

//if ThisFileHash = ExistingFileHash then
if (OldCRC <> NewCRC) then
  CreateABackup;
Run Code Online (Sandbox Code Playgroud)

问候,彼得.

delphi compare file

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

Delphi检查类型声明中的变量值

如何确定变量的值是否在"类型声明"的范围内.防爆.

Type
  TManagerType = (mtBMGR, mtAMGR, mtHOOT);

...

var
  ManagerType: TManagerType;

....


procedure DoSomething;
begin
  if (ManagerType in TManagerType) then
    DoSomething
  else
    DisplayErrorMessage;
end;
Run Code Online (Sandbox Code Playgroud)

谢谢,彼得.

delphi types typechecking

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

两个不同的TThread后代如何共享一个OnTerminate处理程序?

我有一个应用程序启动一些线程来做东西.我有一个TThreadOnTerminate程序,每个线程访问一些线程变量,用结果填充网格.(每个线程执行不同的任务,但答案总是相同的,即成功或失败StringList的消息.)

所以我有:

procedure TFormMain.Thread1OnTerminate(Sender: TObject);
begin
  Result := TThread1(Sender).Result;
  AddMessagesToGrid(TThread1(Sender).Messages);
end;

procedure TFormMain.Thread2OnTerminate(Sender: TObject);
begin
  Result := TThread2(Sender).Result;
  AddMessagesToGrid(TThread2(Sender).Messages);
end;
Run Code Online (Sandbox Code Playgroud)

我的问题如下.我可以有一个'通用' OnTerminate程序来处理我所有线程的结果,如下所示?

procedure TFormMain.Thread1OnTerminate(Sender: TObject);
begin
  Result := <Sender Thread>.Result;
  AddMessagesToGrid(<Sender Thread>.Messages);
end;
Run Code Online (Sandbox Code Playgroud)

我们目前正在使用Delphi 2007.很快就升级(我希望)到Delphi XE.

delphi multithreading

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

如何制作系统模式窗口?

是否有可能使应用程序系统的主要形式模态化?我的应用程序将从远程公司PC FTP文件.在此过程正在进行时,不应允许用户与桌面交互.

Application.MainFormOnTaskbar := True;
Application.ShowMainForm := False;
...
FormChild.ShowModal;
Run Code Online (Sandbox Code Playgroud)

delphi kiosk modal-dialog

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

delphi读取xml元素

我是XML的新手,我们需要使用新的Bing Spatial Data API进行GeoCoding .我已经设法以xml格式从他们那里得到了一个结果.我如何阅读响应中的特定元素,即.链接,状态和错误消息?

<?xml version="1.0" encoding="utf-8"?>
<Response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1">
    <Copyright>Copyright © 2011 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.</Copyright>
    <BrandLogoUri>http://spatial.virtualearth.net/Branding/logo_powered_by.png</BrandLogoUri>
    <StatusCode>201</StatusCode>
    <StatusDescription>Created</StatusDescription>
    <AuthenticationResultCode>ValidCredentials</AuthenticationResultCode>
    <TraceId>ID|02.00.82.2300|</TraceId>
    <ResourceSets>
        <ResourceSet>
            <EstimatedTotal>1</EstimatedTotal>
            <Resources>
                <DataflowJob>
                    <Id>ID</Id>
                    <Link role="self">https://spatial.virtualearth.net/REST/v1/dataflows/Geocode/ID</Link>
                    <Status>Pending</Status>
                    <CreatedDate>2011-03-30T08:03:09.3551157-07:00</CreatedDate>
                    <CompletedDate xsi:nil="true" />
                    <TotalEntityCount>0</TotalEntityCount>
                    <ProcessedEntityCount>0</ProcessedEntityCount>
                    <FailedEntityCount>0</FailedEntityCount>
                </DataflowJob>
            </Resources>
        </ResourceSet>
    </ResourceSets>
</Response>
Run Code Online (Sandbox Code Playgroud)

我正在使用Delphi XE. …

xml delphi geospatial bing-api

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

TFlowPanel.在运行时添加控件

有人知道如何在运行时向TFlowPanel添加控件(例如TImage)吗?

问候,彼得

delphi controls flowpanel

2
推荐指数
2
解决办法
4433
查看次数

动态调整窗体的大小以适应 Delphi 中框架的大小

我有一个具有 5 个不同大小框架的应用程序。当我从一个框架移动到另一个框架时,我想动态地重新调整主窗体的大小以适应框架。

我可以使用MinHeight/MinWidth框架的属性来强制主窗体适合框架,但是当移动到较小的框架时,主窗体不会调整它的大小。

有任何想法吗?

- 编辑

...
TFormMain = Class(TForm)
...
public
  FrameImportPackage: TFrameImportPackage;
...

procedure TFormMain.MenuPackagesImportClick(Sender: TObject);
begin
  if not (Assigned(FrameImportPackage)) then
    begin
      FrameImportPackage := TFrameImportPackage.Create(Self);
      FrameImportPackage.LabelFrameCaption.Caption := 'Import or Edit a Package';
    end
  else
    begin
      FrameImportPackage.BringToFront;
    end;

  FrameImportPackage.Parent := Self;
end;
Run Code Online (Sandbox Code Playgroud)

- 编辑

问候, 彼得

delphi resize dynamic frame

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