WEDF_BlockedWindow (Industry 8.1)
7/8/2014
Review the syntax, members, and examples of the WEDF_BlockedWindow WMI provider class for Windows Embedded 8.1 Industry (Industry 8.1).
This Windows Management Instrumentation (WMI) class configures which windows Dialog Filter blocks, and the action that Dialog Filter performs on a window when blocking it.
Syntax
class WEDF_BlockedWindow {
[key] uint32 id;
[Required] string title;
[Required] string processName;
sint32 controlType[];
string controlName[];
[Required] string action;
[Required] string actionList[];
[Static] uint32 GetBlockedWindow(
[Out, EmbeddedInstance("WEDF_BlockedWindow")] string cmdletOutput[]
);
[Static] uint32 AddBlockedWindow(
[In, EmbeddedInstance("WEDF_BlockedWindow")] string windows[],
[Out] uint32 cmdletOutput[]
);
[Static] uint32 Clear();
[Static] uint32 RemoveBlockedWindow(
[In] uint32 windows[]
);
};
Members
The following tables list the methods and properties that belong to this class.
Methods
Method |
Description |
---|---|
Adds an array of WEDF_BlockedWindow objects to the list of windows that Dialog Filter blocks. |
|
Removes all blocked window entries from the list of windows that Dialog Filter blocks. |
|
Gets an array of WEDF_BlockedWindow objects that represents the windows that Dialog Filter blocks. |
|
Removes specified blocked window entries from the list of windows that Dialog Filter blocks. |
Properties
Property |
Data type |
Qualifiers |
Description |
---|---|---|---|
id |
uint32 |
[key] |
A unique identifier for the blocked window configuration. |
title |
string |
[required] |
The title of the blocked window. |
processName |
string |
[required] |
The full path of the process that creates the blocked window (for example, “C:\Program Files\Internet Explorer\iexplore.exe”). |
controlType |
string [] |
A list of the types of all immediate child controls in the blocked window. For more information about control types, see Control Type Identifiers. |
|
controlName |
string [] |
A list of the names of all immediate child controls in the blocked window. |
|
action |
string |
[required] |
The action that Dialog Filter performs on the window when blocking it. The action must match an entry in the actionList property. |
actionList |
string [] |
[required] |
A list of valid actions that can be performed on the window. Valid actions can vary depending on the window; some common examples are “Minimize”, “Maximize”, and “Close”. |
Remarks
You can use the WEDF_VisibleWindow class to identify the properties of blockable windows that are open on a device.
Example
The following example demonstrates how to add and remove windows from the Dialog Filter blocked window list by using the Windows Management Instrumentation (WMI) provider in a Windows PowerShell script.
This script creates two functions to add windows to the blocked window list. The first function, Add-BlockedWindow, adds to the blocked list a window that is fully defined in the parameters passed to the function.
The second function, Block-VisibleWindow, uses the WEDF_VisibleWindows WMI provider to retrieve the attributes of the window in order to block it. This function requires only the window title bar and the action for Dialog Filter to take on the window, but the window must be currently visible on the device.
$COMPUTER = "localhost"
$NAMESPACE = "root\standardcimv2\embedded"
# Define common parameters
$CommonParams = @{"namespace"=$NAMESPACE; "computer"=$COMPUTER}
# Create handles to the class instances so we can call the static methods
$classBlockedWindow = [wmiclass]"\\$COMPUTER\${NAMESPACE}:WEDF_BlockedWindow"
$classVisibleWindow = [wmiclass]"\\$COMPUTER\${NAMESPACE}:WEDF_VisibleWindow"
function Add-BlockedWindow($titleBar, $processName, $actionList, $action, $controlType, $controlName) {
# Add a window to the list of windows that Dialog Filter blocks
Set-WMIInstance -class WEDF_BlockedWindow -argument @{title="$titleBar";processName="$processName";
actionList=$actionList;action="$action";controlType=$controlType;controlName=$controlName } @CommonParams | Out-Null
Write-Host "Added blocked window $titleBar in $processName";
}
function Block-VisibleWindow($titleBar, $action) {
# Block a window that is currently visible on the device based on the title bar
$VisibleWindow = Get-WmiObject -class WEDF_VisibleWindow @CommonParams | where {
$_.title -eq $titleBar
}
# If multiple matches are found, use the first match and write a warning
if ($VisibleWindow.count -gt 1) {
Write-Host "More than one visible window is present with the title of $titleBar. Blocking first matching window found."
$VisibleWindow = $VisibleWindow[0]
}
# Block the window
if ($VisibleWindow) {
Add-BlockedWindow $VisibleWindow.title $VisibleWindow.processName $VisibleWindow.actionList `
$action $VisibleWindow.controlType $VisibleWindow.controlName
} else {
Write-Host "No window with the title of $titleBar is currently visible on $COMPUTER."
}
}
# Block the Notepad.exe "Save As" window by manually specifying the window attributes
Add-BlockedWindow "Save As" "C:\Windows\System32\notepad.exe" @("Save","Cancel","Close") "Cancel" @(50033,50021,50020,50003,50000,50000,50027,50033,50037) @("","","Encoding:","Encoding:","Save","Cancel","","","")
# Block Internet Explorer's Internet Options window if it is currently visible
Block-VisibleWindow "Internet Options" "Close"
# Clear all windows from the blocked windows list
$classBlockedWindow.Clear()
Write-Host "Removed all windows from the list of windows blocked by Dialog Filter"
See Also
Reference
Dialog Filter WMI provider reference