Windows/MFC

QA: How to install/uninstall a Today plug-in?

aucd29 2013. 10. 2. 18:39
http://windowsmobiledn.com/articles/todayinstall.html

Question
How do I programmatically install or remove a Today item plug-in?

Answer
Today plug-ins or Items, as Microsoft calls them, are DLLs stored in the \Windows directory. Let's assume you have a Today Item to install. It is implemented in the today_sample.dll file, and its name is 'Sample Item'. To install it, do the following:

Install

Copy the today_sample.dll file to the \Windows directory.
Create a registry key under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Today\Items with the name of your item (Sample Item).
Under this key, create the following DWORD values: Type=4, Enabled=1, Options=1 (0 if the DLL does not support the Options dialog).
Under the same key, create the SZ value: DLL=\Windows\today_sample.dll.
Use the magical touch: SendMessage(HWND_BROADCAST, WM_WININICHANGE, 0xF2, 0);.

The Today Item should be visible in the Today screen.

Uninstall
Removing the Today Item is simpler:


Delete the key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Today\Items\Sample Item.
Use the magical touch: SendMessage(HWND_BROADCAST, WM_WININICHANGE, 0xF2, 0);
Now, you may be able to delete the today_sample.dll file. If the system refuses to delete the file, wait for a little while before trying again (it may still be open and locked by the operating system).