Service or Singleton COM exe or DLL
-
Hi , I have a requirement , where I want one entity to be persistent in the computer. I am struggling to decide on what this entity will be . My model is such that I want to be able to intercept USB device notifications utilizing the WM_DEVICE_CHANGE messages by creating a hidden window in this entity and then update the elements of a system tray icon ( which exposes a Menu ) . So my requirement does not fit the Client Server model , yet I am leaning towards COM to provide one EXE that does it all . So in other words , this entity will not provide any APIs for other clients to use . Am I unnecessarily using COM ? So finally I need to finalize the form that this need to take . Service - actually the Visual Studio 6 gives the option to create a COM Object as a Service. COM DLL COM EXE Standalone EXE ? Your inputs are really appreciated
Engineering is the effort !
-
Hi , I have a requirement , where I want one entity to be persistent in the computer. I am struggling to decide on what this entity will be . My model is such that I want to be able to intercept USB device notifications utilizing the WM_DEVICE_CHANGE messages by creating a hidden window in this entity and then update the elements of a system tray icon ( which exposes a Menu ) . So my requirement does not fit the Client Server model , yet I am leaning towards COM to provide one EXE that does it all . So in other words , this entity will not provide any APIs for other clients to use . Am I unnecessarily using COM ? So finally I need to finalize the form that this need to take . Service - actually the Visual Studio 6 gives the option to create a COM Object as a Service. COM DLL COM EXE Standalone EXE ? Your inputs are really appreciated
Engineering is the effort !
I think a stand alone exe will do the trick. You can prevent more than one instance running at a time easily enough with a named mutex. You can have the main window as your hidden window which keeps things simple, perhaps one DLL to encapsulate the system tray icon stuff, I've seen that done well although it's not easy unless you're targetting only XP or only Server 200?, and another to encapsulate the USB WM_DEVICE_CHANGE stuff, I've written one like that but it's closed source :( . I can tell you that you may need to download a DDK to get the correct headers for the defines you might need, again if you use any XP and upward only defines it won't work on earlier system. Win2K in the earliest that has usably reliable USB device stuff although some things work a bit on Win98. Do you need COM? You might need a little to get the System tray stuff to work, It's been too long since I looked at it, but nothing more complex than emulating a VB enumeration type if that. A Service? No as long as you can start your app on or near startup and automatically I can't see the need for it being a service. A service shouldn't interact with the UI anyway so not if it's going to have an icon. Remember to scan for already plugged in USB devices on startup and also that they can be reported as fixed or removable, sometimes depending on the chipset revision on the removable media in the removable drive! Enjoy :)
Nothing is exactly what it seems but everything with seems can be unpicked.