winrt

标签

Cards List
#winrt

我们能否使用 CoreApplication 的 Properties 来管理一个拒绝被封送的对象的生命周期?

The Old New Thing (Raymond Chen) ↗ · 3天前 缓存

Raymond Chen 探讨了 CoreApplication.Properties 是否能管理不可封送对象的生命周期,并得出结论:使用可封送的包装器更简单,而 Properties API 在此场景中并没有带来实际价值。

0 人收藏 0 人点赞
#winrt

当你把一个非敏捷对象放入 CoreApplication Properties 时会发生什么?

The Old New Thing (Raymond Chen) ↗ · 4天前 缓存

Microsoft Old New Thing 博客文章解释了存储在 CoreApplication.Properties 中的非敏捷对象如何通过 RoGetAgileReference 被包装——导致它们在其宿主 apartment 关闭时过期,从而在 Properties 中留下一个中毒条目:HasKey 仍然报告其存在,但 Lookup 会以 E_INVALIDARG 拒绝请求。

0 人收藏 0 人点赞
#winrt

为什么源应用程序关闭后,CoreApplication Properties 中的条目似乎就失效了?

The Old New Thing (Raymond Chen) ↗ · 5天前 缓存

The Old New Thing 解释了为什么 CoreApplication.Properties 中的条目在源单元关闭时似乎会失效:非敏捷 COM 对象会被包装在敏捷包装器中,虽然条目仍然存在,但一旦其所属单元退出,底层值就会变得不可用。

0 人收藏 0 人点赞
#winrt

为什么我们不使用 RoRegisterForApartmentShutdown 来清理不可编组的委托?

The Old New Thing (Raymond Chen) ↗ · 2026-10-21 缓存

Raymond Chen 解释了为什么 RoRegisterForApartmentShutdown 不适合用于清理假 agile 包装器中不可编组的委托,详细说明了 agile 对象要求、注销警告、套间亲和性以及 O(n) 查找性能等方面的限制。

0 人收藏 0 人点赞
#winrt

如何强制派生类实现特定非虚方法(第一部分)

The Old New Thing (Raymond Chen) ↗ · 2026-08-27 缓存

本文探讨了在C++中强制派生类实现特定非虚拟方法的技术,使用C++/WRL和C++/WinRT的示例,并批评了一个代码审查场景,其中仅使用注释而非适当强制。

0 人收藏 0 人点赞
#winrt

Creating a fake agile wrapper that is technically agile but is not useful outside its home apartment, part 5

The Old New Thing (Raymond Chen) ↗ · 2026-08-07 缓存

Raymond Chen explains how to use std::unique_ptr to manage a registration cookie in a fake agile wrapper, discussing integer-to-pointer round-tripping and the wil::unique_any alternative.

0 人收藏 0 人点赞
#winrt

Creating a fake agile wrapper that is technically agile but is not useful outside its home apartment, part 3

The Old New Thing (Raymond Chen) ↗ · 2026-08-05 缓存

Raymond Chen continues his series on creating a fake agile wrapper for non-marshalable COM objects by wrapping them in a marshalable object, enabling registration in the global interface table while preserving undefined-behavior-free failures in other apartments.

0 人收藏 0 人点赞
#winrt

在 C++/WinRT 中制作 Windows Runtime 委托的敏捷版本,第5部分

The Old New Thing (Raymond Chen) ↗ · 2026-07-24 缓存

本文继续系列文章,介绍如何在 C++/WinRT 中实现敏捷委托,解决在正确上下文中销毁非敏捷委托的问题,方法是使用自定义删除器和 IContextCallback。

0 人收藏 0 人点赞
#winrt

在多个协程之间共享单个Windows Runtime IAsyncOperation的结果,第3部分

The Old New Thing (Raymond Chen) ↗ · 2026-05-29 缓存

本文讨论了一个C++/WinRT模式,用于缓存Windows Runtime IAsyncOperation的结果,包括处理失败的情况,以便多个协程可以共享缓存的结果或异常。

0 人收藏 0 人点赞
← 返回首页

提交意见反馈