[New release] Registry display plugin

levenum

Retired Moderator
Jul 13, 2005
1,550
17
0
Ok, most of you may find this totally useless as a plugin, but it was a combination of a request by user Treo_newb and a desire to create a sample plugin project that could be used as a base / example for plugin writers (I plan on doing an article on codeproject.com and this will be the source for it).

What does it do?
This plugin displays a string stored in registry.
The path is:
HKEY_CURRENT_USER\Software\RegDispPlugin
Value name: DisplayString

It checks if this string has changed several times per second when today screen is shown (as the system sends refresh message to all plugins) and displays the updated message if a change occurred.

What is it good for?
First, if you write apps using mortscript or similar like the user who requested this it will let your script display stuff on today screen.
Alternatively it could be used to mark your device today with a string that isn't as easily changed as user info.

The source is basically a skeleton plugin you can use to build your own plugin on (no license / copyright to limit you) and it already has several tricks needed for the plugin to display correctly:
  • VGA compatibility
  • Text size matching system settings
  • Proper header in settings dialog (like on system plugins)
  • Proper text color when selected (according to theme)
  • No blinking all today screen on change
  • Proper resize when switching between landscape and portrait
When I was writing my first plugin I could not find all these little fixes concentrated in a single article so I had to fish for each one as the bug reports came in.

Hope you will find this little project useful.

The plugin:
View attachment RegDisplay.CAB
The source (eVC 4 project): View attachment RegDisplay.zip


 
Last edited:

shaileshashar

Senior Member
Dec 6, 2004
288
29
0
Thank You Lev.

Thanks, Thanks, Thanks,
You are a legend.

I was almost through with my today plugin and was trying to figure out reading registry values and all of a sudden I get a PM from u about the plugin !!!

Very Cool !!!

OK a few questions,

1. I know that WM_TODAYCUSTOM_QUERYREFRESHCACHE is called for refreshing the today plugin, any ideas about when is it called.
I read somewhere that it was 2 seconds. Is it true?

2. I saw ur code and u have exposed CustomItemOptionsDlgProc in RegDisplay.def, but when I installed the cab file the 'options' is not enabled.
I manually changed the resistry and changed options to dword = 1 and saw ur name and email address.
u might want to enable that by default so that people can notice ur work.

I am planing a commercial release of a new project on basis of this.

Thanks again,

Shailesh
 

levenum

Retired Moderator
Jul 13, 2005
1,550
17
0
First, you're welcome.

shaileshashar:
1) I ran a debug print on this message once on an iPaq 1710 and it seems to be sent several times per second. This could differ from OS to OS or even from device to device, I am not sure.
If you need specifically timed refresh, or you have an event triggered on new data, I suggest using a timer or maybe a thread that will wait on an event. You can refresh your plugin from anywhere in code by calling InvalidateRect with your window handle.

2) I messed up the cab at first, forgetting to add the Options reg value. Then when I went to upload the fix, I couldn't access the site for about an hour (no idea why, I even rebooted the PC to Ubuntu). Should be fixed now, but I will check it later again (I have to go back to XP for that).

Good luck with your program.
 

shaileshashar

Senior Member
Dec 6, 2004
288
29
0
Suggestion

First, you're welcome.

shaileshashar:
1) I ran a debug print on this message once on an iPaq 1710 and it seems to be sent several times per second. This could differ from OS to OS or even from device to device, I am not sure.
If you need specifically timed refresh, or you have an event triggered on new data, I suggest using a timer or maybe a thread that will wait on an event. You can refresh your plugin from anywhere in code by calling InvalidateRect with your window handle.

2) I messed up the cab at first, forgetting to add the Options reg value. Then when I went to upload the fix, I couldn't access the site for about an hour (no idea why, I even rebooted the PC to Ubuntu). Should be fixed now, but I will check it later again (I have to go back to XP for that).

Good luck with your program.
Thanks for the help, will check the fixed cab.
Also a suggestion:
A custom icon could also be incorporated. You can give a option to load a custom icon next to the text in the today plugin.

I know anybody can modify ur code and do it but still.
 

levenum

Retired Moderator
Jul 13, 2005
1,550
17
0
Actually, I probably should have mentioned this in the original post but I have no intention of adding options to this thing.
This would only complicate the code and turn it in to an actual app instead of a sample project.

But by all means feel free to make suggestions. If this thing does become popular, when I am done with my other projects (like LVMTopBat) which won't be any time soon (unfortunately) I will release a separate version of this plugin with all kinds of options that can be controlled both by user (form the options dialog) and by other apps through registry.

Maybe things like text alignment, size, bold / Italic / underlined.

