How to stream a WPF window content to another computer - wpf

Does anyone know how a WPF window's view area can be streamed to remote computers? e.g. Can someone use a web browser and point to an address whereby this address shows the content of this WPF application?
This is somewhat like maybe desktop sharing but just over a small estate, which is the window's viewable area.

Well you didn't really explain what exactly you trying to accomplish which makes it hard to understand.
"Streaming" the content of window comes in a few flavors and has limited uses.
Typically its way more efficient to share data not how it presented. That said here are some common ones.
For example Cicso's WebEx allows you to share your desktop or a single application in the context of a conference call.
Citrix XenApp allows you to deliver an applicaiton to a client that's installed on the server (thin client).
You could also use Windows Media Encoder (which has an SDK) to capture an encode the contents of an application. However this is usually done as part of a demonstation and not in a "live context"

Related

Winform desktop app and touch

I`ve a legacy winform desktop app that works perfectly with mouse and keyboard. It has some selfmade controls that involve the creation of threads and so on, for example the longer a button is pushed the faster a number is incremented.
The application also uses a win32 dll. Now, the client wants that application to be touch enabled and run it in a tablet, which also means resizing and rotation capabilities.
My question is, which is the better way to get that application touch enabled and responsive design?
I can try to modify the existing winform, but I think it will be lot of work with poor results. I can also migrate to WPF and reuse the c# code, but I might have trouble with the keyboard, as I have not found a good way to show the keyboard and maintain the whole app on the screen. Or I can migrate to windows store app, but with the problem of that win32 dll, that I`m not sure it could be migrated.
The winform application is multilingual so creating a keyboard is not a valid option.
If the target is touch screen, then for sure the best option would be a Windows Store App, although there are several limitations.
If you are not going to publish this application in Windows Store, then you should be able to use all WinAPI functions. (I'm not sure what is win32.dll - if it's your own dll then it can be a problem).

Is there are any loading speed difference between Page and Window in WPF?

I want to load 10 000 items in a DataGrid in WPF. When using a Window control the data loads faster than when using a Page control. Can someone explain why?
Pages are intended for use in Navigation applications (usually with
Back and Forward buttons, e.g. Internet Explorer). Pages must be
hosted in a NavigationWindow or a Frame
Windows are just normal WPF application Windows [lnk]
This is essentially an XBAP vs ClickOnce problem. Anything in a Page is compiled for and restricted by what WPF is permitted to do in a browser window. This precludes many low level computer operations that WPF Windows can get away with because they are compiled to run from the desktop. Window apps have full access to system resources.
Keep in mind that when you use a Page control, even during debugging, the generated code is build with a browser deployment in mind. All XBAPs are run in a restrictive security sandbox under partial trust. In other words, they are allowed to use certain .NET libraries but banned from accessing others. [ref] Some of these .NET libraries will be responsible for optimizations that therefore can't achieved in a browser deployment.
As such, it makes perfect sense that applications build in Windows would be able to perform most operations faster than apps built in Pages.

How to control MFC application from another program?

I have a binary application on windows (train timetable software) which contains a lot of interresting data which I need for my project (nothing illegal, just some weird optimization algorithm). But the application has no api and the data files have undocumented binary form.
So my idea is to control the application from my own code. I would like to send keystrokes to it to fill a form, run query and save result to a file (there are buttons and menu items for this in the app). And repeat many times.
Is there a library for this? Or an example? I have a general idea how to do it, but I am lazy and I do not want to invent the wheel.
Also, the same data is available on the web. Is there some solution for the same task with ASP (Win forms) web applications? I could probably handle parsing the results but I do not know how to fill the values of webforms controls.
Thanks in advance.
You can use simple Win32 APIs to do this.
FindWindowEx and then once you have the window handle you can send any message (such as WM_KEYDOWN) to it by using SendMessage.
A good tool which helps with this process is Spy++ because it allows you to see the window hierarchy more easily and also which messages are being used internally for the application you are monitoring.
As for web form controls, you will probably have to do more work than this because typically the web will be one canvas control that things are drawn custom onto depending on the browser. Perhaps doing this via some kind of proxy is a better approach where you actually filter the HTML pages.

Is it possible to build a WinForm app (or another type of .NET app) which allows me to interact with other windows outside the applicaiton itself?

I'm learning Chinese at the moment and I have gotten my hand on a Chinese dictionary definition.
Now I would like to make an interface.
All I really want the application to do is when I point my mouse pointer over any text on the screen (in any window), it would identify the text I am pointing at and then display a small form over it, which would the chinese transaction.
Is that possible to do? Can WinForms apps interact with windows outside of it's own application?
In C# you can get text under mouse cursor by P/Invoking
GetCursorPos
GetClassName
SendMessage
WM_GETTEXT
WM_GETTEXTLENGTH
WindowFromPoint
Like mentioned here
here is another example in C++
A WinForms application can interact with the Windows of other applications. Window handles exist in a global namespace so if you can get the handle of another application's window you can send it messages. You will have to use pinvoke to do some of this, have a look at WindowFromPoint
However, there is no standardized way to display text in a window; there are dozens of APIs for displaying text. So when you point at text with a mouse, you can only get the pixels, but not necessarily the text.
Some window classes will allow you to send class-specific messages query for the text at a specific location, but many will not. Your best bet is probably to use the same methods that screen readers for the blind use http://en.wikipedia.org/wiki/Screen_reader

Can I re-use a Silverlight app in different areas of my page?

I've got a single Silverlight app that I'd like to display in a grid. The way the Silverlight app displays its content is dependent on the unique ID of the record in each grid row. Unfortunately, the XAP file is re-downloaded for each row in the grid. With a size of 700KB, this really impacts performance. Is it possible to download the XAP file once and then just re-use it for each row in the grid?
Once a XAP is downloaded Silverlight will cache the assemblies etc locally per instance of a Silverlight control. If you create another instance of a Silverlight control then this in turn has it's own domain that it in turn looks after.
My suggestion is to abstract out the parts you requrie and bake them into a seperate xaml, then load them into areas where you need them the most. If you still require a central .xap to handle the marshalling / event management etc then in Silverlight 3 we've put in place a Local Connection API which allows other Silverlight instances to talk to one another within the one browser page locally (ie SilverlighA can talk to SilverlightB all within index.html)
This can then allow you to establish a sort of local proxy if you will.
Scott Barnes / Rich Platforms Product Manager / Microsoft.
I'm not sure you can. Theoretically it should be cached, but in this case theory don't seem worth squat.
It's all down to the way the < object > tag behaves with it's various params and this is (another) one of the "sparsely" documented areas of silverlight.
It is possible but not easy to do. You could download the xap and save it to IsolatedStorage and create a silverlight host each time you need one referencing your cached xap but you only have 1MB space available and you aren't guaranteed that if you have other silverlight apps from the same domain.
Given what you described I still don't see any value in doing what you want to do. I think you have it backwards.

Resources