Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I need to control some third party app which has no API and very limited command line arguments.
So I need to simulate user interaction using .net and C#.
What I need to do:
start the application (this works)
enter string into appropriate edit
fields
press button
extra bonus is to hide app window
Can this be done and how ?
Thank you very much.
EDIT:
What do you think about AutoIt tool ?
You could achieve this using White.
It enables you to programmatically simulate user interaction with Win32, WinForms, WPF, Silverlight and SWT applications. I used it years ago when it first can out to automate some simple smoke tests on a WinForms application with great success.
(Caveat: this is based on my usage a while ago, so it may be slightly different now)
I created some code to launch my application and find a series of controls by name. Once found, each control could be manipulated (e.g. text entered, button clicked, etc...). To find the name of the controls, use something like Spy++ (Win32), UISpy (WinForms) or Snoop (WPF) to inspect the running application.
Theres also the UI Automation API, which, for this task, would be pretty easy to whip up.
This link will give you an idea of the support for each of the control types:UI Automation Control Types.
You can use the control name, caption or resource ID in order to grab its handle, and do what you want.
Clicking a button can be as simple as grabbing the handle and:
AutomationElement control = AutomationElement.FromHandle(controlHandle);
InvokePattern ip = (InvokePattern)control.GetCurrentPattern(InvokePattern.Pattern);
ip.Invoke();
I've had very good success with this on all .net windows, and 99% of controls from the native world
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Short version:
New to writing code.
Need to have every window that is restored or opened to go full screen.
What functions do this? Don't need it fully coded out just the functions and syntax.
Long version for those that want more information:
Ok this is my first post so small bit of background. I am new to coding. The last time I was in a coding class they were showing me Visual Basic 6, and it was new. When I was taking that class I never thought I would need to use it. Now I find myself in a place were I need to learn, so I am learning by doing. I have been using code pieces people post up; then modifying them to do what I want and then deconstructing them to make them work. Because of that I have found out how to make a simple register application for me to use at an art table I setup every few months, and even force the numlock to stay on even if someone turns it off.
I now have a new problem, and this is where I need the help. I need to create a program that runs in the background that will force all windows that are opened after it starts up and all windows that are restored from the task bar to open in full screen.
I have found a power shell script that was posted up to cause all windows to restore in a previous state and I got it to restore to full screen.
I need to know how can I see what application was just opened and then have it force it to open as full.
If you can point me to example of the various pieces I can slap them together and modify them to work for what I need.
I am working in Microsoft Visual Studio 2015.
Hope this is better for you than the first post.
As far as I know, this functionality isn't directly exposed in the .net libraries. You'll have to use these 3 (at least) pinvoke functions: EnumDesktopWindows, IsWindowVisible, and ShowWindow. You need the IsWindowVisible function because there are lots of Windows API hwnds that aren't what you normally think of as windows.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I am writing a game in WinForms, using c#. Well, I absolutely love Visual Studio and WinForms, because coding is very simple, and there is usually no need in any additional content.
The game is text based, but it is also heavily based on UI. But, WinForms has no transparency, and this is something that hurts alot. Interface, labels and pictures are created and positioned dynamically.
I thought about moving to WPF, but I do not know, if i will be able to place controls dynamically in WPF like in WinForms (because WPF is based on grids).
Should I learn more about WPF, or there is any simple WinForms-like analogs, that support transparency and will allow me to create text-based games with UI?
P.S here is image, its QSP game (not mine, but it is something that I want to achieve, but have improved UI, transparent images, and etc.)
Since this is a multi-part question, I will not attempt to address any one specific question but rather provide resources to allow you to embark on learning WPF on your own, and assure you that moving to WPF is a safe choice for converting your application.
I thought about moving to WPF, but I do not know, if i will be able to place controls dynamically in WPF like in WinForms (because WPF is based on grids).
Yes, you can generate, create, and position content dynamically in WPF. See links for example code.
Should I learn more about WPF
Yes, you should learn more about WPF.
or is there any simple WinForms-like analogs, that support transparency and will allow me to create text-based games with UI?
Yes, you can create transparent windows and transparent controls in WPF.
I hope these resources are useful to you.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
I have a win forms application. The form contains a third party chart from dotnetcharting. The form also has a few other controls which allows the user to select the type of chart they wish to see.
The issue I have is when the user clicks the button to plot the chart nothing appears to happen (it is though), so the chart is blank. However when I go to another application, a word document, or web page or whatever and then go back to my win forms application the chart now appears. Why is this?
Is this to do with win forms or the chart? Is there some refresh I need to do?
I think it has to do with the refreshing, please try to put the line:
Application.DoEvents();
after the data is being updated. It should then change the form.
Difficult to say without more information.
Sounds like you have to invalidate the control which sounds odd for a third party control.
Possibly there is a function on the control to tell it to redraw or that you are finished with calculating. Did you check the documentation on usage?
Some controls can be paused from updating the UI to let them handle lots of data and restarted after you finished with the data.
Post some more info on usage and code
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I realize this may be a misplaced question on this forum but most other forums are less that useless!
I've been searching for tutorials on creating a Windows Desktop program, not a Windows Metro/Store app. All I can find is metro and store.
Can someone point me in the right direction for getting started on this? This is what I have chosen in VS2012:
vs2012 new windows empty project
I will eventually be importing an API but for now I want to get working on a GUI layout. Any pointers/clarification would be great.
If you want to create a Windows GUI app, you should use either Windows Forms Application or WPF Application. These are the primary two ways in which Windows desktop applications are created in C#. Note that the controls offered through these are different from one another, and the basic fashion in which the UI is constructed is totally different as well.
Windows Forms is fairly simple, and uses a visual designer to add controls to the form. WPF relies much more strongly on a complex markup based language, XAML, in which the UI is written in code. WPF offers a great deal more options as far as customizing controls and their appearances, but in order to use it to its greatest potential you have to spend a decent amount of time and frustration understanding how binding works within XAML.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have a small simple project on building a clickable interactive map of our school.
The challenge is to create a clickable parcel of map and add an animation
directing the user from point A to B using the given roads/hallways on the map. Moreover, I would like to create a database that allows the user to view the information for that specific parcel of map when clicked.
I'm using C# to program this one. My application is Visual Studio 2010
Example Links:
https://www.youtube.com/watch?v=tbinL2pg5Hs
http://www.wayfinderkiosk.com/
QUESTIONS:
What are the processes(step-by-step) on creating this project?
What applications should I need for programming, database, animating, drawing etc.?
Decide on the platform you will be using: WinForms, WPF, WinRT, ASP... If your project description includes the platform then you know; if not keep the question in mind!
Get your resources. Get the map and a list of all the places you will work with. Also all the extras like the descriptions and photos etc. Get this chore out of the way now. It'll help you to get a feeling for the amount of things you will put into the project.
Know your clients. An older kiosk system runs only only a few kiosks. Today maybe you need/want to have it run on the web and on portable devices. This will make a difference in not just for screen sizes but also in the number of possible routes..
Define user input controls. Keyboard? Mouse? Touch? Which buttons? You need a complete list!
Define the user interactions. Completely. Try to make tables of states the system can go through.
Try to decide on how the path finding should work. This anything but trivial, as soon as you want to include more than a few points.. You can have a set of ready made paths or try to find them or build them from a list of partial paths. This may well be the toughest part of it. Some folks believe in 'Hardest First' other in 'Hardest Last'. I believe that the first thing is to understand the hard parts well enough to get a feeling for them and to decide then.
Well that is really just a start, off the top of my head.
Good luck and have fun!!