Windows 8: TopMost window
I am working on my next ambitious project “MouseTouch” which is multi touch simulator application for windows 8 platform and intended to increase the productivity if you are running windows 8 on non-touch device.
This will bring the touch feature of windows 8 to life even if you are using mouse pad.
The first challenge is how to render something on top of metro start menu items?
So if you want to create a true topmost window which can float even on top of windows 8 metro apps here are the simple steps..
- Create WPF visual studio application (or any other window app )
- Set TopMost=True for MainWindow
- Right-click on your project in the Solution Explorer
- Select “Add New Item” from the context menu.
- Choose “Application Manifest File” from the list of options in the dialog box that appears.
- Right-click on your project in the Solution Explorer and click “Properties” (or double-click on the “Properties” item under your project).
- Under the first tab (“Application”),select your app.manifest file from the drop-down box labeled “Manifest”.
- Set the, <requestedExecutionLevel level=”asInvoker” uiAccess=”true” />
The next part is to create a certificate and install it in trusted root authorities.
- Create certificate
- makecert -r -pe -ss PrivateCertStore -n "CN=TopMost.com" topmost.cer
- Import certificate to (Local Machine) trusted root certification authorities using mmc.exe.
Now sign your executable using the certificate, either by using the command, or using visual studio (check the delay sign flag).
- Signtool sign /v /s PrivateCertStore /n TopMost.com /t http://timestamp.verisign.com/scripts/timestamp.dll TopMost.exe
Now copy the TopMost.exe to trusted location like c:\Windows\ or program files and execute the TopMost.exe..
Still struggling ..
Ok if , executable is not signed or certificate is not installed properly, you see following exception
To avoid this exception, open mmc.exe, add certificates snap-in>Select Computer account>Local Computer>
Go to trusted root certification authorities>certificates>right click > tasks and import the certificate ..