0. powershell 이란?
1. regedit로 직접 편집 하기
HKEY_CLASSES_ROOT
=> Directory
=> Background
=> shell
==> 새로만들기 : Key "Show TaskBar"
==> Show TaskBar에 Key 새로만들기 "command"
또는 ==> command의 (기본값) "powershell -executionpolicy unrestricted c:\ViewTaskBar.ps1"
2. Shell_TrayWnd 를 보이게 하는 powershell script
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\Background\shell\ViewTaskBar\command]
@="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell -executionpolicy unrestricted c:\\ViewTaskBar.ps1"
[HKEY_CLASSES_ROOT\Directory\Background\shell\HideTaskBar\command]
@="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell -executionpolicy unrestricted c:\\HideTaskBar.ps1"
[HKEY_CLASSES_ROOT\Directory\Background\shell\SetTaskBar\command]
@="explorer ms-settings:taskbar"
3. c:\ViewTaskBar.ps1
$sig = @"
[DllImport("user32.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr FindWindow( String sClassName, IntPtr sAppName);
[DllImport("kernel32.dll")]
public static extern uint GetLastError();
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern IntPtr SendMessage( IntPtr hwnd, uint Msg, uint wParam, uint lParam);
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern IntPtr ShowWindow( IntPtr hwnd, uint Msg);
"@
$fw = Add-Type -Namespace Win32 -Name Funcs -MemberDefinition $sig -PassThru
$hwnd = Add-Type -Namespace Win32 -Name Funcs -MemberDefinition $sig -PassThru
$sClassName='Shell_TrayWnd' # any existing window name
$wname='Shell_TrayWnd' # any existing window name
$hwnd = $fw::FindWindow( $sClassName, [IntPtr]::Zero ) # returns the Window Handle
$hwnd
$a = $fw::GetLastError()
$a
# WM_SHOWWINDOW 24
# SW_SHOW = 5
# SW_HIDE = 0
#
$fw::SendMessage( $hwnd, 24, 5, 0 ) # OnShowWindow만 콜한다.
$fw::ShowWindow( $hwnd, 5) # 여그서 결정타를 날려야 홈인이다.
4. HideTaskBar.ps1
$sig = @"
[DllImport("user32.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr FindWindow( String sClassName, IntPtr sAppName);
[DllImport("kernel32.dll")]
public static extern uint GetLastError();
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern IntPtr SendMessage( IntPtr hwnd, uint Msg, uint wParam, uint lParam);
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern IntPtr ShowWindow( IntPtr hwnd, uint Msg);
"@
$fw = Add-Type -Namespace Win32 -Name Funcs -MemberDefinition $sig -PassThru
$hwnd = Add-Type -Namespace Win32 -Name Funcs -MemberDefinition $sig -PassThru
$sClassName='Shell_TrayWnd' # any existing window name
$wname='Shell_TrayWnd' # any existing window name
$hwnd = $fw::FindWindow( $sClassName, [IntPtr]::Zero ) # returns the Window Handle
$hwnd
$a = $fw::GetLastError()
$a
# WM_SHOWWINDOW 24
# SW_SHOW = 5
# SW_HIDE = 0
#
$fw::SendMessage( $hwnd, 24, 0, 0 ) # OnShowWindow만 콜한다.
$fw::ShowWindow( $hwnd, 0) # 여그서 결정타를 날려야 홈인이다.
5. Set Taskbar
HKEY_CLASSES_ROOT\Directory\Background\shell\SetTaskBar\command
explorer ms-settings:taskbar
'Visual Studio C++' 카테고리의 다른 글
CDialog에서 xp 스타일 적용 (0) | 2019.12.30 |
---|---|
MFC 편집용 커서 그리기 (0) | 2019.12.20 |
VC++ Macro __FILE__에서 경로 제거 후 표시 하기 (0) | 2019.12.13 |
C# DLL을 C++에서 사용 하기 (0) | 2019.12.06 |
AfxBeginThread (0) | 2019.11.26 |