how to show some info on secondary monitor in C# WPF? - c#

i have some info that store in DB that should be displays some info about path destination and buses on secondary monitors in passenger terminal waiting rooms
now how can i doing this in c# wpf application?
does it need to design any form and than reflect to monitors or it could be done programmatically? or another way...
i am beginner in this scenario

You can split your application in two executables: The first one to insert data in the database. The second one to display info in secundary monitor, reading the information saved on the database.
The two application can run on same machine or separeted ones. If you can use a dedicated machine you can just run you second app on startup and then send computer output to secundary monitor.
If you need to run then on same machine you should have two videocard on that computer and use them as extended displays. The find a way to send specific app to specific screen. Hope it helps you.

Related

How can I uniquely identify a monitor?

I am trying to write a program for re-configuring displays in the cases where a display loses connection, and Windows is not able to correctly reconfigure its prior settings.
Usually if you unplug a monitor, Windows seems to keep track of configuration settings for the display. Example, I have three monitors hooked up right now. If I unplug my "main display", Windows will make one of the remaining two monitors the main display. Then if I reconnect the monitor, Windows will usually remember the configuration for that monitor, specifically in this case that it was my main display, and set it appropriately.
I am currently using EnumDisplayDevices, EnumDisplaySettings, and ChangeDisplaySettingsEx to set the configurations for each monitor (resolution, orientation, etc). However, looking at what information EnumDisplayDevices and EnumDisplaySettings populate the DISPLAY_DEVICE and DEVMODE structs with, nothing seems to be able to uniquely identify the monitors themselves. I'll get values that will uniquely identify each display from each other for the current configuration (\.\DISPLAY1 and \.\DISPLAY2 \.\DISPLAY3, for example), but if I unplug the monitor that had the identifier \.\DISPLAY1, next time running I'll get the values \.\DISPLAY1 and \.\DISPLAY2. So that value can't be used to unqiuely identify a specific monitor later on.
Is there some piece of unique information about each monitor hooked up that I can use to identify them? My feeling that such a piece of information might exist comes from the fact that most of the time if I unplug a monitor and plug it back in, Windows will retain its configuration.
The wmimonitorid class accesses more H/W specific data than EnumDisplaySettings, in particular, the SerialNumberID which should be unique (at the very least) to the entire range of monitors from a specific mfg.
The field is a Uint16 array, so can be read in with code similar to that provided in this answer.
Also try DeviceID in the Win32-PNPEntity class, for PnP monitors. Can be retrieved in a WMI query based on pseudo code like:
SELECT * FROM Win32_PnPEntity WHERE ClassGuid={4d36e96e-e325-11ce-bfc1-08002be10318}

Synchronizing data between different computers through my application

I'm create a product management application that runs on different networked computers via a MySQL database written in C # (WPF). So I intend to keep the data of computers all synchronized in ways that if a user delete a product, it disappears on all computers, or if a change in a product is made, it is applied on all machines with open application. But I have not achieved good results, I download the data using an observable collie as a source, and whenever I want to have updated data on a machine, I have to close the window and return to reopen it, the time-consuming and hates user. Could anyone tell me how to solve this problem? What should I do or study? What are the key words for me to search about and solve my problem?

Window CE 4.2 - Enumerating through the controls of a different running process

