MSDN Archive Home
Help and FAQs
SpicIE - Simple Plug-In Creator for Internet Explorer
All Resource Updates
Create New Discussion
Static Variable in Pluggins
Oct 26 2012 at 11:09 AM
Oct 26 2012 at 11:11 AM
I´m writting a pluggin and I´m facing a strange problem.
I need to check a WebService every five minutes so I created a Thread in my pluggin that would check the WebService. The problem is that the Thread in being created for every window and tab that is opened.
I thought I could use a static variable to control this but it does not seem to be working.
I´ve got the SamplePluggin and write my code over it.
The basic idea I had was:
public class SamplePlugin : SpicIE.Host
/// These two constants define the CLSID and name for the plugin.
/// This must be unique otherwise you won't be able to control, install or deinstall your plugin
/// When developing choose a static unique GUID and leave it as it is
public const string PLUGIN_GUID = "20D33922-37D5-456E-915E-D87AE53106C6";
public const string PLUGIN_PROGID = "DotzPluggin";
public static SamplePlugin HostInstance = null;
private static string test = null;
public SamplePlugin() : base()
if (SamplePlugin.test == null)
Host.TraceSink.TraceEvent(TraceEventType.Information, 145, "Thread created");
SamplePlugin.test = "created";
//Create my WebService thread here
The problem is I can see in DebugView that the variable test is always null for new tabs and new Windows even though it is declared as static. It seems that a different version of my class is being created for every new tab and window.
Is there another way I can achieve this?
Sign in to post message or set email notifications
Manage Your Profile
MSDN Flash Newsletter
© 2008 Microsoft Corporation. All rights reserved.