标签: delphi-10-seattle

如何在GetIt包管理器失败时重置下载?

当Delphi崩溃时,我试图通过GetIt下载OmniThread lib.
其他软件包下载,编译和安装都很好,所以我想这是一次性的.

现在GetIt拒绝安装OmniThread,因为它看到了部分下载,假设一切正常并开始编译.这打破了编译错误,GetIt不允许我重置状态并清理下载.

GetIt在哪里存储其下载内容以及如何清除它,以便GetIt将从头开始重新下载源代码?

delphi delphi-xe8 delphi-10-seattle

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

Windows 10中的内存泄漏Delphi Seattle中的TNotification?

我正在我的应用程序中实现Windows 10通知.但是,下面的代码(运行正常)显然会给出1个TNotification对象和2个字符串的备忘录泄漏,但我在块的末尾释放了对象:

aNotification := NotificationCenter.CreateNotification;

//-- If not assigned then must be Win 8.1 or below
if not assigned(aNotification) then
  exit;

try
  aNotification.Title := AlignMixVersionName + ' License';
  aNotification.AlertBody := aText;

  NotificationCenter.PresentNotification(aNotification);

finally
  aNotification.Free;
end;
Run Code Online (Sandbox Code Playgroud)

我做了一些愚蠢的事情,或者在通知的实施中是否存在内存泄漏?

  • 史蒂夫

delphi notifications windows-10 delphi-10-seattle

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

在嵌套方法中访问时,由闭包捕获破坏的局部变量

我已设法将此问题减少到此:

program Project1;
{$APPTYPE CONSOLE}

uses
  SysUtils, Threading;

procedure Foo(AString: string);
var
  LTask : ITask;
  capturedString : string;
  procedure Nested;
  begin
    try
      WriteLn('Nested : ' + capturedString); { ! EIntOverflow (Win32) here }
    except on E : Exception do
      WriteLn(E.Message);  
    end; 
  end;
begin
  capturedString := AString;
  WriteLn('Local : ' + capturedString);
  Nested;
  LTask := TTask.Create(
    procedure
      procedure AnonNested;
      begin
        WriteLn(capturedString); { Removing this eliminates the problem }
      end;
    begin
    end);
end;

begin
  Foo('foo');
  ReadLn;
end.
Run Code Online (Sandbox Code Playgroud)

capturedString从嵌套方法中访问变量时,变量会被破坏.一个Win32编译加薪EIntOverflow,一个Win64的编译写出一个(腐败)空字符串-无论是构建可以挑起到AV或其他异常的一些操作,但是在所有情况下,参照本地变量进入时被破坏Nested …

delphi closures anonymous-function delphi-10-seattle

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

如何在Delphi 10 Seattle IDE中停止创建.stat文件

当我在RAD Studio 10 SeattleIDE中打开并使用Delphi项目文件时.它总是创建.stat文件.有没有办法停止创建文件?

delphi delphi-10-seattle

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

JCL安装到Delphi 10 Seattle时出错

我正在尝试将JCL/JVCL安装到Delphi-10-Seattle中

我收到以下错误:

使用Embarcadero RAD Studio 10西雅图Embarcadero Delphi for Win32编译器版本30.0 ... E:\ Delphi-10\Jedi\jcl\source\common\JclSysUtils.pas(3034)错误:E2010不兼容类型:'TJclWaitResult'和'TWaitResult'

JclInstall.pas(2264)致命:F2063无法编译使用过的单位'JclSysUtils.pas'

'JclSysUtils.pas'中的第3034行是:

if (ProcessEvent.WaitForever = {$IFDEF RTL280_UP}TJclWaitResult.{$ENDIF RTL280_UP}wrSignaled) and not GetExitCodeProcess(ProcessEvent.Handle, Result) then Result := $FFFFFFFF;
Run Code Online (Sandbox Code Playgroud)

我试图在Jedi邮件列表中发帖,但多年来一直没有触及过.

我在哪里可以得到修复?

delphi jedi jedi-code-library delphi-10-seattle

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

无法查看和使用自定义VCL样式

我在中创建了一个新样式Bitmap Style Designer,将其保存在Styles文件夹中,但我无法在选项Appearances卡下的项目选项中看到它.怎么了?


在此输入图像描述


在此输入图像描述

delphi delphi-10-seattle

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

如何将匿名枚举类型传递给子例程?

