Guest moo_ski_doo Posted September 29, 2003 Report Posted September 29, 2003 I've recently written a plugin for the homescreen and I've now got just about everything working. The one bit I'm stuck on is getting the plugin to update (repaint) itself every so often. I've managed to set up a timer successfully (it currently beeps at me every second) as a thread inside the dll. The idea was to have this timer call the InvalidatePlugin function to do the job for me. However, it seems that whatever I try with this function it just doesn't work. All my variables and pointers look correct and after putting loads of debug in everything looks fine (there are no exceptions etc.) but it still just won't work. Does anyone know how to get InvalidatePlugin to work??? This is the only thing left to do to have the plugin fully working. This seems like quite a minor thing but is essential in the running of the plugin. Cheers. -Mark.
Guest Richie M Posted September 30, 2003 Report Posted September 30, 2003 I'm not sure if Invalidate is what you want to be using :? but i've used it with no problems with the syntax below m_ppe->InvalidatePlugin(m_hplugin, 0); where definitions areIHomePluginEnvironment* m_ppe; HPLUGIN m_hplugin; I have only used this for when the plugin is unselected.
Guest moo_ski_doo Posted September 30, 2003 Report Posted September 30, 2003 Cheers for the reply, this is exactly what I've been doing! Since you've got it working, any idea where I could be going wrong? For testing, I've taken a copy of the helloplug sample bundled with eMbedded VC and added a few lines: To the PluginHello class definition: HPLUGIN m_hPlugin; To PluginHello::Initialize: m_hPlugin = hPlugin; To PluginHello::GetHeight (just for temporary testing, since this function is called lots): m_ppe->InvalidatePlugin(m_hPlugin, 0); To PluginHello::OnEvent, after 'case PE_PAINT:' (this is not entirely necessary since I've had a good look through the debug file afterwards anyway): MessageBeep(0); And that's it. The plugin runs fine using the supplied test.home.xml file, and 'Hello World' appears on the screen as expected, but without forcing a redraw (by opening a window in front of it for example) it never gets redrawn and never beeps, no matter how many times GetHeight is called (which is a lot!). Any ideas what could be wrong? Any help would be greatly appreciated, this has been bugging me for a long time. Thanks again ;) -Mark.
Guest moo_ski_doo Posted September 30, 2003 Report Posted September 30, 2003 AHA!!!!!! FINALLY GOT IT WORKING! For some reason I have to pass the second parameter as IPF_HEIGHT_CHANGED or IPF_SELECTABILITY_CHANGED instead of zero to get it working. I have no idea why this is (Microsoft's documentation says to pass zero if the height and selectability haven't changed, which they haven't), but it works anyway! :mrgreen: :mrgreen: :mrgreen: Still would be interested to know why passing zero doesn't work, especially if other people have used it... I'm happy now. Cheers. -Mark.
Guest Richie M Posted October 1, 2003 Report Posted October 1, 2003 Glad you got it working ;)/ To be honest i found that plug-in coding is a black art, and lots of blindly changing code to get things to work as they should. I have asked MS for better documentation for coding plug-ins and was told some would soon be available, but that was months ago ](*,)
Guest moo_ski_doo Posted October 1, 2003 Report Posted October 1, 2003 Heehee, I totally agree, I've found writing plugins so much harder than writing regular Windows apps. I still don't understand a lot of what I've had to do to get them working! Would be good to have better documentation. With the advent of SP2003 it should hopefully get easier anyway =D>
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now