17

NotifyIcon を常に右側のトレイに表示するように設定する方法: http://screensnapr.com/v/qKWHe2.png

非アクティブなアイコンウィンドウに移動するため: http://screensnapr.com/v/jjtuK0.png

問題は、トレイ アイコンに、誰かがスクリーン ショットを撮るためのコンテキスト メニューがあることです。そのため、スクリーンショットを撮るたびに、その非アクティブなアイコン ウィンドウが写真に写り込み、その背後にあるものを写真爆撃機のようにブロックします。

comodo などの他のアプリケーションでは、アイコンをそこにドラッグ アンド ドロップしなくても実行できるため、コードを使用して実行できることはわかっています。ショートカットをタスクバーにピン留めするために、このフォルダーにショートカットを設定していることを知りました。

C:\Users\Username\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar

トレイに似たようなものはありますか?または、コードに関して使用できるオプションはありますか。

4

5 に答える 5

8

私はオンラインで検索していて、実際にこれをランダムに見つけました。

簡単に言えば、PowerShell (提供されるスクリプト) と GPO の組み合わせです。

http://4sysops.com/archives/forcing-notification-area-icons-to-always-show-in-windows-7-or-windows-8/

長い話ですが、以下を含む PowerShell スクリプトを作成します。

param(
    [Parameter(Mandatory=$true,HelpMessage='The name of the program')][string]$ProgramName,
    [Parameter(Mandatory=$true,HelpMessage='The setting (2 = show icon and notifications 1 = hide icon and notifications, 0 = only show notifications')]
        [ValidateScript({if ($_ -lt 0 -or $_ -gt 2) { throw 'Invalid setting' } return $true})]
        [Int16]$Setting
    )

$encText = New-Object System.Text.UTF8Encoding
[byte[]] $bytRegKey = @()
$strRegKey = ""
$bytRegKey = $(Get-ItemProperty $(Get-Item 'HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\TrayNotify').PSPath).IconStreams
for($x=0; $x -le $bytRegKey.Count; $x++)
{
    $tempString = [Convert]::ToString($bytRegKey[$x], 16)
    switch($tempString.Length)
    {
        0 {$strRegKey += "00"}
        1 {$strRegKey += "0" + $tempString}
        2 {$strRegKey += $tempString}
    }
}
[byte[]] $bytTempAppPath = @()
$bytTempAppPath = $encText.GetBytes($ProgramName)
[byte[]] $bytAppPath = @()
$strAppPath = ""

Function Rot13($byteToRot)
{
    if($byteToRot -gt 64 -and $byteToRot -lt 91)
    {
        $bytRot = $($($byteToRot - 64 + 13) % 26 + 64)
        return $bytRot
    }
    elseif($byteToRot -gt 96 -and $byteToRot -lt 123)
    {
        $bytRot = $($($byteToRot - 96 + 13) % 26 + 96)
        return $bytRot
    }
    else
    {
        return $byteToRot
    }
}

for($x = 0; $x -lt $bytTempAppPath.Count * 2; $x++)
{
    If($x % 2 -eq 0)
    {
        $curbyte = $bytTempAppPath[$([Int]($x / 2))]
            $bytAppPath += Rot13($curbyte)

    }
    Else
    {
        $bytAppPath += 0
    }
}

for($x=0; $x -lt $bytAppPath.Count; $x++)
{
    $tempString = [Convert]::ToString($bytAppPath[$x], 16)
    switch($tempString.Length)
    {
        0 {$strAppPath += "00"}
        1 {$strAppPath += "0" + $tempString}
        2 {$strAppPath += $tempString}
    }
}
if(-not $strRegKey.Contains($strAppPath))
{
    Write-Host Program not found. Programs are case sensitive.
    break
}

[byte[]] $header = @()
$items = @{}
for($x=0; $x -lt 20; $x++)
{
    $header += $bytRegKey[$x]
}

