[C#/COMMON] 윈도우즈 화면 잠금 여부 구하기
■ 윈도우즈 화면 잠금 여부를 구하는 방법을 보여준다. ▶ WTS_CONNECTSTATE_CLASS.cs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
namespace TestProject { /// <summary> /// WTS 연결 상태 클래스 /// </summary> public enum WTS_CONNECTSTATE_CLASS { /// <summary> /// WTSActive /// </summary> WTSActive, /// <summary> /// WTSConnected /// </summary> WTSConnected, /// <summary> /// WTSConnectQuery /// </summary> WTSConnectQuery, /// <summary> /// WTSShadow /// </summary> WTSShadow, /// <summary> /// WTSDisconnected /// </summary> WTSDisconnected, /// <summary> /// WTSIdle /// </summary> WTSIdle, /// <summary> /// WTSListen /// </summary> WTSListen, /// <summary> /// WTSReset /// </summary> WTSReset, /// <summary> /// WTSDown /// </summary> WTSDown, /// <summary> /// WTSInit /// </summary> WTSInit } } |
▶ WTS_INFO_CLASS.cs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
namespace TestProject { /// <summary> /// WTS 정보 클래스 /// </summary> public enum WTS_INFO_CLASS { /// <summary> /// WTSInitialProgram /// </summary> WTSInitialProgram, /// <summary> /// WTSApplicationName /// </summary> WTSApplicationName, /// <summary> /// WTSWorkingDirectory /// </summary> WTSWorkingDirectory, /// <summary> /// WTSOEMID /// </summary> WTSOEMID, /// <summary> /// WTSSessionID /// </summary> WTSSessionID, /// <summary> /// WTSUserName /// </summary> WTSUserName, /// <summary> /// WTSWinStationName /// </summary> WTSWinStationName, /// <summary> /// WTSDomainName /// </summary> WTSDomainName, /// <summary> /// WTSConnectState /// </summary> WTSConnectState, /// <summary> /// WTSClientBuildNumber /// </summary> WTSClientBuildNumber, /// <summary> /// WTSClientName /// </summary> WTSClientName, /// <summary> /// WTSClientDirectory /// </summary> WTSClientDirectory, /// <summary> /// WTSClientProductID /// </summary> WTSClientProductID, /// <summary> /// WTSClientHardwareID /// </summary> WTSClientHardwareID, /// <summary> /// WTSClientAddress /// </summary> WTSClientAddress, /// <summary> /// WTSClientDisplay /// </summary> WTSClientDisplay, /// <summary> /// WTSClientProtocolType /// </summary> WTSClientProtocolType, /// <summary> /// WTSIdleTime /// </summary> WTSIdleTime, /// <summary> /// WTSLogonTime /// </summary> WTSLogonTime, /// <summary> /// WTSIncomingBytes /// </summary> WTSIncomingBytes, /// <summary> /// WTSOutgoingBytes /// </summary> WTSOutgoingBytes, /// <summary> /// WTSIncomingFrames /// </summary> WTSIncomingFrames, /// <summary> /// WTSOutgoingFrames /// </summary> WTSOutgoingFrames, /// <summary> /// WTSClientInfo /// </summary> WTSClientInfo, /// <summary> /// WTSSessionInfo /// </summary> WTSSessionInfo, /// <summary> /// WTSSessionInfoEx /// </summary> WTSSessionInfoEx, /// <summary> /// WTSConfigInfo /// </summary> WTSConfigInfo, /// <summary> /// WTSValidationInfo /// </summary> WTSValidationInfo, /// <summary> /// WTSSessionAddressV4 /// </summary> WTSSessionAddressV4, /// <summary> /// WTSIsRemoteSession /// </summary> WTSIsRemoteSession } } |
▶ LockStatus.cs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
namespace TestProject { /// <summary> /// 잠금 상태 /// </summary> public enum LockStatus { /// <summary> /// 잠금 /// </summary> Locked, /// <summary> /// 잠금 해제 /// </summary> NotLocked, /// <summary> /// 알 수 없음 /// </summary> Unknown } } |
▶ LARGE_INTEGER.cs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
using System.Runtime.InteropServices; namespace TestProject { /// <summary> /// 배정도 정수 /// </summary> [StructLayout(LayoutKind.Explicit)] public struct LARGE_INTEGER { //////////////////////////////////////////////////////////////////////////////////////////////////// Field ////////////////////////////////////////////////////////////////////////////////////////// Public #region Field /// <summary> /// 하위 파트 /// </summary> [FieldOffset(0)] public uint LowPart; /// <summary> /// 상위 파트 /// </summary> [FieldOffset(4)] public int HighPart; /// <summary> /// 쿼드 파트 /// </summary> [FieldOffset(0)] public long QuadPart; #endregion } } |
▶ WTSINFOEX_LEVEL1_W.cs