Windows Form application run on Windows hosting service - c#

I've created a Windows Forms application that basically contains an HttpListener which launch a Form for each request. I have to show forms server side because I have to take a snapshot of what it's shown on the screen to send it to the client.
I've also made a asp.net web application in which I show those images sent from the HttpListener who act as a server.
Everything works fine on my machine but now that I must deploy it on my company's website I dont know how to do it, anyone has a solution? I haven't remote control on server, I can just upload files inside using FTP.
What if I create a page inside my web application to launch the exe file? Any suggestion is really welcome!

I'm definitely no OpenGL expert but I believe that its possible to use OpenGL to render a scene without displaying it to a screen. Some preliminary research indicates that "pbuffers" allow you to render an image to a texture (which would presumably then allow for programatic access).
Can i save an OpenGL scene as an image without showing it?
Note that using OpenGL probably depends on the server machine having a suitable graphics card. As most servers don't come with very capable graphics card (some servers don't come with any graphics card) this is definitely something that you should check beforehand.

Related

How can I take screenshots from a background process?

I want to set up a system whereby anyone logged onto a machine on our local network can see what's on the screen of any other machine on the local network. This is part of a peer-monitoring programme, and is with the agreement of all users.
All machines are running Windows 7 or 10. Ideally, I would like it that someone using an iPad could also see the screens.
My initial thought was to install IIS on each machine, and have a web site that would capture the screen and return it on request. That way, a user at another machine could just browse to http://machinename/ and see the screenshots. This would work for desktop machines and iPads.
However, I discovered that you can't access the screen that way, so that idea is out. Similarly, it seems that a Windows service can't access the screen either.
What options do I have? I want something that can be installed once for all users, and show what's on the screen(s) attached to that machine.
Like a lot of similar questions out there, a simple solution requires just some basic understanding of how Windows session isolation works, detailed in posts like this.
As you want to capture screenshots, your code must run in the same user session. Then any sample code you find from search engines will work flawlessly.
Many existing screen capture solutions are built upon this simple approach, and usually have a Windows tray app that launches when a user logs in, which prepares the screen shots by calling the capture API.
You cannot use a Windows service or a web app on IIS to call the capture API, because they run in session 0, not that user session.
Behind the scene, other necessary components are there to dispatch the screen shots to a centralized backend server (so that they can then be sent to the monitoring device).
Note that for this part multiple approaches/architectures can be used, so I won't share too much to restrict your imagination.

How to open a webpage on a local computer outside of its hosted RDP connection?

I would like to know if there is a technique or solution for the follow problem.
I have a software application that is currently running inside of a Microsoft RDP session. I have some help resources built into it in which some of them open up on a webbrowser. Some of them are YouTube videos. The problem is taht through organisational policies, they cannot open YouTube clips within the RDP which connects to a interstate server.
What I would like to do is instead open up a webpage outside of that RDP connection on the local host computer instead, which does not have any restrictions like opening up YouTube webpage to play video clips.
Can you please suggest a technique, utility or solution to this problem?
Thanks,
Colin.
The nicest way to do this would probably be to create a dynamic virtual channel plugin for RDP: https://msdn.microsoft.com/en-us/library/bb540859(v=vs.85).aspx
You would have a server-side component registered to handle the protocols (http/https, I assume) you want to redirect back to the client, possibly with some filtering logic if you still want a few to run server-side (such as intranet sites); then a client-side mstsc plugin whose only job is to call ShellExecute on the URLs you pass back.
Piggybacking on clipboard redirection might be less code, but it obviously has side-effects - e.g it obliterates anything else the user might have had on the clipboard.

view the GUI of a .net application on remote pc (no remote desktop or vnc etc.)

I read several articles but didn't get an understanding regarding WCF (or remoting or ...).
I have written a .NET 4.0 WinForms application running on one PC where a user is making inputs.
I would like to display the GUI of the application on a second PC.
No inputs on the second PC, just viewing the application.
How might this be possible? (WCF or no WCF?)
(controlling the whole PC with remote desktop or vnc is no option)
Thanks a lot for any suggestions,
Ralf
You could make the main application expose a WCF service and have a second view application consume the service to view the data.
If viewing the area of the screen the application resides in is an option, my library RemoteViewing may be sufficient for you.
The included example server (it includes both client and server VNC) is read-only.
In the example server, instead of passing a Screen as a second argument to VncScreenFramebufferSource's constructor (that will capture the entire screen), provide a callback to the screen rectangle containing the application. That should be all you need.

