Showing the hidden Winform - c#

I have two independent application. First application is called MSGAPP and other is called SCUForm.
I am controlling the the SCUForm through MSGAPP application by sending the Windows Messages. I can minimize, maximize the SCUForm application by sending the Windows Messages through MSGAPP. And I can also Hide the SCUForm. But when I hide the application, I am not able to show the form back.
what I should do to show it back.
I tried this.Show() but no use.
Am I missing some basics here?
Please guide me.
Thanks in advance.
-Harsha

If I remember well (I did it some year ago), you should try to use WM_SYSCOMMAND with SC_RESTORE.
Watch here.
You could find this and this useful, perhaps.

Related

UIAutomation, pause application if Help window appears

This is related to my other question.
I used the OnStructureChanged event to detect that the 'Help' window popped up in the 3rd party application that my application is writing data to. I need my application to pause while the end user resolves the data issue in the 3rd party application, then I need my application to resume once the end user closes the 'Help' window. (Either I need to detect that the 'Help' window was closed or I need to display a message box and use the DialogResult to trigger my application to resume).
I've never encountered something like this before. I don't know if it's possible to do what I want to do. If it is possible, I don't know where to start.
Advice?
UPDATES:
I have only used Threading once before and I think it was a fairly "easy peasy" usage, I pulled it off without much effort, considering I'd never used Threading before. I'm playing around with Threading for this issue right now. There's a good chance I've implemented it incorrectly, but my app isn't functioning correctly anymore...I don't know if I'm even playing with the correct tool.
I had to just keep moving with the project - deadlines, you know...
I ended up using UI Automation to detect the "Help" window, then I showed a message box giving instructions to the end user. I check the MessageBox's DialogResult and continue processing based on that. It might not be the "best" way to skin the cat, but I'm a noob and I have a deadline, so I did what I needed to do to keep moving.

Disable prompts in Windows Forms Webbrowser

I have a C# application which uses a System.Windows.Forms.WebBrowser.
The problem is: i'd like the user to navigate smoothly in my application, without prompts, without javascript windows popping up, without security prompts. Even if this requires some contents to be unavailable.
I just want to have one window (always one window, if a receive a new window event, i redirect it to the single window).
How can i do this?
I tried to use this.browser.ScriptErrorsSuppressed = true but i doesnt seem to work.
For example, if i test it on a browser page which performs text validation, i still receive a popup window saying that my text is invalid.
Thank you!
I've found a solution somewhere else, since it wasn't available here.
Here it is: http://www.codeproject.com/Articles/31163/Suppressing-Hosted-WebBrowser-Control-Dialogs
Basically, you have to hook the WM_INITDIALOG message.
It works wonders here.

C# - Control another application's windows using Thoughtworks White

I'm creating a C# program and I need to control another application. I found this
example, but it doesn't really work for me (or at least I can't make it work).
1) The application is already running (so I can't use Application application = Application.Launch("foo.exe");
2) It has a textbox and I need to read what's written in it.
3) Then I want to press one of its buttons (This can be done with that: Button button = window.Get<Button>("save"); button.Click();
I also searched Google, but I didn't find anything working.
Can you help me? Thanks in advance.
The documentation doesn't mention it, but Application.Attach() allows you to access a program that is already running. From there, I would expect everything would work as documented.

How can you read values from an open application in Windows?

I want to create a program or use a program that will read the memory values out of another application. Does anyone know of an application/library that will do this?
The target app is this. I would like to read the exchange rate values from it.
I'm an experienced c# programmer, but have never worked with the Win32/user32 api which is what I'm assuming I'll have to deal with to pull this off.
Any help that gets me going in the right direction is greatly appreciated.
Update:
I managed to use Spy++ to get the window handle, so I'm sure I can get the values some how.
Have you looked into AutoIT or AutoHotKey?
Both of these open source options have well documented abilities to read text from application windows (and send keystrokes or mouseclicks to them).
AutoIT is very easy to use and well documented.
An example of reading text from a window would be:
$text = WinGetText("title of window", "")
MsgBox(0, "Text read was:", $text)
This can be compiled into an executable.
Typically an application creates controls in a dialog in a consistent manor, same ID, same order etc, so finding a control programatically is fairly simple. Using Spy++ find the control's ID and then you can search the windows created by the application for the desired control. Not being familiar with the app in question I cannot give specifics, but if Spy++ shows the value you desire, it is likely not difficult to obtain the value in your code.
What type of control is the value displayed in? You'll may be able to use GetDlgItemText to obtain the value once you have the parent window handle and control ID? To get the parent window try using EnumWindows.
It might be easier to scrape their data by automating a screenshot and then ocr process. If that's your goal.
Potentially relevant links:
get-a-screenshot-of-a-specific-application
ocr-with-the-tesseract-interface
May be this article helps - http://msdn.microsoft.com/en-us/magazine/cc163617.aspx, but I think it's not universal and for your task is better to get access directly to Forex API/Web-Service or try to catch needed data on network.
It is possible to screen-scrap things created with native windows controls; if that is the case, you should be able to see the controls using Spy++. But some times controls are implemented "by hand", and there is no way to screen-scrap them (e.g. some Java graphic toolkits play directly with the graphics, so everything day do is meaningless from the outside, or even some Office menus are implemented without using the menu control).
The Windows accessibility API is a possible way to screen-scrap the values; check if "Narrator", the screen reader that comes with windows, is able to read aloud your target application.

open a .exe as a window in an mdi form?

I wanted to create a program that would allow me to open instances of a already exsiting program (i just have the exe) as windows inside (i belive its called mdi)
Is that something i could do? can anyone point me to an example?
Thanks
Maybe this is the answer you are looking for here. It can be done...look in the sample on that link given.
Hope this helps,
Best regards,
Tom.
When Windows starts a program its parent is the Desktop Window.
If you could somehow manipulate that, it may work.
However, I doubt it is possible, as why would I want to allow you to run my application in your window? Especially MDI? Besides that - running in a child window isn't quite the same as running in the "main" window.
Having said that there is an application out there (can't think of it's name OH) that does place individual applications in tabs. Pretty nifty if you're not on Windows 7. The folks over at the Business of Software forum might be able to help you find it.
Well, after starting the app and storing its PID, you could start monitor the windows that get created, either thru a CBTHook or by just using a timer and the GetWindows to find when a top level window gets created by the PID in question.
Then you can use SetParent to make that window a child to your MDIChild (I doubt you can make it your MDIChild directly).
That should get you going. What you'll run into after that I really don't know. I guess you must correlate any movement of either your app or the external app so that thir windows appears to be stuck together...
Maybo you could strip away the caption from the external app (Get/SetWindowsLong). That could make it look better...

Categories