我正在尝试将一个方便的函数转换System.Classes.TShiftState为用户可读的字符串.为了方便起见,我做了一个子程序来执行公共代码,使函数更紧凑.

问题是,我无法弄清楚如何将其中一个TShiftState枚举类型传递给此子例程.我想Byte,IntegerCardinal,但我不断收到Incompatible types: 'Byte' and 'Enumeration'(或任何类型的我尝试).将鼠标悬停在其中一个上只显示$1该类型通常所在的位置.

function ShiftStateStr(const Shift: TShiftState): String;
  procedure A(const Sh: Byte; const Str: String);
  begin
    if Sh in Shift then
      Result:= Result + StrLen(Str, Length(Str)+1)
    else
      Result:= Result + StrLen('', Length(Str)+1);
  end;
begin
  Result:= '';
  A(ssShift, 'Shift');
  A(ssAlt, 'Alt');
  A(ssCtrl, 'Ctrl');
  A(ssLeft, 'Left');
  A(ssRight, 'Right');
  A(ssMiddle, 'Middle');
  A(ssDouble, 'Double');
  A(ssTouch, 'Touch');
  A(ssPen, 'Pen');
  A(ssCommand, 'Cmd');
  A(System.Classes.ssHorizontal, 'Horz');
end;
Run Code Online (Sandbox Code Playgroud)

注意:StrLen是一个单独的函数,用一个给定长度的空格填充字符串.

TShiftState …

delphi enums subroutine delphi-10-seattle

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

检查活动目录中的用户身份验证

我想知道用户是否为其 Active Directory 用户输入了域、用户和密码的正确组合。

我试图制作一个无法连接的非常简单的程序,但通过阅读错误消息,我可以知道用户/密码是否正确。

这是基于技巧的(逻辑是读取异常消息),无论如何我在 2 个服务器上测试了这个原型,我注意到 excpetion 消息从服务器到服务器发生变化,所以这是不可靠的。

uses adshlp, ActiveDs_TLB;
// 3 TEdit and a TButton

procedure TForm4.Button1Click(Sender: TObject);
Var
 aUser : IAdsUser;
 pDomain, pUser, pPassword : string;
 myResult : HRESULT;
 Counter: integer;
begin
  pDomain := edtDomain.Text;
  pUser:= edtUser.Text;
  pPassword := edtPwd.Text;
  Counter := GetTickCount;


 Try
    myResult := ADsOpenObject(Format('LDAP://%s',[pDomain]),Format('%s\%s',[pDomain,pUser]),pPassword,
    ADS_READONLY_SERVER,
    IAdsUser,aUser);
 except
    On E : EOleException do
    begin
    if (GetTickCount - Counter > 3000) then  ShowMessage ('Problem with connection') else
    if Pos('password',E.Message) > 0  then ShowMessage ('wrong …
Run Code Online (Sandbox Code Playgroud)

delphi ldap delphi-10-seattle

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

从C ++到Delphi:FOR循环中具有指定声明的变量

从以下C ++代码开始的for循环中,Delphi中的等效项是什么ChildWindowFromPoint()

HWND  hWnd;
POINT point;

...

for (HWND currHwnd = hWnd;;)
{
    hWnd = currHwnd;
    ScreenToClient(currHwnd, &point);
    currHwnd = ChildWindowFromPoint(currHwnd, point);
    if (!currHwnd || currHwnd == hWnd)
        break;
}
Run Code Online (Sandbox Code Playgroud)

我的尝试是这样,但我不确定是否正确:

var
  hWndWindow, currHwnd: HWND;
  MousePoint: TPoint;

...

while True do
begin
  currHwnd := hWndWindow;
  hWndWindow := currHwnd;
  ScreenToClient(currHwnd, MousePoint);
  currHwnd := ChildWindowFromPoint(currHwnd, MousePoint);

  if (currHwnd = 0) or (currHwnd = hWndWindow) then
    Break;
end;
Run Code Online (Sandbox Code Playgroud)

delphi delphi-10-seattle

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

Delphi剪贴板:读取已复制文件的文件属性

我想检索复制到剪贴板的文件的文件大小。

我阅读了TClipboard文档,但没有找到解决方案。

我认为这TClipboard.GetAsHandle可能会有所帮助,但是我无法完成任务。

谢谢。

delphi clipboard filesize delphi-10-seattle

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