Getting my asp.net webpage to find a connected camera, then stream to a Bitmap constructor

I need my asp.net web form (C# code-behind) to find a connected camera (phone or computer), then stream the data to a Bitmap constructor.
Bitmap myBitmap = new Bitmap(Stream streamFromCam);
// Will then process this stream looking for a QR Code using the .NET Barcode
// scanner .dll I've integrated into my project. This part I can do.
Is this achievable?
If so, how?
If the camera is connected to the web server that is running your web application, then yes, it is doable from the code-behind. If you're asking if it is achievable on a remote client with a camera connected, then the answer is yes and no. Yes, you can still do it, no you can't do it from code behind. You would need some Silverlight/flash component to accomplish this... Or ActiveX... or Browser Plug-in, but you can't do it from code-behind. Code behind runs on the server, not the client and devices connected to the client are not accessible via the server side code.
Well, short answer no. Long answer, yes, sort of, but you're not going to like how.
First, I'm going on the assumption that you want to find a camera on the user's computer, not on the server hosting your page. That kind of thing is not accessible in the browser without installing additional software. You would have to get the user to download a program that reads data from their webcam and uploads it to a Web Service.
Doing that is a whole project in itself, and won't fit into a Stack Overflow response.

Thoughts about using Silverlight In Desktop Apps?

To summarize, as we all know,
a) Silverlight is expected to be hosted by a browser, and runs in an isolated sandbox so that there won’t be any security issues
Silverlight don’t have direct access
to the file system, other than the
isolated storage area
There is no
direct way to open common dialog
boxes like File Save in Silverlight (Though Opendialog box is supported).
b) Silverlight can’t access local resources like a printer
What are the ways to go beyond the sandbox, so that I can host a Silverlight application locally, to read files and save them back if required, to hand over data to a printer, and so on..
Update:
Is full WPF is not an option for me? No. I'm also interested in a cross platform solution - for instance, you could host Silverlight in Mono Web browser control, so that you can run it virtually anywhere.
The idea is to re-use the same application that I'm building for web in my desktop as well, by providing separation of concerns at some areas - like persistence, resource access etc.
Scenarios:
1- Some kind of gadget container, with access to local resources.
2 - A desktop Silver light based media application
Update:
I just did a POC to enable me to access printer and save files locally, of course through a shell where I'm hosting my Silverlight application. If you wan't you can have a look at the post here in my blog
Two ways I can think about is,
Create a "Shell"
Host the HTML Page with Silverlight, in a Winforms desktop application, using a web browser control, and communicate to and fro using HTML DOM. Then I can request the hosted shell to do things like printing. See details here
Mono also has a web browser control - based on FireFox XULRunner instead of IE - not yet succeeded in loading Silverlight inside that. Another option might be using Webkit.
Embed a web server
Embed a light weight web server with in the Host application, and handle requests to perform such operations. You can probably define a protocol on top of HTTP for things like saving to a local folder, sending data to print etc.
Is a full WPF application not an option for your situation?
As you probably know Silverlight uses a subset of WPF so you may be able to change your application relatively easy.
A wpf app would be easier than having a web server etc bundled within your application.
You wont in the foreseeable future be able to have access to resources such as printer and files (apart from isolated storage) through Silverlight as you know.
You could have a seperate part of your app to upload files to the webserver then read these in your silverlight app from a service.
Depending on your printing requirements (e.g. if you just want to send everything to an office printer) you could send the informaton you wanted printed to a service that will then print it for you. However I am guessing you want each client machine to be able to print in which case this wont work for you.
I am attempting to also reuse a codebase for both desktop and silverlight. There are two options that I know of in addition to the ones mentioned
If you directly reference (instead of a project reference) a silverlight dll from a normal project, it should work. This would let you reference a silverlight dll for both projects.
Have two project files (one wpf, one silverlight) that point to the same set of files. You might have to have to use a few compiler flags here and there, but this should let you use the same files for both.

Categories

Resources