P.S.
The reason I put the string this plugin loads under HKEY_CURRENT_USER instead of the HKLM where the rest of the plugin registry resides is because by default the HKEY_LOCAL_MACHINE on WM 5 and higher has a security restriction. For example you can not write to it using RAPI, only by authorized (or signed) app on the device. The HKEY_CURRENT_USER on the other hand is open for all.
 

shaileshashar

Senior Member
Dec 6, 2004
288
29
0
P.S.
The reason I put the string this plugin loads under HKEY_CURRENT_USER instead of the HKLM where the rest of the plugin registry resides is because by default the HKEY_LOCAL_MACHINE on WM 5 and higher has a security restriction. For example you can not write to it using RAPI, only by authorized (or signed) app on the device. The HKEY_CURRENT_USER on the other hand is open for all.
Thanks for the info, I never knew that.
 

mistrix

Senior Member
Nov 13, 2005
73
0
0
...But by all means feel free to make suggestions.
As a frequent mortscript user I think, this great app might be even more usefull, if the string was shown in an "allways on top" message box instead of the today screen. The Today screen might be obscured by other active windows during the scripts runtime and the plugin eats precious today screen estate also while being unused, doesn't it?

In that case (of a standalone application) I would furthermore introduce some kind of termination string (or reg. value) to end the display application.

Code:
- start mortscript
   - writes first string to registry
   - starts display application (run)
   - updates string in registry whenever appropriate
   - ...
   - writes termination string to registry 
   -> display applications self-terminates
   - ...
- end of mortscript
Honestly, I already do use something comparable with mortscript (employing a conditioned sleepmessage loop and reading from the registry too), but this could be much nicer and more elegant.

Just my 2 cents... What do you think?
 
Last edited:

levenum

Retired Moderator
Jul 13, 2005
1,550
17
0
I think something like that would be better implemented by the mortsrit program it self.
It could be a function like MessageBox API in windows which you could then command on and off. Having it built in would save precious resources on the device that would be wasted by having an extra app run constantly in background.

This is just my thought though.
I'd suggest contacting the developer of mortscript and discussing it with him.
 

alfcen

New member
Apr 15, 2008
2
0
0
Ryukyu Islands
www.alfcen.com
Hello levenum,
I just joined the community. Reason being, I found your RegDisplay plug-in :)
You call it a sample project, but the impact is that of an awesome solution.
Great for MortScript, but equally useful in BASIC applications that write
messages to the registry which is show upon screen minimization.
I regret not being a C programmer (mainly BASIC), else I'd love to further
develop this jewel.
Your plug-in runs flawlessly in an iPAQ 210 under WM6 Classic.
Cheers and Respectful Greetings
Robert
 

jfeldredge

Senior Member
Feb 7, 2008
58
2
0
CLSID for registry display plugin

What is the CLSID for the Registry Display Plugin? I am going to have to edit the XML file that defines my home screen in order to get the plugin to show up. I am using Facade to control my home screen, and the only plugins that it will show in its list are those currently in use in one of the XML files in the Application Data\Home folder. All other new plugins require editing the XML. Thanks for your help.
 

digitaldon37

Senior Member
Oct 19, 2007
231
1
0
Houston, TX
Ok, most of you may find this totally useless as a plugin, but it was a combination of a request by user Treo_newb and a desire to create a sample plugin project that could be used as a base / example for plugin writers (I plan on doing an article on codeproject.com and this will be the source for it).

What does it do?
This plugin displays a string stored in registry.
The path is:
HKEY_CURRENT_USER\Software\RegDispPlugin
Value name: DisplayString

It checks if this string has changed several times per second when today screen is shown (as the system sends refresh message to all plugins) and displays the updated message if a change occurred.

What is it good for?
First, if you write apps using mortscript or similar like the user who requested this it will let your script display stuff on today screen.
Alternatively it could be used to mark your device today with a string that isn't as easily changed as user info.

The source is basically a skeleton plugin you can use to build your own plugin on (no license / copyright to limit you) and it already has several tricks needed for the plugin to display correctly:
  • VGA compatibility
  • Text size matching system settings
  • Proper header in settings dialog (like on system plugins)
  • Proper text color when selected (according to theme)
  • No blinking all today screen on change
  • Proper resize when switching between landscape and portrait
When I was writing my first plugin I could not find all these little fixes concentrated in a single article so I had to fish for each one as the bug reports came in.

Hope you will find this little project useful.

The plugin:
View attachment 41592
The source (eVC 4 project): View attachment 41583


This is great! I was asked if I could write a today screen plug-in for my weather application (http://forum.xda-developers.com/showthread.php?t=445576) - I couldn't since I don't have the skills and I'm writing .NET code - but this is exactly what I needed.

I'm adding support for this plug-in and will of course give credits to you.