我已经设置了位于以下位置的 PAserver:C:\Program Files (x86)\Embarcadero\Studio\19.0\PAServer\LinuxPAServer19.0.tar.gz
在我的 Ubuntu Gnome 16.10 虚拟机上。
请注意,我以前从未使用过 pa 服务器,这是我第一次使用它
之后我继续在 Rad Studio 10.2 上进行配置文件,测试连接成功。
编译后我收到此错误:
[DCC Error] E2597 C:\Program Files (x86)\Embarcadero\Studio\19.0\bin\ld-linux.exe: error: cannot find -lgcc_s
C:\Program Files (x86)\Embarcadero\Studio\19.0\bin\ld-linux.exe: error: cannot find -lc
C:\Program Files (x86)\Embarcadero\Studio\19.0\bin\ld-linux.exe: error: cannot find -ldl
C:\Program Files (x86)\Embarcadero\Studio\19.0\bin\ld-linux.exe: error: cannot find -lpthread
C:\Program Files (x86)\Embarcadero\Studio\19.0\bin\ld-linux.exe: error: cannot find -lm
c:\program files (x86)\embarcadero\studio\19.0\lib\Linux64\debug\SysInit.o:SysInit:function Sysinit::__malloc(NativeUInt): error: undefined reference to 'malloc'
c:\program files (x86)\embarcadero\studio\19.0\lib\Linux64\debug\SysInit.o:SysInit:function Sysinit::__free(void*): error: undefined reference to 'free'
c:\program files (x86)\embarcadero\studio\19.0\lib\Linux64\debug\SysInit.o:SysInit:function Sysinit::pthread_once(int&, void …Run Code Online (Sandbox Code Playgroud) 我有一个异常记录器,可以将所有异常记录到日志文件中:
class function TLogger.LogException (ACaller: String; E: Exception): Boolean;
var
LogFilename, tmp: string;
LogFile: TextFile;
appsettings: TApplicationSettings;
begin
// prepare log file
appsettings:=TApplicationSettings.Create;
try
tmp:=appsettings.ErrorLogsLocation;
finally
FreeAndNil(appsettings);
end;
if NOT (DirectoryExists(tmp)) then
CreateDir(tmp);
//We create a new log file for every day to help with file size issues
LogFilename:=IncludeTrailingPathDelimiter (tmp) + 'LJErrors_' + FormatDateTime('yyyy-mm-dd', Now) +'.log';
try
AssignFile (LogFile, LogFilename);
if FileExists (LogFilename) then
Append (LogFile) // open existing file
else
Rewrite (LogFile); // create a new one
// write …Run Code Online (Sandbox Code Playgroud) 这与具有子窗体的Delphi应用程序有关,该子窗体已显示然后隐藏但未释放。如果用户将鼠标悬停在应用程序的(Windows 10)任务栏“迷你视图”上,则隐藏的窗体将变得可见(在悬停期间)。当用户单击迷你视图以将焦点更改为时,它们将隐藏。应用程序。有什么办法可以避免这种情况?
重新创建:
请注意,最小化应用程序并还原它可以“修复”影响,直到下次显示表单为止。也许这是导致问题的线索或解决方法的线索?这并不是一个大问题,因为它似乎并没有引起任何实际问题,但是看起来确实不专业。
根据要求添加代码(但是,这不会很有趣。)
program Project1;
uses
Vcl.Forms,
Unit1 in 'Unit1.pas' {Form1},
Unit2 in 'Unit2.pas' {Form2};
{$R *.res}
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TForm1, Form1);
Application.CreateForm(TForm2, Form2);
Application.Run;
end.
// Only code that was added to TForm1:
procedure TForm1.Button1Click(Sender: TObject);
begin
// Show and then hide the form or use ShowModal and close it before testing the hover.
Form2.Show;
Form2.Hide;
// Form2.ShowModal;
end;
Run Code Online (Sandbox Code Playgroud)
更新:如何仅使用Delphi IDE显示问题。
使用RAD Studio(Delphi)v10.2.1(东京版本1)在Windows 10"Creators Update"64bit上进行开发,但是32位开发.
该应用程序是具有多个后台线程的VCL,每个线程使用Indy TidHTTP来获取网络资源.主线程和后台线程之间的同步使用消息队列(PostThreadMessage调用)实现.这很复杂,在这里提供直接代码将是困难和混乱的,所以我开始用口头描述.
应该发生什么:打开一个带有外部资源链接的文件,这会生成HTTP请求并将它们移交给后台处理,然后等待应用程序消息队列上的传入消息,说明资源已被下载.应用程序消息在分配给TApplication.OnMessage的事件代码中匹配(我怀疑,这是我的问题所在).
有用.一切都顺利进行.但是如果我打开一个TSaveDialog - 即使我取消了对话而不是实际做任何事情 - 那么应用程序消息队列中的消息就会丢失.
通过编写日志消息的过程(不可能直接调试,因为这会扰乱导致问题所需的时间)我已经知道后台线程确实发布消息(并从PostThreadMessage获得肯定的响应),但是他们永远不会出现在我的TApplication.OnMessage事件代码中.
我已经看到各种库中的一些偷偷摸摸的代码将建立自己的PeekMessage/TranslateMessage/DispatchMessage循环,但并非所有人都记得检查是否存在TApplication.OnMessage事件.但我刚刚搜索了VCL代码和我正在使用的十几个第三方库,并且没有发现任何这种情况会在这种情况下受到影响(据我所知).
注意:我使用的是madExcept,Indy,FastReport,AddictSpell,SynEdit,VclStyleUtils(在其他一些不太知名的库中)
注2:我想知道它是否与Delphi 10.2.1或Windows 10 Creator的更新有关,因为我也看到了一些其他奇怪的行为(第一个例外的长延迟或第一个TOpenDialog - 但仅限于某些应用程序)绝对不会发生10.1(我没有使用10.2.0).......但这可能(可能是)有所不同.
所以我的问题是:我能做些什么呢?
有关如何查找/验证是否有其他代码窃取应用程序消息的任何建议?我还应该搜索除PeekMessage之外的其他东西吗?
是否有其他方法可以拦截可能让我避免此问题的应用程序消息队列消息?
如果没有更好的选项显示自己,我可能不得不放弃使用应用程序线程消息并实现我自己的消息/同步系统,在其他时间让其他人工作得非常好之后我宁愿不做.
我正在致力于将一组悖论表移植到 SQLite。为此,我创建了一个测试应用程序(在某种程度上)模拟当前的使用场景:多个用户访问同一数据库文件并同时执行读写操作。
该应用程序非常简单:它将启动多个线程,每个线程创建一个连接,打开一个表,然后随机读取、更新或插入表内。
应用程序几乎立即遇到“数据库表已锁定”错误。我尝试了几种方法来解决这个问题,但似乎没有任何效果。我究竟做错了什么 ?
这是线程内部的代码:
procedure testDB(TargetFolder: string);
var
Conn: TFDConnection;
Table: TFDTable;
i: Integer;
begin
randomize;
Conn := TFDConnection.Create(nil);
try
Conn.DriverName := 'SQLite';
Conn.LoginPrompt := false;
Conn.Params.clear;
Conn.Params.Database := TPath.Combine(TargetFolder, 'testDB.sdb');
Conn.Params.Add('DriverID=SQLite');
// all this is the result of several attemp to fix the table locking error. none worked
Conn.Params.Add('LockingMode=Normal');
Conn.Params.Add('Synchronous=Normal');
Conn.UpdateOptions.UpdateMode := TUpdateMode.upWhereAll;
Conn.UpdateOptions.LockWait := True;
Conn.UpdateOptions.LockMode := TFDLockMode.lmPessimistic;
Conn.UpdateOptions.LockPoint := TFDLockPoint.lpImmediate;
Conn.UpdateOptions.AssignedValues := [uvLockMode,uvLockPoint,uvLockWait];
Conn.Open();
Conn.ExecSQL('CREATE TABLE IF NOT EXISTS ''test'' (''ID'' INTEGER NOT NULL PRIMARY …Run Code Online (Sandbox Code Playgroud) 看起来如果没有 Delphi Tokyo 修复,可能就没有用户解决方案,但这似乎值得一问。
使该 AV 可复制的最简单方法。
我的Dpr文件看起来像这样(主单元中没有代码)。
program MaskedCrash2;
{$SETPEOPTFLAGS $160} //High Entropy ASLR Flag causes issues with incorrect 64-bit programs.
uses
Vcl.Forms,
MaskedCrashed2MainUnt in 'MaskedCrashed2MainUnt.pas' {Form3},
Vcl.Themes,
Vcl.Styles;
{$R *.res}
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
TStyleManager.TrySetStyle('Amakrits');
Application.CreateForm(TForm3, Form3);
Application.Run;
end.
Run Code Online (Sandbox Code Playgroud)
该 AV 出现在 Delphi Tokyo 的 StyleUtils.inc 中procedure TseBitmapLink.CheckingMasked(const Margin: TRect);
。
尽管我最近在 StyleUtils.inc 的顶部发现了警告:
//TODO -oUnassigned -cImplement : x64 : Implement …Run Code Online (Sandbox Code Playgroud) 为了在我的应用程序中正确处理 DPI 更改,我使用以下代码读取当前的缩放因子:
TYPE TZoom = BYTE;
FUNCTION OldStyleGetDpiForSystem : TZoom; cdecl;
VAR
DC : HDC;
X,Y,Z : LongWord;
BEGIN
DC:=GetDC(0);
TRY
X:=GetDeviceCaps(DC,LOGPIXELSX);
Y:=GetDeviceCaps(DC,LOGPIXELSY)
FINALLY
ReleaseDC(0,DC)
END;
IF X>Y THEN Result:=X ELSE Result:=Y
END;
FUNCTION GetDpiForSystem : TZoom;
TYPE
GetDpiForSystemFunc = FUNCTION : TZoom; cdecl;
CONST
GetDpiForSystem : GetDpiForSystemFunc = NIL;
BEGIN
IF NOT Assigned(GetDpiForSystem) THEN BEGIN
// Try to use official method (available from Windows 10, version 1607 [desktop apps only] and on)
GetDpiForSystem:=GetProcAddress(LoadLibrary('USER32.DLL'),'GetDpiForSystem');
// If not found, then …Run Code Online (Sandbox Code Playgroud) 我有自定义样式的 FireMonkey 控件。其样式包含多层嵌套控件。
我需要访问这些控件并在运行时更改一些样式属性。为此,我正在使用FindStyleResource<T>方法。
我在检索样式内的第一级控件时没有问题。FindStyleResource但是,如果控件父级是 的后代,则访问第二级控件将失败TStyledControl。
问题是如何访问这些嵌套样式控件,无论其父类型如何?
风格:
object TStyleContainer
object TLayout
StyleName = 'MyHeader'
Align = Center
Size.Width = 100.000000000000000000
Size.Height = 50.000000000000000000
Size.PlatformDefault = False
Visible = False
TabOrder = 0
object TLabel
StyleName = 'title'
Align = Client
StyledSettings = [Style]
Size.Width = 36.000000000000000000
Size.Height = 50.000000000000000000
Size.PlatformDefault = False
TextSettings.HorzAlign = Center
Text = 'Title'
end
object TLayout
StyleName = 'green'
Align = MostLeft
Size.Width = 32.000000000000000000
Size.Height = 50.000000000000000000 …Run Code Online (Sandbox Code Playgroud) 我有以下变量声明:
arrChar_1: array[0..2] of Char;
arrChar_2: array[0..2] of Char;
str: string;
Run Code Online (Sandbox Code Playgroud)
然后我做了作业:
str := arrChar_1 + arrChar_2;
Run Code Online (Sandbox Code Playgroud)
这个赋值在Delphi 6上正常工作.但是当我在Delphi 10.2上编译它时会发生错误:
[dcc32 Error] MigrateConcatenateCharArray.dpr(26): E2008 Incompatible types
Run Code Online (Sandbox Code Playgroud)
我正在通过以下方式解决这个问题:
str := Copy(first_arrChar, 0, StrLen(first_arrChar));
str := str + Copy(second_arrChar, 0, StrLen(second_arrChar));
Run Code Online (Sandbox Code Playgroud)
这个问题有没有其他好的解决方案?(1)
在Delphi 6中:
String = AnsiString
Char = AnsiChar
Run Code Online (Sandbox Code Playgroud)
在Delphi 10.2中:
String = UnicodeString
Char = WideChar
Run Code Online (Sandbox Code Playgroud)
可以告诉我是什么原因造成了不兼容问题?(2)
我理解widechar是一个多字节字符类型.Unicode是字符编码的方式.但我对他们感到困惑.
我正在使用 Delphi 10.2 Tokyo,试图从 Web 服务器下载一些信息。
我https://poloniex.com/public?command=returnCurrencies使用 Indy 10.6.2.5366 通过此函数传递命令 URL (如果我将其粘贴到浏览器中,则该命令有效):
function ReadHTTPS(const url: string): string;
var
IdHTTP: TIdHTTP;
IdSSL: TIdSSLIOHandlerSocketOpenSSL;
begin
IdHTTP := TIdHTTP.Create;
try
IdSSL := TIdSSLIOHandlerSocketOpenSSL.Create(IdHTTP);
IdHTTP.IOHandler := IdSSL;
result := IdHTTP.Get(url);
if IdHTTP.ResponseText <> '' then
OutputDebugString(PWideChar('ReadHTTPS: ' + IdHTTP.ResponseText));
finally
IdHTTP.Free;
end;
end{ ReadHTTPS};
Run Code Online (Sandbox Code Playgroud)
这给出了以下错误:
使用 SSL 连接时出错。错误:1409442E:SSL 例程:ssl3_read_bytes:tlsv1 警报协议版本
我曾尝试在与 exe 相同的目录中为 OpenSSL 安装最新的 DLL,但这并没有解决它。
有任何想法吗?