2013-04-09 20 views
7

アイコンがシステムトレイに存在するかどうか確認したい。 「X」アプリケーションがシステムトレイ領域にシステムトレイアイコンを表示している場合と同様に、アイコンがシステムトレイにありますか?

私はGoogleでこれを行う方法については情報がありましたが、何も見つかりませんでした。

UPDATE:

私はgivedロバート・コメントでURLのC#の例を翻訳VB.NETで試してみたが、私はそれを継続する方法がわからない何これ。

Imports System.Runtime.InteropServices 

Public Class Form1 

    Public Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long 
    Public Declare Function FindWindowEx Lib "user32.dll" Alias "FindWindowExA" (ByVal hWndParent As IntPtr, ByVal hWndChildAfter As IntPtr, ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr 

    Public Shared Function WindowHandle(sTitle As String) As Long 
     Return FindWindow(vbNullString, sTitle) 
    End Function 


    Private Shared Function GetSystemTrayHandle() As IntPtr 
     Dim hWndTray As IntPtr = FindWindow("Shell_TrayWnd", Nothing) 
     If hWndTray <> IntPtr.Zero Then 
      hWndTray = FindWindowEx(hWndTray, IntPtr.Zero, "TrayNotifyWnd", Nothing) 
      If hWndTray <> IntPtr.Zero Then 
       hWndTray = FindWindowEx(hWndTray, IntPtr.Zero, "SysPager", Nothing) 
       If hWndTray <> IntPtr.Zero Then 
        hWndTray = FindWindowEx(hWndTray, IntPtr.Zero, "ToolbarWindow32", Nothing) 
        Return hWndTray 
       End If 
      End If 
     End If 

     Return IntPtr.Zero 
    End Function 

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click 
     MsgBox(WindowHandle("Steam")) ' 6687230 
     MsgBox(GetSystemTrayHandle()) ' 62789 
    End Sub 

End Class 
+2

あなたのアプリケーションやサードパーティ製のアプリケーション用にしたいのですか? –

+7

http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/4c4f60ce-3573-433d-994e-9c17f95187f0/ –

+0

コメントをいただきありがとうございます。サードパーティのアプリケーション用です – ElektroStudios

答えて

3

thisコードプロジェクトの記事を読む必要があります。

関連する問題