postmessage in an exe - c#

after i use process.start() a form1 appears on the desktop. When i click the form2 button from form1 a new form appears. how can i postmessage in form2? can someone please give me an example? I think i need to use FindWindow, but i don't know what to write as parameters. thx
Questions:
is there a way i can search in my application the elements from the form1 list (which appears after i run process.start in my app) and print them?
is there a way i can double click programatically an element from form1 - which automatically generates form2?
is there a way to postmessage in form2?
thx
i am using user32.dll

The White framework provides all the functionality you're seeking. It is commonly used for UI testing, but it can be used for any kind of UI automation.

Related

Having two active windows in a Winform application

Sorry, this more than likely has been asked at some point but I'm not even sure what I should be searching on...
I have a winform application with multiple forms. Up until this point having a one form open at a time has been fine. But now, I have a new form that I want to add on but have the ability to keep that form open while I work in other forms. I'm not even sure what this is called but I have seen it done before in other applications.
I did find this: Run two winform windows simultaneously
But this new window is a winpipe queue viewer that runs a thread. When I try initializing using the
Application.Run(new QueueViewer());
I get the error:Starting a second message loop on a single thread is not a valid operation. Use the Form.ShowDialog instead.
The problem with that is it locks the program from doing anything else until I close that form.
Thanks for your help!
Add a form to your project (let's call it Form2). Somewhere within your code (maybe in a button click event) use the following code:
Form2 f = new Form2();
f.Show();
The Show method allows you to interact with the originating form, whereas ShowDialog prevents interaction from the original form.

Create form not affected by ShowDialog()

I'm currently doing a security assessment of an extremely large C# application. I have wrote a tool to help me do the assessment that also runs in C#. The entire application uses ShowDialog aka modal forms. I'm trying to come up with a way where I can still use my tool (click on it for example) while modal dialog boxes are popped up. I figure, this may require another thread or something else. If anyone has any easy tips on a way to make it so that my form doesn't get blocked by ShowDialog, that would be great.
The entire purpose in using a modal dialog is for it to block it's parent until it is dismissed.

C# userform in excel pending while user method running

I am a newbie to excel programing, I now have a problem with my excel add-ins code. My add-ins call out a Mainform. Whenever I call my method from this form's button to do some tasks, such as searching huge data, the Mainform is frozen, it's inevitable. But when the method is running, assume it then will call a childform, this child form is also pending, I cannot do anything with it.
My purpose is to call a child form to add in a progress bar and an Abort button to cancel the running method.
How can I solve this?
Thanks in advance for your help.
vuhi
I believe you need to multi-thread to allow that; multi-threading using just VBA cannot be done.
See the answer to this question for more details.

Need Suggestion for my app

I want to show an loading image when i launch my desktop application. can anybody tell me how to show this in C#? Results required as happens in visual studio 2005/2008 when we launch this application.
What you are looking for is actually a splash screen. Look at this codeproject article. It explains really well how you should do this.
http://www.codeproject.com/KB/cs/prettygoodsplashscreen.aspx
What i did in my previous project was, that make the Form1 (display form) and make it wait for a while, then close it after that launch the Form2 which is the actual application.
But that was way back when i was a fresher. Now what i might do is, have a Form1 which ill launch and in the backgroundworker do all major UI processing work such as if any loading of data needs to be done, etc stuffs and keep every thing ready in memory. Then ill close the Form1 or make it hide or invisible and launch the Form2 which is the main app form and pass all the information required to it.

Target Different Window c#

Hey, I have been searching on google and I cant seem to find anything about targeting different windows in c#, I am using Visual studio 2010.
I'm not sure how to do this but I'm pritty sure it can be done, does anyone know where I can read up about it?
I need to be able to target a different program (like notpad for example), and simulate a key press.
Thanks.
If you mean interacting with different windows (possibly part of a different process), typically you would get a window handle (can be done in many ways), and then you can send messages and get data from those messages to those window handles.
For example see SendMessage which you would p/invoke from your C# app.
If you want to get updates on when certain events happen in those windows then you can use Windows Hooks.
I'm going to assume you're on WinForms (same applies for WPF, slightly different code though).
In your project you have
Form1
Form2
Form3
At the top of your Form1 class, you define this code:
Form2 frm2;
Form3 frm3;
Assuming Form1 is your startup object you add buttons for "Show Form2" and "Show Form3"
In their respective code-behind you add code like this
frm2 = new Form2();
frm2.Show();
frm3 = new Form3();
frm3.Show();
Same concept applies for WPF. If you're trying to do stuff with a window outside your application, the SendMessage Windows API is probably what you need to look into.

Categories