当Delphi崩溃时,我试图通过GetIt下载OmniThread lib.
其他软件包下载,编译和安装都很好,所以我想这是一次性的.
现在GetIt拒绝安装OmniThread,因为它看到了部分下载,假设一切正常并开始编译.这打破了编译错误,GetIt不允许我重置状态并清理下载.
GetIt在哪里存储其下载内容以及如何清除它,以便GetIt将从头开始重新下载源代码?
我正在我的应用程序中实现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)
我做了一些愚蠢的事情,或者在通知的实施中是否存在内存泄漏?
我已设法将此问题减少到此:
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 …
当我在RAD Studio 10 SeattleIDE中打开并使用Delphi项目文件时.它总是创建.stat文件.有没有办法停止创建文件?
我正在尝试将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邮件列表中发帖,但多年来一直没有触及过.
我在哪里可以得到修复?
我正在尝试将一个方便的函数转换System.Classes.TShiftState为用户可读的字符串.为了方便起见,我做了一个子程序来执行公共代码,使函数更紧凑.
问题是,我无法弄清楚如何将其中一个TShiftState枚举类型传递给此子例程.我想Byte,Integer和Cardinal,但我不断收到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 …
我想知道用户是否为其 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) 从以下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 ×10
clipboard ×1
closures ×1
delphi-xe8 ×1
enums ×1
filesize ×1
jedi ×1
ldap ×1
subroutine ×1
windows-10 ×1