代码之家  ›  专栏  ›  技术社区  ›  Ron Klein Noa Kuperberg

用C语言编程锁定Windows工作站#

  •  16
  • Ron Klein Noa Kuperberg  · 技术社区  · 16 年前

    我遇到了锁定Windows工作站的示例:

    using System.Runtime.InteropServices;
    ...
    [DllImport("user32.dll", SetLastError = true)]
    static extern bool LockWorkStation();
    
    ...
    if (!LockWorkStation())
        throw new Win32Exception(Marshal.GetLastWin32Error()); // or any other thing
    

    是否有一个纯托管的替代方案来替代此代码段?也就是说,没有P-Invoke。

    1 回复  |  直到 12 年前
        1
  •  20
  •   InteXX    8 年前

    不,没有。这是实现这一行动的最佳方式。

    推荐文章