I have been charged with the task to send data from COM 1 to COM 2 in Windows CE 4.2. A running application takes data from COM 1 and displays it to the user in a form (textbox I assume). I then have to take that data and send it out COM 2. COM 1 is being used by the program displaying the data and I know of no way to hijack COM 1.
I figure trying to do a screen scrap would be the next step. Unfortunately this is compact framework and an old version at that and from a lot of research it seems managed code is out of the question . Many of the API functions I would use are not available; FindWindowEx for example.
Here is where I am at now. I have created two projects. One runs with a TextBox and some wording. A separate application runs and tries to read the text in that TextBox. I have been able to find the running process based off the name of the form using FindWindow API. Using code I have found on this site I have even been able to enumerate through the controls of the form. However my TextBox is never found and many of the controls that are found where never placed on the form by myself (listbox, button). I assume those are the form's initial controls.
Does anyone have any experience with this? Currently this is in C# but VB or Visual C++ will be fine. Even if you have any ideas on a third party application. BTW I am not given the option to upgrade to a higher version of compact framework.
Thank you.
An update I just found out about. It does not look like I only screen scrape only new data but instead have to screen scrape the entire screen and send it out COM2. Someone will scan a barcode and I will send out all screen data through COM2. The data may include a picture etc.
For a native C application I have one sceleton that enumerates all child windows and controls inside a dialog: http://code.google.com/p/rdp-auto-login/source/browse/trunk/rdp-auto-login/tscDialog.cpp. See ScanTSCWindow and the results found in the comment "TSC dialog elements".
I started with remote spy and looked thru the RDM window to find the CtrlID values. There is also a nice tool called zDump (http://www.hjgode.de/wp/2009/06/11/zdump-take-a-look-inside-windows-ce/) that runs on device and enables you to look at window elements.
The theory is that every element in Windows (either Mobile or desktop) is a window. Windows are accesible by there window handle. The handle is assign by the OS during CreateWindow/Ex. Inside dialogs, elements can be identified by there control ID (a resource value), the window class (ie "EDIT", "LISTBOX") and window text and internally by the window handle at creation.
The problem with Compact Framework apps is that they hide many of these basics and dialog (Form) elements can not be easily identified from another process.
As you say you are not able to capture COM1, what is, if you stop the application and then open COM1? As knonw, normally on one application can access a serial port at the same time. You can then read the serial data directly and do not need to access a foreign window.
There are also drivers that enable port mirroring or multiple access. Even for Windows CE based OS (ie http://www.virtual-serial-port.org/products/serial-splitter-mobile/).
If the application is a compact framework one you can take a look inside the code using .Net Reflector or similar .Net decompilers. I use that often to mimik or learn from other apps.
You say "I have been charged with the task to send data from COM 1 to COM 2 in Windows CE 4.2. A running application takes data from COM 1 and displays it to the user in a form (textbox I assume). I then have to take that data and send it out COM 2. COM 1 is being used by the program displaying the data and I know of no way to hijack COM 1." and if you do not start the other app you can write your own and do not need to parse the foreign app.
Possibly you can post the other app or more details of what it does what you can not do.
EDIT/UPDATE:
as we now know it is Intermec TE2000 (terminal emulation) the answer is to use the XMLRPC interface provided by TE2000. The interface is able to call back a function hosted by an xmlrpc server and send all screen content (text, fields and attributes) on screen changes. I have working c++ stl windowsce code for that.
If the device is connected via network, the xmlrpc server can even run on a PC.
As TE2000 does use native drwastring API you will not success in reading texts from the window. If you screen capture the window, you will have to do OCR on the image. XMLRPC does avoid all this.
UPDATE2:
I finished a class lib to get async screen updates using TE2000 xmlrpc: see https://github.com/hjgode/ITE_xml_rpc/tree/master/XmlRpcCS/XmlRpcCF
and http://community.intermec.com/t5/Thin-Client-Based-Development/Printing-CV60-Screen-Windows-CE-4-2/m-p/28663/highlight/false#M473

Get data back from a windows Process to winform

I'm new here and it's a first time that i ask for help to the community. I'm also new in C sharp but i try to manage and learn on the way.
I would like to have some help to understand how to write a Process for windows with wich i can communicate with my winform.
i made an winform application which permit me to retrive some data from Active directory and also some other data from computers on the network "using powerShell" and a AD class.
For some reasons i can't grab a correct information about ex: shared Printers, cose the PowerShell give me a output of the computer printers, not user printers. It was a simple exemple.
so i decide to write a Process wich i want to upload and install on a remote computer, till here i can manage that.
what i would like to understand and if you can show me a little exemple, it's how to add some functions to this process and get the output of this function back to my Winform.
as exemple:
1.in my Winform a make a remote call to the process and ask him to give me the list of all printers installed.
2. show the output in a lisbox for exemple.
I would like to tell you thank you in advance for you help

Appropriate programming design questions

I have a few questions on good programming design. I'm going to first describe the project I'm building so you are better equipped to help me out.
I am coding a Remote Assistance Tool similar to TeamViewer, Microsoft Remote Desktop, CrossLoop. It will incorporate concepts like UDP networking (using Lidgren networking library), NAT traversal (since many computers are invisible behind routers nowadays), Mirror Drivers (using DFMirage's Mirror Driver (http://www.demoforge.com/dfmirage.htm) for realtime screen grabbing on the remote computer).
That being said, this program has a concept of being a client-server architecture, but I made only one program with both the functionality of client and server. That way, when the user runs my program, they can switch between giving assistance and receiving assistance without having to download a separate client or server module.
I have a Windows Form that allows the user to choose between giving assistance and receiving assistance. I have another Windows Form for a file explorer module. I have another Windows Form for a chat module. I have another Windows Form form for a registry editor module. I have another Windows Form for the live control module. So I've got a Form for each module, which raises the first question:
1. Should I process module-specific commands inside the code of the respective Windows Form? Meaning, let's say I get a command with some data that enumerates the remote user's files for a specific directory. Obviously, I would have to update this on the File Explorer Windows Form and add the entries to the ListView. Should I be processing this code inside the Windows Form though? Or should I be handling this in another class (although I have to eventually pass the data to the Form to draw, of course). Or is it like a hybrid in which I process most of the data in another class and pass the final result to the Form to draw?
So I've got like 5-6 forms, one for each module. The user starts up my program, enters the remote machine's ID (not IP, ID, because we are registering with an intermediary server to enable NAT traversal), their password, and connects. Now let's suppose the connection is successful. Then the user is presented with a form with all the different modules. So he can open up a File Explorer, or he can mess with the Registry Editor, or he can choose to Chat with his buddy. So now the program is sort of idle, just waiting for the user to do something. If the user opens up Live Control, then the program will be spending most of it's time receiving packets from the remote machine and drawing them to the form to provide a 'live' view.
2. Second design question. A spin off question #1. How would I pass module-specific commands to their respective Windows Forms? What I mean is, I have a class like "NetworkHandler.cs" that checks for messages from the remote machine. NetworkHandler.cs is a static class globally accessible. So let's say I get a command that enumerates the remote user's files for a specific directory. How would I "give" that command to the File Explorer Form. I was thinking of making an OnCommandReceivedEvent inside NetworkHandler, and having each form register to that event. When the NetworkHandler received a command, it would raise the event, all forms would check it to see if it was relevant, and the appropriate form would take action. Is this an appropriate/the best solution available?
3. The networking library I'm using, Lidgren, provides two options for checking networking messages. One can either poll ReadMessage() to return null or a message, or one can use an AutoResetEvent OnMessageReceived (I'm guessing this is like an event). Which one is more appropriate?
Put as little code as possible in the form. You should create a seperate class/set of classes to handle this and make the form use them to draw.
An event seems like a good idea. I wouldn't let the form subscribe, but have another class do the processing and just pass the processed data to the form (through another event).
I would use the event, because it probably checks async, which is what you want. You do not want to lock the form while waiting on messages.

Categories