[quoted text, click to view] Dave Hall wrote:
> Sorry for the cross post. I discovered hhis newsgroup after my original
> posting in microsoft.public.dotnet.framework newsgroup and thought it fit
> better here.
>
> I have a 3rd party library that requires a non zero hWnd parameter as a
> parameter to one of it's functions. I need to ue this library in a Windows
> Service with no UI. What .NET class should I use to create a simple
> invisible window so I can pass it's hWnd to the 3rd party API? In the .NET
> Compact Framework, I would use an instance of the the MessageWindow class,
> but that class is not available except in the CF version. Do I have to call
> the Win32 APIs directly to create a hidden window in a service? Has anyone
> already wrapped this functionality and published it? Any suggestions?
>
> Thanks,
> Dave
I think you could make a form, and set its visibility to False. As long
as you don't stall for input, as a messagebox would, it should not hang.
Don't forget, if you are starting as a console app (as services
typically should be) you are going to ALSO need a message pump. Careful
about not doing other processing on the pump's thread that will stall
message delivery. I would use a dedicated thread for this. Myself I
would simply call Win32 API to create the invisible window. I have made
services in VB6 in this way. Also, don't forget to send messages to
close your window, and be sure to process them via the pump when you
want the service to exit. I think you could use the pump built into
application.