   [.net] C++.net Webservice and Window application
  Hello everybody,This is my first Thread on this wonderful forum.I'm developing a webservice to create a standard communication tunnel between a Direct3D engine and an old VB6 application. The idea is to expose different methods of the Engine using a WebService. The VB6 application will control the engine with the webservice methods.I can use the unmanaged dll used by the engine in the webservice (wasn't easy). The problem, I can't create window or use existing windows. When I create a direct3D device the HRESULT gives me the "Invalid call" error. If I try to use GDI+ to draw something in an existing window, I can't create the graphics associated.Is-it possible to control windows using a WebService ?Note: My Webservice is running using the local admin user logged on the server.   
  No, WebServices should run in a "headless" environment, i.e. in the assumption of absolutely no monitor. Instead of drawing to a window, draw to an memory buffer. You might start by looking at System.Drawing.Bitmap and read about pinning the Bitmap's data buffer -- pinning being a necessary operation when sending data over the mangaged/unmanaged void in order to prevent the garbage collector from moving the managed object and confusing the unmanaged code during a memory compact operation.   ;  Thank you for the reply capn_midnight.I don't want to give bitmap information to the engine or any information.I need only to send simple order to the engine, every data or information are contained and managed by the Engine in unmanaged code.I would like to know why should WebServices run in a "headless" environment ? Why isn't it possible to manage a window on the server using the webservice. Is there a limitation ?   ;Quote:Original post by LourogThank you for the reply capn_midnight.I don't want to give bitmap information to the engine or any information.I need only to send simple order to the engine, every data or information are contained and managed by the Engine in unmanaged code.I would like to know why should WebServices run in a "headless" environment ? Why isn't it possible to manage a window on the server using the webservice. Is there a limitation ?because a web service isn't MEANT to interact with the windowing system. The windowing system often requires mouse or keyboard input in order to work properly, and a web service cannot provide that. Imagine a modal dialog were displayed, how would the web service clear the dialog so that execution can continue?Heck, there are many occasions where the server that a web service would be running on wouldn't even have a monitor or keyboard/mouse directly hooked up to it. The servers just sit on the network, waiting for someone to perform an HTTP request, a telnet session, or remote desktop session.What exactly are you making? A web service is intended to run on a remote server, providing textual data to a client over the internet. It's not exactly intended to be used to return image data. .NET web services are built on the SOAP protocol, which is an XML format. XML is best suited for text data, and while it can technically be used to return binary data such as images, it's kind of a hack.   ;  I don't want to use the webservice in a normal way.I only want to command the engine using a standard protocol. It's like a communication protocol.The webservice contains an interface, for example:- init();- showRectangle();- HideRectangle();The webservice uses our managed code to produce the different actions. The Window is completely managed by the engine.Hope you understand what I mean.It's possible to do what I want with Remoting, but it would take more time.   ;  You should use the web service as just a message queue, then. Have your rendering application also reference the web service to periodically poll the message queue and get the messages from the clients.It sounds like you have something like this right now (lines and arrows represent the web service's HTTP interactions):client \   \ client----> web service/rendering engine  /  / client you should use something like thisclient \   \ client----> web service/message queue <---rendering engine  /  / client ;  Thank you for your help. I finally use remoting to do what I want.client \   \ client----> Remoting Object --> rendering engine  /  / client Your solution wasn't applicable, I wanted a direct access to the rendering engine. But the idea helped me to understand why it's impossible to use Webservice with windows.Bye, Thank you !   