[C#/VB.NET]Communicating with closed source WPF Application - c#

I've got a question regarding communcation with another application. I wrote a little application that checks if specific persons play a specific game (League of Legends) and if so, it creates something called the spectator code which looks like this:
"C:\Riot Games\League of Legends\RADS\solutions\lol_game_client_sln\releases\0.0.1.15\deploy\League of Legends.exe" "8394" "LoLLauncher.exe" "" "spectator spectator.eu.lol.riotgames.com:8088 nQCxZ8ayLm369T1DwEejG/QlEoR+JyZK 1407774989 EUW1"
In another application which is NOT developed by me called "BaronReplays" (http://puu.sh/7VBFj.png) (a WPF application) you can enter this code under File (http://puu.sh/7VBEM.jpg) -> Analyze Command and enter the Code (http://puu.sh/7VBGD.png), after that click ok. Then this game will be recorded. I want to automate the process of entering this code in my application, so that my application sends the code to BaronReplays (without it being maximized and using SendKeys). I tried SendMessage, but that didn't work out because the keys aren't recognized by BaronReplays... Do you think there's any other way to do what I want to do?

There is another way... As the WPF application is coded with the .NET framework, it is compiled to MSIL (Microsoft Intermediate Language). This means you can use a decompiler such as ILSpy to decompile and view the code of BaronReplays. This will give you some idea of how BaronReplays works so you can implement the same ideas into your own code project...
Hope this helped!
Rodit

Related

How to communicate between two different applications (Web Application and Console Application) using Ctr+c , Ctr+v , Entre [duplicate]

I am developing a console application in C#, and was wondering if there was a way to get the "copy-paste" or "mark-paste" functionality into my application, similar or identical to that of the standard Windows command prompt. Is this a wild goose chase or a simple application variable?
I've copied text from the Console window and pasted it into another source many times.
It's there as default in a Console application;
Right click the console border:
Select Edit > Mark:
Drag over the text you want using the mouse (Or use the arrow keys) to select the text you want:
Again, right click on the console border and select Edit > Copy:
From here you can paste it into another application as you would with any other text.
This was taken from a C# Console application and the only code entered was the command to write to the console, no settings were changed.
Hope this helps!
Thank you Sean for making me realize the complete idiocy of this question. Let me be an example to others to not jump on the conclusion train.
Sean pointed out that "copy-paste can be done using cmd.exe's built-in functionality", making me recognize that, yes, absolutely duh, when you run your command line application in Windows it already has this functionality available.
I erred by jumping to conclusions, for I was doing all my initial testing with the DEBUG execution through the IDE, and vshost does not give you that functionality.
A quick "Start Without Debugging" revealed my short-sightedness.
I don't know why this isn't included in any answer, but as Robert H. stated in a comment, this is absolutely useful information, in case you came here by searching for this problem in a VisualStudio environment:
Run a console app in the debugger (F5). You cannot copy or paste.
Run it outside the debugger (Control + F5). Now, you can copy and paste.
Worked like a charm for me. Thanks Robert H.!
To clarify, is the default command prompt behavior not working at all for you, or just not how you want it to?
From what I understand, it is the terminal implementation that supplies the copy/paste behavior, and what it provides doesn't match rest of Windows. To change this behavior, you'd have to switch the program that implements the terminal. Here are a couple programs that come up on a google search for "command prompt replacement":
http://www.powercmd.com/
http://sourceforge.net/projects/console/
Of those two, I think one of my friends at work tried "Console". It did enough of what he wanted that he didn't feel the need to keep looking.
If you just want your output for this specific program to work more like the rest of Windows, your other choice is to make it a Windows program.
Edit: Fixed the URL to Console. Was posting to someone's blog that linked to it, before :)
Maybe I am late but there is a shortcut for pasting text in Console Window in c#. Press Alt+Space then 'E' then 'P' and there you have your text pasted in the Console Window

How can I place a Desktop App shortcut on the Windows 8 Start screen without using an installer?

My Desktop Application is just a single exe file. For reasons that aren't important, I can't use an installer which would add an icon to the Windows 8 Start screen. Can one be added programatically with C#?
Thanks
If you right click on the exe you can click pin-to start
This worked for my example in the image, which is a stand-alone exe without any sort of installation. It will then appear on the start bar.
Hope this helps.
EDIT: I realized after that you said programmatically.
It looks like a link to the start page is put in C:\Users[UserName]\AppData\Roaming\Microsoft\Windows\Start Menu\Programs
So perhaps you could tell it to deposit a short cut there?
EDIT 2 this previous question may also be helpful: Creating application shortcut in a directory. It is in C#
Take a look at the code samples for enabling desktop notifications, a prerequisite of which is the existence of a shortcut installed to the Start screen. The sample is C++ w/COM, but you should be able to incorporate this small bit into a C# app (or rewrite the sample code in C# directly).

User Click Tracking Library for Desktop App

We are looking into the possibility of allowing users to opt into a program where they report what button clicks etc. they do, and I was wondering if anyone can suggest a good library which already does this. Based on the way the app is implemented, we have access to the base "Button" class and can add code on the click which records the fact that the button was clicked.
What we're looking for is a library which can record all these clicks, store them locally, and then send them to us at some point in the future when the user has internet access.
Does something like this exist in an open or closed form?
Thanks,
Liron
Our app can run code in either c# or javascript, since it runs in Unity3d, but we have other desktop apps which are pure c# and would prefer a library we can run across all our applications.
We ended up going with DeskMetrics, which seemed like a good fit for our needs. We also looked at TrackerBird which has some nice features which weren't necessary for our particular requirement and wasn't working within the limited requirements of Unity3d.

c#- what steps do i have to go through to convert winform app into console

i have a very simple winforms application.
i do not use the forms object at all. i would like to know what i need to delete or change in order to convert this app to a console. i mainly just need to get rid of all the unneeded references and such
please let me know what steps i should take to do this?
It really depends on how did you code it at first and what pattern are you using. If you have made clear distinctions of what is the back-end and what's not, then you would only have to create a new class to act as the program's Main and change the project's Application Typeand the Startup Object in the project's properties.
If you have all the back-end code intertwined with the winforms then you first need to separate them and then proceed to with the above steps.
You can change the project settings to create a Console Application instead of a Windows Application (just hit Ctrl+Enter on the project in the Solution Window, and make that change).
That will compile the application as a Console Application, and you'll get a console. However, you'll still get your forms. If you want to not have Windows Forms, you'll need to remove the forms, and replace their functionality with command line arguments or configuration. You can then remove the Windows Forms references, and it'll be converted.
Create console app and move the simple code over

C# Making a Frontend to a Console Program?

I wrote a console program in c# that takes up to three files as input, and does some data calculations on them.
I'd like to make a simple frontend that allows the user to easily
import files - basically choose up to three files to be routed to the backend code
change settings - I have about 10 settings that I'm currently storing in an app.config file. maybe a simple settings box would be nice
see what's going on - the console program shows some status messages that might be useful to display on a GUI
I have practically no experience with windows forms or GUI design, so I really don't know where to begin. I compiled the backend stuff into a *.dll and am currently playing around in design mode of sharpdevelop...but i really have no idea how to get the two to work together.
any pointers would be greatly appreciated!
The usual pattern, in cases like these, is to make the main features of the application into a class library and call that from a wrapping executable, such as a console app, winforms app or webforms app (if possible). That way you can easily adapt the interface as needed and simply route input and output to and from the class library.
Edit: I realize this isn't a very indepth answer, but I hope it helps to get started at least, together with any other answer that may arrive.
If you want to get started with GUI design in .NET, I recommend you choose WPF (Windows Presentation Foundation). This is the latest technology released in the UI/graphics area by Microsoft and is where everything is heading now. (Windows Forms won't be obsolete for a long time, though it is surely but slowly becoming deprecated.) I noticed however that you are using SharpDevelop, which doesn't yet have real support for WPF (as far as I know), whereas it certainly does for WinForms. If there's any chance you can use Visual Studio, I recommend you begin by learning WPF. You have the advantage of not being confused by previous experience with the styles and methodologies of WinForms, so it would very much be the right way to go.
Whichever you wish to learn, the Getting Started page of WindowsClient.NET (the official MS site for both WinForms and WPF) would be a great resource. There's also a few MSDN articles on getting started with WPF.
Hope that helps.
Have you tried Visual Studio Express editions? They're free and come with a designer for either WinForms or WPF applications.
As a first pass you'll need 3 text areas for the filenames, with associated buttons to bring up the file open dialog (it doesn't actually open the file just returns the filename).
A label to display the status - updated from your worker code.
Then either the various radio buttons, check boxes etc for your configuration settings.
Oh and don't forget the "Start" button to set off your process.
If your process takes a while you ought to use a background worker thread. You can then implement a "Cancel" button to safely abort the process and tidy up if it goes wrong.
There will be optimisations and reorganisations that you can do once you've got it working.
Your question is quite indistinct. If you're asking about working with GUI, you should read some book on Windows Forms.
And if you're asking about how to put your dll in your new windows forms application, then you should just add a reference to it in winforms project's properties and then use classes from dll's namespace.

Categories