for($x=0; $x -lt $(($bytRegKey.Count-20)/1640); $x++)
{
    [byte[]] $item=@()
    $startingByte = 20 + ($x*1640)
    $item += $bytRegKey[$($startingByte)..$($startingByte+1639)]
    $items.Add($startingByte.ToString(), $item)
}

foreach($key in $items.Keys)
{
$item = $items[$key]
    $strItem = ""
    $tempString = ""

    for($x=0; $x -le $item.Count; $x++)
    {
        $tempString = [Convert]::ToString($item[$x], 16)
        switch($tempString.Length)
        {
            0 {$strItem += "00"}
            1 {$strItem += "0" + $tempString}
            2 {$strItem += $tempString}
        }
    }
    if($strItem.Contains($strAppPath))
    {
        Write-Host Item Found with $ProgramName in item starting with byte $key
            $bytRegKey[$([Convert]::ToInt32($key)+528)] = $setting
            Set-ItemProperty $($(Get-Item 'HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\TrayNotify').PSPath) -name IconStreams -value $bytRegKey
    }
}

任意の名前を使用して、ps1 ファイルとして保存します。

グループ ポリシー管理 MMC を開きます。選択したグループ ポリシー オブジェクトを選択し、右クリックして [編集] を選択します。エディターで、[ユーザーの構成] > [Windows の設定] > [スクリプト] > [ログオン] に移動し、[プロパティの表示] をクリックします。[PowerShell] タブに移動し、[ファイルの表示] をクリックします。

作成したスクリプトを、開いたばかりのエクスプローラ ウィンドウにコピーし、ウィンドウを閉じます。

ログイン スクリプトのプロパティ ウィンドウで、新しい PowerShell スクリプトを追加し、スクリプト名に使用したスクリプトの名前 (例: NotifyIcon.ps1) を入力し、パラメーターにプログラム名 (大文字と小文字を区別します) を入力します。使用する設定によって:

0 = 通知のみを表示する 1 = アイコンと通知を非表示にする 2 = アイコンと通知を表示する <--- 必要なもの

たとえば、RealVNC サーバーを常に表示する必要がある場合は、次のように入力します。

winvnc4.exe 2

パラメータとして

実行可能ファイルの名前は、[ファイル名を指定して実行] ダイアログ ボックスを開いて msconfig と入力し、スタートアップ プログラムを調べる、インストール ディレクトリ C:\Program Files{your program} に手動で移動する、または次のように試すなど、いくつかの異なる方法で見つけることができます。タスク マネージャーで実行中のプロセスを調べて、目的のプログラムに一致させます。10回中9回は成功します。

これが機能するためには、ユーザーは事前にアプリケーションを実行してから適切にログアウトし、explorer.exe が更新された通知領域の履歴をレジストリに書き込む機会を得る必要があります。その後のログインで、スクリプトは履歴内のプログラムを正常に特定し、その設定を常に表示するように更新する必要があります。

PowerShell プロンプトからスクリプトを手動で実行してデバッグすることもできますが、実行する前に explorer.exe ('taskkill /f /im explorer.exe') を強制終了する必要があります。それが終了したとき。

私はこのプロセスを信用しません。私が書いたのではなく、見つけただけです。スクリプトの功績はマイカ・ローランドにあります。GPO プロセスの功績は Geoff Kendal に帰属します

一番上のものを除いて、元の著者にリンクするのに十分な評判がありません.

于 2013-09-05T14:49:41.397 に答える
7

コードでは適用できません。常に表示するようにユーザーに指示するだけです

http://blogs.msdn.com/b/oldnewthing/archive/2010/12/15/10105142.aspx

ただし、レジストリエントリを変更することでハッキングすることができます

HKEY_Current_User\Software\Microsoft\Windows\CurrentVersion\Explorer\TrayNotify

これをチェック

于 2011-10-24T14:50:46.857 に答える