第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

以編程方式確定鎖定工作站的持續(xù)時(shí)間?

以編程方式確定鎖定工作站的持續(xù)時(shí)間?

縹緲止盈 2019-08-16 14:40:30
以編程方式確定鎖定工作站的持續(xù)時(shí)間?如何在代碼中確定機(jī)器鎖定的時(shí)間?C#之外的其他想法也是受歡迎的。我喜歡Windows服務(wù)理念(并已接受它)以簡(jiǎn)化和清潔,但遺憾的是我不認(rèn)為它在這種特殊情況下對(duì)我有用。我想在我的工作站上運(yùn)行這個(gè),而不是在家里(或者除了家庭之外,我想),但它被國(guó)防部嚴(yán)格控制了。實(shí)際上,這就是我自己滾動(dòng)的部分原因。無(wú)論如何我會(huì)寫(xiě)下來(lái)看看它是否有效。感謝大家!
查看完整描述

3 回答

?
湖上湖

TA貢獻(xiàn)2003條經(jīng)驗(yàn) 獲得超2個(gè)贊

我之前沒(méi)有找到過(guò)這個(gè),但是從任何應(yīng)用程序都可以連接SessionSwitchEventHandler。顯然你的應(yīng)用程序需要運(yùn)行,但只要它是:

Microsoft.Win32.SystemEvents.SessionSwitch += new Microsoft.Win32.SessionSwitchEventHandler(SystemEvents_SessionSwitch);void SystemEvents_SessionSwitch(object sender, Microsoft.Win32.SessionSwitchEventArgs e){
    if (e.Reason == SessionSwitchReason.SessionLock)
    { 
        //I left my desk
    }
    else if (e.Reason == SessionSwitchReason.SessionUnlock)
    { 
        //I returned to my desk
    }}


查看完整回答
反對(duì) 回復(fù) 2019-08-16
?
阿波羅的戰(zhàn)車(chē)

TA貢獻(xiàn)1862條經(jīng)驗(yàn) 獲得超6個(gè)贊

我將創(chuàng)建一個(gè)處理OnSessionChange事件的Windows服務(wù)(visual studio 2005項(xiàng)目類(lèi)型),如下所示:

protected override void OnSessionChange(SessionChangeDescription changeDescription){
    if (changeDescription.Reason == SessionChangeReason.SessionLock)
    { 
        //I left my desk
    }
    else if (changeDescription.Reason == SessionChangeReason.SessionUnlock)
    { 
        //I returned to my desk
    }}

您在此時(shí)記錄活動(dòng)的內(nèi)容和方式取決于您,但Windows服務(wù)可以快速方便地訪問(wèn)Windows事件,如啟動(dòng),關(guān)閉,登錄/退出以及鎖定和解鎖事件。


查看完整回答
反對(duì) 回復(fù) 2019-08-16
?
HUH函數(shù)

TA貢獻(xiàn)1836條經(jīng)驗(yàn) 獲得超4個(gè)贊

下面的解決方案使用Win32 API。在工作站被鎖定時(shí)調(diào)用OnSessionLock,并在解鎖時(shí)調(diào)用OnSessionUnlock。

[DllImport("wtsapi32.dll")]private static extern bool WTSRegisterSessionNotification(IntPtr hWnd,int dwFlags);[DllImport("wtsapi32.dll")]private static extern bool WTSUnRegisterSessionNotification(IntPtrhWnd);private const int NotifyForThisSession = 0; // This session onlyprivate const int SessionChangeMessage = 0x02B1;private const int SessionLockParam = 0x7;private const int SessionUnlockParam = 0x8;protected override void WndProc(ref Message m){
    // check for session change notifications
    if (m.Msg == SessionChangeMessage)
    {
        if (m.WParam.ToInt32() == SessionLockParam)
            OnSessionLock(); // Do something when locked
        else if (m.WParam.ToInt32() == SessionUnlockParam)
            OnSessionUnlock(); // Do something when unlocked
    }

    base.WndProc(ref m);
    return;}void OnSessionLock() {
    Debug.WriteLine("Locked...");}void OnSessionUnlock() {
    Debug.WriteLine("Unlocked...");}private void Form1Load(object sender, EventArgs e){
    WTSRegisterSessionNotification(this.Handle, NotifyForThisSession);}
    // and then when we are done, we should unregister for the notification
    //  WTSUnRegisterSessionNotification(this.Handle);


查看完整回答
反對(duì) 回復(fù) 2019-08-16
  • 3 回答
  • 0 關(guān)注
  • 797 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)