I am making an app that shows and hides windows via hotkeys, and i have implemented a code to stop the taskbar window getting hidden, and i am trying to get a code to make sure the desktop doesnt get hidden, but the desktop one isnt working, although i got the taskbar one to work.
that code is the functions and the declarations, which is working fine. except, when i try to match the checkfordesktopwindow to getforegroundwindow, they arnt the same, even if my current window is my desktop. here is the code that i use when the hotkey is called:
Im just wondering why there not the same, and what i can do to make them the same, or to make sure the desktop window cant get hidden.
thanks
VB.NET:
Private Declare Function GetForegroundWindow Lib "user32" () As Integer
Private Declare Function ShowWindow Lib "user32.dll" (ByVal hwnd As Int32, ByVal nCmdShow As Int32) As Boolean
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Public Declare Function GetDesktopWindow Lib "user32" () As Integer
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Int32
Private Declare Function BringWindowToTop Lib "user32" Alias "BringWindowToTop" (ByVal hwnd As Long) As Int32
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long) As Int32
Declare Function OpenIcon Lib "user32" (ByVal hwnd As Long) As Int32
Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Int32) As Int32
Public Function GetTaskbarWindow() As Long
GetTaskbarWindow = FindWindow("shell_traywnd", "")
End Function
Public Function CheckForDesktopWindow()
CheckForDesktopWindow = GetDesktopWindow()
End Function
that code is the functions and the declarations, which is working fine. except, when i try to match the checkfordesktopwindow to getforegroundwindow, they arnt the same, even if my current window is my desktop. here is the code that i use when the hotkey is called:
VB.NET:
If GetForegroundWindow = GetTaskbarWindow() Then
Exit Sub
End If
If GetForegroundWindow = CheckForDesktopWindow() Then
Exit Sub
End If
Im just wondering why there not the same, and what i can do to make them the same, or to make sure the desktop window cant get hidden.
thanks