Groups | Blog | Home
all groups > dotnet remoting > september 2004 >

dotnet remoting : Show form from remotable object?



Alex Oleynikov via .NET 247
9/6/2004 8:16:11 AM
Hi all,

Is this possible to display a windows form from a remotable=
object?
I need to create a singlecall server application that gives=
access to an instance of MapPoint ActiveX control to its=
clients=2E And I also would like to display a form from the=
remotable object containing the ActiveX, so I can see the actual=
maps being retrieved by the remote clients (for debugging=
purposes)=2E

In a sense I need to create an Automation-enabled app, so that I=
can interact with it programmatically or via user interface at=
the same time=2E Is this possible with =2ENET remoting?

Thank you for your input=2E

Alex

-----------------------
Posted by a user from =2ENET 247 (http://www=2Edotnet247=2Ecom/)

Ken Kolda
9/7/2004 2:05:18 PM
If you're trying to get your server to show a window on the client with an
ActiveX control in it (and the ActiveX control lives only on the server),
that's not going to happen. Remoting is not a means for transparently
running a UI on a seperate computer (like X Windows is for UNIX). Instead,
you would have to pass from the server to the client sufficient info for the
client to render the map itself (which would require the client have the
ActiveX control installed).

Ken


[quoted text, click to view]
Hi all,

Is this possible to display a windows form from a remotable object?
I need to create a singlecall server application that gives access to an
instance of MapPoint ActiveX control to its clients. And I also would like
to display a form from the remotable object containing the ActiveX, so I can
see the actual maps being retrieved by the remote clients (for debugging
purposes).

In a sense I need to create an Automation-enabled app, so that I can
interact with it programmatically or via user interface at the same time. Is
this possible with .NET remoting?

Thank you for your input.

Alex

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>HKovllGiZES8Fs6RaJPtYQ==</Id>

Alex O.
9/22/2004 4:05:21 PM
Ken,

Thank you for your response. Sorry for my late follow up - I have not
been able to access this topic's thread thru .NET 247 server since I
posted it! I finally managed to find the thread mirrored on
DevelopersDex server.

OK, let me clarify the issue a little bit.
No, I am not expecting the ActiveX to cross the app domain boundaries
and appear on the client's screen.
What I am looking for is to display the form from the instance of the
remotable object ON THE SERVER'S side.

I need this for debugging purposes to see how client's requests are
being handled (ActiveX has its own user interface, which will display
the progress of operation).

When I create an instance of a form in the remotable object and display
it on the server, I can see the form, but it is "frozen" - no reaction
to local user's actions.

I suspect that the form is not attached to a message loop, and therefore
remains non-responsive.

Is it possible to have windows messages processing on the form launched
from the object, which itself was activated through the remoting?

Thank you.

Alex

*** Sent via Developersdex http://www.developersdex.com ***
Ken Kolda
9/22/2004 4:26:10 PM
If you're displaying the form on the server, you can either:

1) Display it modally from the same thread that is processing the remote
object's method call (which will block the client until the dialog is closed
on the server).
2) Spawn a new thread and display it modally from there.
3) Spawn a new thread and call Application.Run(new MyForm()) to show the
form and start a message loop for it.

I haven't tried any of these but I believe they will work. I think you can
display a modal dialog without explicitly spwaning a message loop (it
creates it own) -- if you go non-modal then you have to start the message
pump yourself.

Hope that helps -
Ken


[quoted text, click to view]

Alex O.
9/26/2004 8:44:29 PM
Hi Ken,

Thanks for your recommendations.
I have actually solved my problem by moving to CAO activation model and
providing a singleton class factory to return instances of remotable
class. Then I create and show a form from that class instance and it
works like a champ - not even needed to be hooked up with a message
loop.

Basically the steps taken in the host server are:

1.Create instance of the remotable singleton object to act as class
factory.
2.Marshall that object.
3.Class factory object provides a method to create another remotable
object, which then launches the form.


Thank you for your help, Ken.

Alex

*** Sent via Developersdex http://www.developersdex.com ***
AddThis Social Bookmark Button