Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/delphi/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Delphi 最新windows更新(windows 8.1和windows 10)后,应用程序不会重新聚焦_Delphi - Fatal编程技术网

Delphi 最新windows更新(windows 8.1和windows 10)后,应用程序不会重新聚焦

Delphi 最新windows更新(windows 8.1和windows 10)后,应用程序不会重新聚焦,delphi,Delphi,我注意到在一些Windows更新之后,我在Delphi7中开发的应用程序不再正确聚焦。标题栏不会更改颜色。按钮、滚动条等UI元素不起作用。我也不能用标题栏按钮最小化或关闭表单 奇怪的是,我仍然可以通过拖动标题栏来移动表单,程序总体上运行良好 下面是一个动画,显示正在发生的事情: 以下是我测试过的Windows版本列表: Windows 7 SP1 + updates -> OK! Windows 8.1 without updates -> OK! Windows 8.1 with

我注意到在一些Windows更新之后,我在Delphi7中开发的应用程序不再正确聚焦。标题栏不会更改颜色。按钮、滚动条等UI元素不起作用。我也不能用标题栏按钮最小化或关闭表单

奇怪的是,我仍然可以通过拖动标题栏来移动表单,程序总体上运行良好

下面是一个动画,显示正在发生的事情:

以下是我测试过的Windows版本列表:

Windows 7 SP1 + updates -> OK!
Windows 8.1 without updates -> OK!
Windows 8.1 with all updates -> NO FOCUS! 
Windows 10 BUILD 10240 -> OK!
Windows 10 BUILD 10586 -> OK!
Windows 10 BUILD 14393 -> NO FOCUS!
我尝试使用以下代码禁用窗口重影:

var 
  User32: HMODULE; 
  DisableProcessWindowsGhosting: TProcedure; 
begin 
  User32 := GetModuleHandle('USER32'); 
  if User32 <> 0 then 
  begin 
    DisableProcessWindowsGhosting := GetProcAddress(User32,  'DisableProcessWindowsGhosting'); 
    if Assigned(DisableProcessWindowsGhosting) then 
      DisableProcessWindowsGhosting; 
  end; 
end;
var
User32:HMODULE;
DisableProcessWindows重影:t过程;
开始
User32:=GetModuleHandle('User32');
如果用户32 0那么
开始
DisableProcessWindowsGhosting:=GetProcAddress(User32,'DisableProcessWindowsGhosting');
如果已分配(禁用进程窗口重影),则
禁用窗口重影;
结束;
结束;

另外,我删除了所有
应用程序.ProcessMessages()
调用,但仍然没有任何更改。

结果表明,这种奇怪的行为是由TForm1.Activate中的代码引起的。 看起来在那个部分放太多复杂的代码不是个好主意。
我已经将整个代码移到了TForm1.JvTimer1Timer,现在问题解决了。

这段代码是关于什么的。看起来你的程序坏了,你的解决方案是把脑袋埋在沙子里。所有线程只能通过同步访问UI元素。我非常清楚,直接从线程访问UI只是一种灾难的预兆。Microsoft必须通过一些更新来更改发生此问题的内容。多年来一直运行良好,现在砰!为什么需要禁用重影。你犯下了什么暴行。因为我发现了这个主题,我只是好奇这个案例的解决方案是否有帮助。也许你的代码中有缺陷