FORUMS
Remove All Ads from XDA

[New release] Registry display plugin

1,548 posts
Thanks Meter: 17
 
By levenum, Retired Moderator on 15th June 2007, 10:21 AM
Post Reply Email Thread
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:
RegDisplay.CAB
The source (eVC 4 project): RegDisplay.zip


 
 
15th June 2007, 01:04 PM |#2  
Senior Member
Thanks Meter: 12
 
More
Thanks for this!
15th June 2007, 02:01 PM |#3  
shaileshashar's Avatar
Senior Member
Thanks Meter: 28
 
More
Thumbs up 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
15th June 2007, 02:35 PM |#4  
levenum's Avatar
OP Retired Moderator
Thanks Meter: 17
 
More
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.
15th June 2007, 03:10 PM |#5  
shaileshashar's Avatar
Senior Member
Thanks Meter: 28
 
More
Lightbulb Suggestion
Quote:
Originally Posted by levenum

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.
15th June 2007, 03:25 PM |#6  
levenum's Avatar
OP Retired Moderator
Thanks Meter: 17
 
More
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.
16th June 2007, 07:26 AM |#7  
shaileshashar's Avatar
Senior Member
Thanks Meter: 28
 
More
Smile
Quote:
Originally Posted by levenum

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.
9th September 2007, 11:55 AM |#8  
Member
Flag Bucharest
Thanks Meter: 1
 
More
Thank you so much! This was exactly what I was looking for!
12th October 2007, 11:08 PM |#9  
Member
Thanks Meter: 0
 
More
Quote:
Originally Posted by levenum

...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?
13th October 2007, 07:18 PM |#10  
levenum's Avatar
OP Retired Moderator
Thanks Meter: 17
 
More
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.
15th October 2007, 10:10 AM |#11  
Member
Thanks Meter: 0
 
More
Quote:
Originally Posted by levenum

I think something like that would be better implemented by the mortsrit program it self.
...
I'd suggest contacting the developer of mortscript and discussing it with him.

Mort knew about that request and by chance just announced to so.

Thanks anyway.
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes