PDA

Показать полную графическую версию : [решено] Вызов функции из скрипта powershell


ferget
03-06-2011, 03:33
скрипт

$signature = @"
[DllImport("user32.dll")]
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll")]
public static extern bool ShowWindow(IntPtr hWnd,int nCmdShow);
"@

$icons = Add-Type -MemberDefinition $signature -Name Win32Window `
-Namespace ScriptFanatic.WinAPI -passThru

$hWnd=$icons::FindWindow("Progman","Program Manager")

function Hide-DesktopIcons{$null = $icons::ShowWindow($hWnd,0) }
function Show-DesktopIcons{$null = $icons::ShowWindow($hWnd,5) }


как вызвать функцию




© OSzone.net 2001-2012