Auto Form Fill for Windows Application - c#

Detecting text fields are a common job in Form Fillers for browsers.
Is there a way to detect text fields and labels in an windows application using C++ or C#?
I want to write an Auto Form Filler for windows applications.

Taking abmv's answer further, there are several tools for this, some for .NET, too:
Windows Forms Spy
.NET Control Inspector
ManagedSpy in MSDN Magazine of April 2006
Hawkeye
Spy++ itself can be found on Microsoft's website, the source code seems to be not available, but a similar tool has source code.

Try a tool like SPY++ you can see that it can detect lables

Related

How can I make a menu-like form stay on the screen, on top of all other apps?

I want to make a menubar like window taskbar in C# but I'm wondering how can I make the form stay on the top of the screen and other program will not taped over it just like the window taskbar and when the mouse hover on a icon it will show a form like this:
I have made it like this:
And This is what I want
Windows has a facility for this, allowing you to basically create pseudo-taskbars that dock to the side of the screen and are always visible. It was used by the Office team (possibly publically documented for the Office team?) a long, long time ago to create a desktop toolbar.
Anyway, they are called Application Desktop Toolbars (or "AppBars"), and the documentation is here. To register one, you call the SHAppBarMessage function with the ABM_NEW message. Complete sample code is available in the linked documentation, unfortunately it is in C++.
To use this from a C# application, you will have to P/Invoke. As far as I know, it is not wrapped by the .NET Framework anywhere, probably because it never gets used by anyone anymore. This CodeProject article appears to have the necessary P/Invoke definitions written out. I can't vouch for their correctness, but armed with the documentation and that as an example, you should be able to cook up a working demo.
There is another CodeProject article here, written by Arik Poznanski as part of a series on using shell features from C#. It looks much more thorough, probably more than you need.
Set the property Form.TopMost unless you have other programs creating topmost windows. Doh!

Allowing user to print specific pages in C# WPF FlowDocument Application

The box above is what is called when a print() method is initiated on a flowDocumentPageViewer of flowDocumentScrollViewer.
In My application, I want my users to be able to select specific page range to print but the options seems to be disabled in the printbox. is there a way I can activate this in code.
Help will be appreciated as this tied to to a project I am doing.
After alot of surfing the internet with no answer, I decided to check out my Library, my best pick was pro WPF 4.5 in c# 4th edition and I got the answer on page 941 chapter 29. Actually have read this before but I did not pick to detail and the author stressed that calling PrintDialog.UserPageRangeEnabled and others should be done before calling PrintDialog.ShowDialog()
I fixed this with that and viola, after months of stress, I got it right.
Although most of the printing features like PrintDialog.currentPageEnabled and PrintDialog.SelectedPagesEnabled are supported only in .NET 4.5 but I'm ok with with the PrintDialog.UserPageRangeEnabled because my app targets .NET 4 CF for I want it to be available to window xp users.
Below is the box now.
Please take a look at the following post which explains printing from a FlowDocument:
Printing a WPF FlowDocument
You can find out more from 'Mitesh Sureja's Blog':
Printing Flow Document using WPF PrintDialog

Buttons to Message Box in Visual Studio 2008

Is it possible to add custom buttons (or) User defined buttons inside Message Box in Visual Studio Windows Forms application ?
Here's a quick guide to making a custom dialog box, which is going to be the ideal solution for you in this scenario, in my opinion.
The simple answer is: no it's not.
The long answer is that it's not possible using the managed API but it may be possible using the Win32 API. Here's a good tutorial on using Windows Hooks to customize the operating system message box dialog.
The .net MessageBox class does not offer such functionality. However, the native Win32 API does so through the TaskDialog API. The main advantage of this approach, as opposed to writing a custom dialog, is that you will be using a native system component and so your dialog will feel at home on the platform.
A very simple example of the task dialog looks like this:
And there is lots of scope for much more complexity, as is explained in the link above.
You'll need to p/invoke to this function. It's one of the more messy functions to call so expect a little work before you have a working solution. You can find some C# code to wrap it up here, but I can't say that I personally have experience of this.

Windows Explorer control for WPF?

Is there a way to have a Windows Explorer on WPF? The closes I can get is the Web Browser, but it's not really what I need.
Please assist.
Thanks
Check these out -
http://www.codeproject.com/KB/WPF/WPF_Explorer_Tree.aspx
and
http://gargmanoj.wordpress.com/2009/03/27/wpf-101-a-simple-windows-explorer-like-directory-browser/
JAM Software recently released a WPF edition of their ShellBrowser controls. They contain a wrapped Windows Explorer as well as custom built tree and list controls. Also included is a preview control similar to the one in the Windows Explorer on the right. Full disclosure: I am one of the developers of ShellBrowser.
Check out the explorer browser control in the Windows API Code Pack. Compatible with Vista and 7, I believe.
I have written a WinForms library that might help. It's not WPF but you can host it in a WPF application.
You can find the library at: http://gong-shell.sourceforge.net/
You can also check this out. It's fresh to the market and you'll need to pay, but it was designed to be identical in every way to the Windows Explorer Chrome:
http://www.teraque.com/products/explorer-chrome-suite/
The controls you get for free from WPF look like crap. They are only meant to get developers started.

How to display PDF or Word's DOC/DOCX inside WinForms window?

I'm wondering what's the best option to display a pdf/doc document inside form in my c# winforms app.
This control should only allow do display preview. Edtiting documents should be forbidden.
I'm looking for free solution.
The best option would be to attach a few separate *.dlls to solution but it's not a requirement.
Consider using the preview handlers for Vista, Windows 7.
I used the code provided by Brad Smith (with corrections from the comments).
http://www.brad-smith.info/blog/archives/79 - Hosting Preview Handlers in Windows Forms Applications
An often suggested solution is to use a webbrowser component inside the form that views the PDF:
MSDN
Another approach is to use an ActiveX Control included with the Adobe Acrobat Reader but therefore you need a license from Adobe.
You can use Preview Handlers. There is a WPF Article over at CodeProject, which should be dead easy to translate to WinForms if you need it.

Categories

Resources