如.关闭相关问题 - 下面添加更多示例.
下面的简单代码(找到顶级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) 如何自定义列表视图以显示不同的背景颜色,如下图所示?
我的listview绑定到数据源(Livebindng).我想使用颜色字段来设置我的背景颜色.
我这样定制了我的观点:
文本项绑定到数据源,但无法将我的位图绑定到"颜色"字段.
我已经填充了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
以下是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 XE6,它是一个VCL Forms应用程序.
我还看到了一个关于在运行时更改主窗体的一个不同的老问题,但它很老,仍然基于Delphi 6.
我在哪里可以找到Indy版本10和Delphi版本2010/XE/XE2的每个组件的演示.在官方页面上,他们只列出了7个演示,并附有"该列表将定期更新.请耐心等待,因为演示仍处于开发阶段." 此外,我无法在我安装Delphi 2010的计算机上安装任何演示程序.
我特别感兴趣的是这四个组件:Telnet服务器/客户端和IRC服务器/客户端,但问题是Indy的所有组件.
无论如何,在 Delphi FMX 中是否可以使用鼠标调整无边框窗体的大小?我尝试使用OnMouseDown
然后OnMouseMove
使用表单的位置与表单的左侧和顶部进行比较,但我无法使其工作。
由于某种原因,FMX 中的鼠标看起来与普通 VCL 应用程序中的鼠标非常不同。
是否可以在Delphi中将枚举值转换/转换为Integer?
如果是,那怎么样?
假设我有两个文本文件(.txt),我有一个包含一个TMemo组件的表单.将两个文本文件快速加载到同一个Memo中的最佳方法是什么?
从2019年8月1日开始:
发布到Google Play时,除32位版本外,所有包含本机代码的新应用程序和应用程序更新都必须提供64位版本。
如何在Firemonkey应用程序中设置应用程序以满足64位要求?
我正在使用Embarcadero RAD Studio 10.3。
delphi ×10
firemonkey ×3
32bit-64bit ×1
delegates ×1
delphi-xe2 ×1
delphi-xe6 ×1
enumeration ×1
forms ×1
indy ×1
indy10 ×1
integer ×1
json ×1
linux ×1
nested ×1
parsing ×1
pascal ×1
rad-studio ×1
taskbar ×1
vcl ×1
windows-subsystem-for-linux ×1
wsl-2 ×1