小编Sha*_*elt的帖子

为什么不能将地址转换为64位Delphi中的嵌套本地函数?

如.关闭相关问题 - 下面添加更多示例.

下面的简单代码(找到顶级Ie窗口并枚举其子代)与'32位Windows'目标平台一起正常工作.早期版本的Delphi也没有问题:

procedure TForm1.Button1Click(Sender: TObject);

  function EnumChildren(hwnd: HWND; lParam: LPARAM): BOOL; stdcall;
  const
    Server = 'Internet Explorer_Server';
  var
    ClassName: array[0..24] of Char;
  begin
    Assert(IsWindow(hwnd));            // <- Assertion fails with 64-bit
    GetClassName(hwnd, ClassName, Length(ClassName));
    Result := ClassName <> Server;
    if not Result then
      PUINT_PTR(lParam)^ := hwnd;
  end;

var
  Wnd, WndChild: HWND;
begin
  Wnd := FindWindow('IEFrame', nil); // top level IE
  if Wnd <> 0 then begin
    WndChild := 0;
    EnumChildWindows(Wnd, @EnumChildren, UINT_PTR(@WndChild));

    if WndChild <> 0 then
      ..    

end; …
Run Code Online (Sandbox Code Playgroud)

delphi delegates nested 32bit-64bit delphi-xe2

17
推荐指数
1
解决办法
1652
查看次数

如何更改TListview项目的背景颜色?

如何自定义列表视图以显示不同的背景颜色,如下图所示?

具有不同背景颜色的项目

我的listview绑定到数据源(Livebindng).我想使用颜色字段来设置我的背景颜色.

我这样定制了我的观点:

  • 3个文本项目(指定,日期和简历)
  • 1位图项目(Couleur)

文本项绑定到数据源,但无法将我的位图绑定到"颜色"字段.

在此输入图像描述

我已经填充了listview ActivesUpdateObjects事件,但这并不是因为当数据源记录更新时位图没有改变!

procedure TfrmMain.lvTachesActivesUpdateObjects(const Sender: TObject;
  const AItem: TListViewItem);
begin
  SetItemColor(AItem);

end;

procedure TfrmMain.SetItemColor(const AItem: TListViewItem; const UpdateColor:
    Boolean = False);
var
  LObject: TListItemImage;
  VC: TColor;
begin
  LObject        := AItem.Objects.FindObjectT<TListItemImage>('Couleur');
  VC:= dtmMain.qrTaches.FieldByName('couleur').AsInteger;
  if LObject.Bitmap = nil then
  begin

  LObject.Bitmap := FMX.Graphics.TBitmap.Create(10,240);
  LObject.Bitmap.Clear(VC);
  end else if UpdateColor then LObject.Bitmap.Clear(VC);

end;
Run Code Online (Sandbox Code Playgroud)

还有更好的方法吗?我也在寻找o使用样式但是看起来(或者我没有找到)itemlistview无法应用样式!

Ps:Firemonkey/Windows/Delphi Berlin XE10.1

delphi firemonkey

11
推荐指数
1
解决办法
1287
查看次数

使用Embarcadero代码解析使用TJSONObject的有效JSON示例失败,但有异常

以下是Embarcadero帮助的示例代码(http://docwiki.embarcadero.com/RADStudio/XE5/en/JSON):

您可以使用以下代码片段之一将JSON字符串表示形式转换为JSON.

使用ParseJSONValue:

procedure ConsumeJsonString;
var
  LJSONObject: TJSONObject;

begin

  LJSONObject := nil;
  try

    { convert String to JSON }
    LJSONObject := TJSONObject.ParseJSONValue(TEncoding.ASCII.GetBytes(GJSONString), 0) as TJSONObject;

    { output the JSON to console as String }
    Writeln(LJSONObject.ToString);
  finally
    LJSONObject.Free;
  end;
Run Code Online (Sandbox Code Playgroud)

该方法失败,并在as行上抛出类无效类型!

使用Parse:

procedure ConsumeJsonBytes;
var
  LJSONObject: TJSONObject;

begin
  LJSONObject := nil;
  try
    LJSONObject := TJsonObject.Create;
    { convert String to JSON }
    LJSONObject.Parse(BytesOf(GJSONString), 0);

    { output the JSON to console as String }
    Writeln(LJSONObject.ToString);
  finally
    LJSONObject.Free;
  end; …
Run Code Online (Sandbox Code Playgroud)

delphi parsing json

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

Delphi在应用程序运行时更改主窗体

我有这个问题.当我隐藏我的主窗体时,我的应用程序的任务栏图标也被隐藏.我也看到了一个关于这个问题的新问题,答案并没有真正帮助.他们建议尽量减少它,但我不想最小化应用程序.

应用程序运行时是否可以更改主窗体?

例如.我有两种形式.当我想隐藏一个表单并显示另一个表单时,任务栏图标应保留在任务栏上,主表单应切换到另一个表单.

我使用的是Delphi XE6,它是一个VCL Forms应用程序.

我还看到了一个关于在运行时更改主窗体的一个不同的老问题,但它很老,仍然基于Delphi 6.

forms delphi vcl taskbar delphi-xe6

10
推荐指数
3
解决办法
9629
查看次数

我在哪里可以找到每个组件的indy 10演示?

我在哪里可以找到Indy版本10和Delphi版本2010/XE/XE2的每个组件的演示.在官方页面上,他们只列出了7个演示,并附有"该列表将定期更新.请耐心等待,因为演示仍处于开发阶段." 此外,我无法在我安装Delphi 2010的计算机上安装任何演示程序.

我特别感兴趣的是这四个组件:Telnet服务器/客户端和IRC服务器/客户端,但问题是Indy的所有组件.

delphi indy indy10

5
推荐指数
1
解决办法
4671
查看次数

Delphi FMX 用鼠标调整无边框窗体大小

无论如何,在 Delphi FMX 中是否可以使用鼠标调整无边框窗体的大小?我尝试使用OnMouseDown然后OnMouseMove使用表单的位置与表单的左侧和顶部进行比较,但我无法使其工作。

由于某种原因,FMX 中的鼠标看起来与普通 VCL 应用程序中的鼠标非常不同。

delphi

5
推荐指数
1
解决办法
1306
查看次数

在Delphi中将枚举值转换为整数

是否可以在Delphi中将枚举值转换/转换为Integer?

如果是,那怎么样?

delphi pascal integer enumeration

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

在Delphi中将两个文本文件加载到一个TMemo组件中的最佳方法是什么?

假设我有两个文本文件(.txt),我有一个包含一个TMemo组件的表单.将两个文本文件快速加载到同一个Memo中的最佳方法是什么?

delphi

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

Firemonkey和Android 64位要求

从2019年8月1日开始:

发布到Google Play时,除32位版本外,所有包含本机代码的新应用程序和应用程序更新都必须提供64位版本。

如何在Firemonkey应用程序中设置应用程序以满足64位要求?

我正在使用Embarcadero RAD Studio 10.3。

delphi firemonkey rad-studio

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

如何在Delphi上定位Linux平台?

我想使用 Delphi 为 Linux 开发一个应用程序,但 Linux 不是我的目标平台选项:

带有项目和目标平台的 Delphi IDE

使用 Delphi 开始开发和编译 Linux 应用程序的步骤是什么?

我需要什么?

linux delphi firemonkey windows-subsystem-for-linux wsl-2

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