If the SingleInstanceApplication is already
running, the SingleInstanceApplicationWrapper.StartupNextInstance event is triggered, and
the new document is loaded by the existing application.
nNote Single-instance application support will eventually make its way to WPF in a future version. For
now, this workaround provides the same functionality with only a little more work required.
WINDOWS VISTA AND UAC
File registration is a task that??™s usually performed by a setup program. One problem with including it in your
application code is that it requires elevated permissions that the user running the application might not have.
This is particularly a problem with the User Account Control (UAC) feature in Windows Vista. In fact, by default
this code will fail with a security-related exception.
In the eyes of UAC, all applications have one of three run levels:
??? asInvoker. The application inherits the process token of the parent process (the process that launched
it). The application won??™t get administrator privileges unless the user specifically requests them, even if
the user is logged on as an administrator. This is the default.
??? requireAdministrator. If the current user is a member of the Administrators group, a UAC confirmation
dialog box appears. Once the user accepts this confirmation, the application gets administrator privileges.
Pages:
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192