Message Box and Balloon Pop-Up Interception
如每次在插入新的硬體時,都會出現以下新增硬體精靈視窗,要如何將新增硬體精靈視窗關閉?如何在之後插入新硬體時,不會跳出此視窗,這時我們需使用Message Box and Balloon Pop-Up Interception。
可以參考以下的三種作法。
方法一:
Suppressing Balloon Pop-Ups (Windows Embedded Standard 2009)
Balloon pop-ups typically appear when new
programs and hardware are installed, when disk space becomes limited,
and when tools such as .NET Messenger are included in a run-time image. If you
do not want balloon pop-ups to appear in your run-time image, you can prevent
them either by changing the settings of the User Interface Core component, or
by setting values in the HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced
registry key.
By setting registry values, you can choose which balloon pop-ups to
suppress. You can prevent all balloon pop-ups appearing by disabling the EnableBalloonTips
registry value. You can prevent just the "New programs installed"
balloon pop-ups appearing by disabling the Start_NotifyNewApps registry.
These registry values are not included by default in most run-time images and
must be added.
To suppress balloon pop-ups by changing
User Interface Core settings
1.
In Target Designer, open your run-time image
configuration.
2.
In the configuration editor, expand the node for the User
Interface Core component and choose Settings.
3.
In the details pane, on the User Interface Settings tab, clear the Show Notifications
on Task bar check box.
To suppress balloon pop-ups by setting
registry values
1. In Target
Designer, open your run-time image configuration.
2. In the
configuration editor, expand the node for the SLX file, right-click Extra
Registry Data and choose Add. The Add an Extra Registry Entry to
the Configuration dialog box appears.
3. In the Root
list, select HKEY_CURRENT_USER.
4. In the Key
name box, type Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced or choose Browse
to navigate to that location.
5. In the Value
name box, type one of the following:
o
To suppress all balloon pop-ups, type: EnableBalloonTips
o
To suppress only "New programs installed"
balloon pop-ups, type: Start_NotifyNewApps
6. In the Type
list, select REG_DWORD.
7. In the Value
box, type 0.
For EnableBalloonTips, the value 2
enables balloon pop-ups and the value 0 disables them. For Start_NotifyNewApps, the value 1
enables balloon pop-ups and the value 0 disables them.
8. In the Description
box, type a description for this registry value for future reference.
9. Choose OK.
Note:
|
When
EnableBalloonTips is disabled, enabling Start_NotifyNewApps has no effect.
|
方法二:
Enabling Default
Reply (Windows Embedded Standard 2009)
User32 provides the functionality to intercept every MessageBox
function and automatically choose the default button. Not all message box
windows are produced through the standard MessageBox function;
therefore, this feature might not operate on
all windows.
To instruct NTUSER to intercept messages, an additional key and values are
required in the HKLM\System\CurrentControlSet\Control registry key. You
might need to create the registry key and values on your system, as follows.
To set up your system to automatically
reply to a message box without displaying it
1.
In the HKLM\System\CurrentControlSet\Control registry
key, create a new key named Error Message Instrument.
2.
Under the Error Message Instrument key, add the values of
type REG_DWORD from the following table.
Value
|
Data
|
Description
|
EnableDefaultReply
|
0x00000001
|
Enables
the Enable Default Reply feature.
|
EnableLogging
|
0x00000001
|
Enables
event logging.
|
3.
Under the Error Message Instrument registry key,
add one of the LogSeverity values of type REG_DWORD from the
following table.
Value
|
Data
|
Description
|
LogSeverity
|
0x00000000
= EMI_SEVERITY_ALL
|
All
message box events are logged.
|
LogSeverity
|
0x00000001
= EMI_SEVERITY_USER
|
Message
box events with the dwStyle parameter defined are logged, including
MB_USERICON, MB_ICONASTERISK, MB_ICONQUESTION, MB_ICONEXCLAMATION, and
MB_ICONHAND.
|
LogSeverity
|
0x00000002
= EMI_SEVERITY_INFORMATION
|
Errors,
warnings, questions, and information are logged. Message box events with no
dwStyle parameter or dwStyle = MB_ICONUSER are not logged.
|
LogSeverity
|
0x00000003
= EMI_SEVERITY_QUESTION
|
Errors,
warnings, and questions are logged. Information, events with no style, and
user-defined severity levels are not logged.
|
LogSeverity
|
0x00000004
= EMI_SEVERITY_WARNING
|
Only
errors and warnings are logged.
|
LogSeverity
|
0x00000005
= EMI_SEVERITY_ERROR. (EMI_SEVERITY_MAX_VALUE)
|
Only
errors are logged.
|
To log message information to the event log
1.
In the HKLM\System\CurrentControlSet\Services\EventLog\Application
registry key, create a new key named Error Instrument.
2.
Under the Error Instrument key, add the registry
values from the following table.
Value
|
Type
|
Value
|
TypesSupported
|
REG_DWORD
|
0x00000007
|
EventMessageFile
|
REG_EXPAND_SZ
|
%SystemRoot%\System32\User32.dll
|
You must reboot your target system for the changes to take effect.
方法三:
Filtering Out
ErrorMode Messages (Windows Embedded Standard 2009)
You can instruct the operating system to filter
out certain notification messages without affecting user interface
functionality.
Note:
|
Unlike
EnableDefaultReply, ErrorMode only hides the messages, it does
not intercept them and choose the default button. Be sure to check your
system log to see the errors that occurred but are hidden from display.
|
To filter out ErrorMode messages
1.
In Target Designer, open your run-time image configuration.
2.
In the configuration editor, expand the node for the SLX
file, and then expand the Windows subsystem component.
3.
In the Registry path list, right-click HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Windows\ErrorMode, and then click Properties.
4.
In the Root list, make sure HKEY_LOCAL_MACHINE
is selected.
5.
Do not change the contents of the Key Name, Value
Name, and Type list fields.
6.
In the Value box, type one of the following:
i.
To suppress system messages, type: 1
ii.
To suppress all messages, type: 2
7.
In the Description box, type a description for
this registry value for future reference.
8.
Choose OK.
沒有留言:
張貼留言