I'd like to run from C# code ANSYS Fluent exe file
And now for comparison, I'll give two examples
Process fluent = Process.Start(#"C:\Program Files\ANSYS Inc\v130\fluent\ntbin\win64\fluent.exe", #"2ddp file.jou");
Process browser = Process.Start("IExplorer.exe", "http://www.google.com");
Why is the browser.ID in C# code the same as in TaskManager? Why is fluent.ID in code different than in TaskManager ?
It's because of Fluent's characteristics or I make some mistake?
And main question: how to run Fluent and catch its ID in C# code?
It's almost certainly something to do with Fluent's characteristics. If you can't get (a relevant) PID out of Process.Start, you might need to resort starting the process, and then going into a wait-loop and attempting to retrieve the process by name (see: Process.GetProcessesByName - I think you'd pass in the EXE's name without the .exe).
Exactly how robust this solution would be depends on how well you can predict Fluent's characteristics, which is already looking quite difficult. I would definitely recommend using Process Explorer (as suggested above), as well as getting familiar with the other SysInternals tools, they give tons of insight in these cases.
Answer Daniel B is ok, but if I need launch several instances of Fluent it doesn't work. So the best solution I found is appropiate CommandLine arguments and then searching in Task Manager
Related
I have been using DDeltaSolution's UIDeskAutomationSpy to enhance some of my Coded UI testing, initially based on the MS Code UI test (cuit) framework.
However there is very limited documentation and even after using dotNetPeek to inspect the internals of the UIDeskAutomationSpy exe and associated dll, I can't see how to send control keys (Shift/Control/Alt) to a component.
There are two relevant methods
SendKeys()
SimulateSendKeys()
but both just take a string as input.
I've even got as far as thinking about trying to use Cecil to try and modify the binaries (is this possible?), but this is a desperate measure. Does anyone know any better, or know of any better documentation?
This is a surprisingly powerful tool, but no-one seems to have heard about it.
I'm not positive, but if I were you I'd try using the list of control key strings found HERE since automation spy is based on .NET. Let me know if it works!
On high level my problem is -
We have couple of applications which have millions of lines of legacy code (C# and SQL). I need to figure out code areas which are being used most?
It may not be possible to find exact figures (especially in apps when code is being called based on user's action in GUI).
However, to get some rough figures few thoughts I have are to find out:
1) Find out List of Classes and Methods
2) Find out number of time they are called from within the code. (by means of direct method calls/delegates etc)
3) Find out all the stored procs/db functions (this would be bit staright forward)
4) Find out all the calls to stored procs
Could you please let me know - if you are aware of any tools to achive this?
Or any other idea to fetch above 4 details? Also, apart from these any other way to to do this analysis?
Thanks in advance!
I have used Red Gate's ANTS Profiler before:
http://www.red-gate.com/products/dotnet-development/ants-performance-profiler/
It's powerful and very easy to use (comes with a visual studio plugin). 14 days free!
One way you could achieve this is using Aspect Oriented Programming (AOP). I have used this previously in Java with the Spring Framework, but haven't used it before on .NET projects.
You could check out something like;
http://blogs.msdn.com/b/morgan/archive/2008/12/18/method-entry-exit-logging.aspx
This will give you an idea of how frequently methods are being called. Your will need simply need to collate the data in the logs into some form giving you an overall idea of usage patterns of the codebase.
Edit:
Further information on using this method can be found on other SO posts;
Logging entry and exit of methods along with parameters automagically?
https://stackoverflow.com/a/25825/685760
I've been looking for a proper way to get file associations working on WinXP and above. The association should be replaced if it already exists. The application I've developed always run in admin mode, so rights shouldn't be a problem.'
I've come across some old posts that had some sample code, but some of them didn't work well enough and some not at all. I'm using this post to make a final desicion on the method I will attempt to use and am looking for as much feedback as possible.
I think you need to make changes to the registry as shown here
http://msdn.microsoft.com/en-us/library/cc144154%28v=vs.85%29.aspx#registration
Anyone know where a computer keeps what parameters it can accept through this function? For example, I'd like to know what I can send to Winword.exe (Microsoft Word). Or is there an online list of what programs work here?
There's no standard means to query available command line parameters in executables. That's why you have to look online for published lists. For example Microsoft Word.
The Process.Start(..) overloaded methods pass various data into the process but cannot extract it because of the proprietary nature how a Process uses this info.
If you started the processes then Process.StartInfo may provide some useful information about how it was started (but does not reflect possibilities), and won't work as intended if you're just grabbing a process from memory that you didn't start.
Although it's customary for many Windows processes to allow /? to produce a list of parameters, and many systems use -help, /help or --help, etc, the output of even those may differ and be tough to consistently parse for discovery purposes.
Here is a list of accepted arguments for winword.exe Args list.
The command line arguments that an application accepts isn't stored anywhere on your hard drive, unless if there's specific documentation that came along with that product. That being said, google will be your best friend for this. Any app you think can be launched from the command line using different parameters, will have some info on the net.
you can either go to your application's help and find it there, or you can ask good old mr. Google to help you. if you are looking for Windows Word's args list, you can search for it on the support page of Microsoft. I believe there might be some changes from version to version.
Unix has a built-in documentation system for this: man pages. This is just one feature of Unix based OSs that shows how programmer-oriented it is (not a bad thing). Another would be the profileration of packaging and dependency systems.
Alas, no such standard exists for Windows.
Creating a call stack diagram
We have just recently been thrown into a big project that requires us to get into the code (duh).
We are using different methods to get acquainted with it, breakpoints etc. However we found that one method is to make a call tree of the application, what is the easiest /fastest way to do this?
By code? Plugins? Manually?
The project is a C# Windows application.
With the static analyzer NDepend, you can obtain a static method call graph, like the one below. Disclaimer: I am one of the developers of the tool
For that you just need to export to the graph the result of a CQLinq code query:
Such a code query, can be generated actually for any method, thanks to the right-click menu illustrated below.
Whenever I start a new job (which is frequently as I am a contractor) I spend two to three days reading through every single source file in the repository, and keep notes against each class in a simple text file. It is quite laborious but it means that you get a really good idea how the project fits together and you have a trusty map when you need to find the class that does somethnig.
Altought I love UML/diagramming when starting a project I, personally, do not find them at all useful when examining existing code.
Not a direct answer to your question, but NDepend is a good tool to get a 100ft view of a codebase, and it enables you to drill down into the relationships between classes (and many other features)
Edit: I believe the Microsoft's CLR Profiler is capable of displaying a call tree for a running application. If that is not sufficient I have left the link I posted below in case you would like to start on a custom solution.
Here is a CodeProject article that might point you in the right direction:
The download offered here is a Visual
Studio 2008 C# project for a simple
utility to list user function call
trees in C# code.
This call tree lister seems to work OK
for my style of coding, but will
likely be unreliable for some other
styles of coding. It is offered here
with two thoughts: first, some
programmers may find it useful as is;
second, I would be appreciative if
someone who is up-to-speed on C#
parsing would upgrade it by
incorporating an accurate C# parser
and turn out an improved utility that
is reliable regardless of coding style
The source code is available for download - perhaps you can use this as a starting point for a custom solution.
You mean something like this: http://erik.doernenburg.com/2008/09/call-graph-visualisation-with-aspectj-and-dot/
Not to be a stuck record, but if I get it running and pause it a few times, and each time capture the call stack, that gives me a real good picture of the call structure that accounts for the most time. It doesn't give me the call structure for things that happen real fast, however.