每个 windows 都带有 user32.dll 吗?

Does every windows comes with user32.dll?

我有包含代码的 C# 应用程序。

[DllImport("user32.dll")]  
static extern IntPtr GetForegroundWindow();

获取当前 window 标题。现在我必须部署应用程序,我想知道每种类型的 windows(64 位和 32 位以及 XP、7、vista、8、10)都带有 user32.dll 还是我必须让用户先下载那个?

和kernel32.dll一样是核心dll。它包含 windows 用户可以调用的所有必需的 API。所以是的,它存在于任何 windows 版本

您可以确定 user32.dll 将始终存在,因为它是 Windows API 的一部分。

我可以想象一个微软推出 win 11/12/etc 的世界。他们对不得不跟上他们旧的 API 感到非常沮丧,以至于他们扔掉了 user32.dll window(s).

与任何 API 中断一样 - 在它出现时对其进行处理。如果您为每一个可能发生的情况做好计划 - 您将不得不等待它结束并且永远不会发布任何软件。

是的,每个 window、

默认都有

USER32.DLL implements the Windows USER component that creates and manipulates the standard elements of the Windows user interface, such as the desktop, windows, and menus. It thus enables programs to implement a graphical user interface (GUI) that matches the Windows look and feel. Programs call functions from Windows USER to perform operations such as creating and managing windows, receiving window messages (which are mostly user input such as mouse and keyboard events, but also notifications from the operating system), displaying text in a window, and displaying message boxes.

Many of the functions in USER32.DLL call upon GDI functions exported by GDI32.DLL to do the actual rendering of the various elements of the user interface. Some types of programs will also call GDI functions directly to perform lower-level drawing operations within a window previously created via USER32 functions.

来源Wiki User32.dll