Login  
Search All Forums
Dart Home | PowerSNMP for ActiveX | Custom Development Reply | PowerSNMP for ActiveX Topics | Forums   
AuthorForum: PowerSNMP for ActiveX
Topic: troubles using SNMP manager in a .NET service
rnie

From: Zoetermeer, Netherlands
Posts: 7
Member Since: 02/24/04
posted February 24, 2004 2:27 AM

- Writing as service in .NET is not a problem (is working as we speak)
- Writing a program with dart SNMP managers(s) is also not problem (is also working)

The combination is the problem.

The difference with a service (according to reg. app) is this :

To use snmp for a 'normal' program you just drag the DART snmp component on a userform and the snmp object(s) become available.
With a service you CANNOT drag the DART snmp control on the service class.

Trying to drag the DARTsnmp control it onto a user form (in the service project) and 'sharing' the code / controls results in an error which is shown in the event manager.
(de Service is actually started but will stop automaticly, when I leave out the code with dart snmp objects the service works just fine)

Perhaps there is anything wrong with my approache?


Error show in eventmanager:

Service cannot be started. System.Threading.ThreadStateException: Could not instantiate ActiveX control '35053a22-8589-11d1-b16a-00c0f0283628' because the current thread is not in a single-threaded apartment.
  at System.Windows.Forms.AxHost..ctor(String clsid, Int32 flags)
  at System.Windows.Forms.AxHost..ctor(String clsid)
  at Axmscomctl.AxProgressBar..ctor()
  at ClassLibrary1.Form1.InitializeComponent()
  at ClassLibrary1.Form1..ctor()
  at ClassLibrary1.Form1.init1()
  at WindowsService1.Service1.OnStart(String[] args)
  at System.ServiceProcess.ServiceBase.ServiceQueuedMainCallback(Object state)

For more information, see Help and Support Center at
K M Drake



From: Utica, NY USA
Posts: 3406
Member Since: 07/14/00
posted February 24, 2004 8:41 AM

Hi,
Please see the following post concerning using ActiveX controls in .Net:
http://support.dart.com/postings?topicid=2647
Please take specific notice of the second bullet under the "IMPORTANT" heading.

Also, in order to get an ActiveX control's events to fire in a .Net service, you will have to spawn a thread that makes constant DoEvents calls. Please see the following thread for an example:
http://support.dart.com/postings?topicid=3147

Hope it helps,
-ken
Reply | PowerSNMP for ActiveX Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX