I am writing an application and I would like to be able to display another application inside it. (Think like a windows form with a small box, or a tab that is displaying a totally seperate application.)
Is that something that can be done? If so, can anyone give some direction on how to go about doing it?
I am looking for something in the C# or VB.NET world.
THANKS!
You need a hWnd (handle) of window from another application.
Then you need a hWnd of container control in you application (System.Windows.Forms.Control.Handle property).
Then you need use a Win32API function SetParent, and that all you need.
On the SetParent page is little sample, which should do what you need.
Related
So I have experience in C++ and I am now messing around in C# .NET with the Windows Forms. I know how to create a new Form, which I can use as a new window. And that you can also create user control, a component or a normal class.
Now I made an application in C++ but I want to convert it to C# .NET. In C++ I made the whole gui myself. But I want to do that now in C# .NET for practice.
In that application, the user could create nodes (Like you can in unreal engine 4 in the blueprints, see example picture)
Now I am unsure what would be the best way to do this in Windows forms.
Making a new form doesn't seem like the correct way. Because the nodes have to be inside of the main screen. And you should be able to move the grid which hold the nodes. So nodes shouldnt be able to exit the main screen that holds them.
Is it better to create it from scratch myself in a class? Or can I achieve this with a user control or component class? I do not understand what the best use of these classes are and what they are used for.
So I want to make something like this, and the question is what is the best type of class to make the nodes with?:
I think you should use WPF to obtain node-base UI. I developed a program with such an interface in WPF and it was pretty simple (I didn't have any experience in WPF):
You can create almost every layout you want using grids, borders, stackpanels, dockpanels, paths etc.
So, one of my favorite things about iOS/ObjC in general is the "popover" control.
I am building an app in C# WinForms that would benefit greatly from this type of control- anyone have any ideas on how I might be able to emulate this type of look?
For reference, here's an example screenshot of what I'm talking about http://i.imgur.com/IzbbzrA.png
Thanks for any ideas!
You can create a simple popup control by following the articles linked below
Simple Popup Control
I don't think such a control exists in .Net. What I would do from this point if I were you is try to making one using a customized windows form on top of it. Play with the Mouse Hover events of the control and make the form appear for a short time. Make it without borders. With a little imagination you can have your own version of the PopOver.
I'm currently developing an Windows Forms application in C# which will make use of tabs for the GUI. The problem I'm facing though is that the code is becoming untidy.
The reason is that the code for GUI components (such as button clicks) resides on the main form code.
So I'm looking for a way to still handle all the GUI interactions the same way but separate the code in a logical way (e.g. different files). Like having button1_click() reside in another file but work the same way as before.
Thanks :)
You can place each "Tab" into its own UserControl, and handle the events there instead of all within the main form.
As tabs typically each represent something "distinct", this is often fairly simple to implement, and helps clean up your code.
I'm trying to click a button on a windows application from other application. Basically, I want to click app B's button from app A's code.
I can use winapi findWindow to get a handler. The problem is that I have no idea the name of the button on the app B. Is this possible to list all the names or ids of an application?
I'm using c# to make it happen.
Since you're looking at suggestions (it's a pretty generic question really, it might or might not work depending on what other app/window is, is it e.g. browser or a 3rd party app etc., does it support automation)
Take a look at this closely related answer (it might be a duplicate but you're kind of 'looking for' still so maybe note).
Accessing Elements from Other Processes
Also this one on how to 'access' other app's 'inputs'
Pinvoke SetFocus to a particular control
I have not tested this. But it looks like a intressting libary. Maybe there is some function you can use. It is called White. This is just a sample:
Application application = Application.Launch("foo.exe");
Window window = application.GetWindow("bar", InitializeOption.NoCache);
Button button = window.Get<Button>("save");
button.Click();
You can use tool such as Spy++ (included in any Visual Studio except Express editions) to find name and class of that button and then use these information as parameters of FindWindow().
I am developing an application that will be running behind the scenes in Windows and would like to put an icon in the system tray for troubleshooting purposes (simple way for users to tell if the app is running). There is no other UI for the application, and the icon does not need to have any functionality as of right now.
All of the solutions I have found as of yet involve creating a form. I am wondering if there is a way to simply add a class to my current C# code that allows me to control the icon, rather than doing the whole 'make a form, set it to be invisible....' nonsense that seems to be the popular suggestion on the forums. Something along the lines of the way that UI control is done in say, Swing for Java. I would really appreciate any ideas!
You can do it with a custom ApplicationContext. Google reveals first this tutorial on how to achieve it.
Or you can alter your main Program file not to show any form at all:
Application.Run(); //remove the Form oject from this call
From whatever project you use, why not just create an instance of the NotifyIcon class and use it to display the icon in the system tray?
For Windows Forms:
Form.ShowInTaskbar to show/hide in the taskbar
and use a NotifyIcon to show in the tray