Insert an application to another one.C# - c#

Is it possible to insert one application for example to another application window using WinForms .NET application. I need application A to run in application B in a window of application B.
UPD
I would like to run .exe file in window of my program.

if you have not its source code, i think it is impossible

Possible duplicate answer: Embedding a winform within a winform (c#)
As stated in the answer to that question, you would be better moving your logic into a UserControl and hosting that control from either application in one WinForms window.

Related

C# Embedd A Non-Winforms Application into a Winform Application

I want to embedd an application (Hikvision iVMS-4200) into my winform .net application. The application appears to use custom rendering for its GUI, and a loading screen appears before the main window is launched.
In more detail, I want the window of this app to be confined within the window area of my application in a locked position (user can't move the embedded window), and display other things in the same parent window (for example a picture).
I have tried solutions such as this. It worked perfectly, but only with notepad. This solution doesn't work with the application I want (the process is opened successfuly but it is in a completely independant window).
My guess is that the app (again, Hikvision iVMS-4200) uses OpenGL for a custom GUI or another type of non-native GUI library. As a though, shouldn't any application on windows have atleast a single main window? could I access and edit its position and parenting properties? Any solution would be highly appreciated.

Opening an application as an MDI form in WINFORMS app

is it possible to take an application such as the mysql command line or notepad and display it in a windows forms application as an MDI form?
I have a relatively complex application that I would like to be able to access mysql directly through, for convenience. I would also like to be able to open notepad to allow simple text editing, but it seems foolish to reinvent the wheel and write my own text editor and incorporate it within the app just for convenience.
I just need a pointer as to where to go, as I currently have no clue, although I did consider using COM interop but I am not sure which of the native dlls to use.
I am using C# with Visual Studio 2012 Ultimate.
First I am not quite sure why you would want to do this however your best bet is going to be to find something on codeplex.com and integrate it into your application.
An example would be
http://dbexecutor.codeplex.com/
Then you can take the source and integrate it into your mdi application

Java Window as Child Form

is it possible to add an instance of a java application as a child form a .NET Form?
Thanks
I don't think it is. A Java program will have to run in its own process. A window from one process cannot be the child of a window of another process.
EDIT: Apparently I was wrong, it is possible to have a window from one process be a child of a window from another process, for example here
It might work with Java, depending on how the Java GUI framework the application uses works with Windows controls. The Windows Spy can help you figure out a little more about your Java application.
There is no easy and straightforward way todo that, at least that I'm aware of. One of possible solutions could be to make from your Java application an Applet and recall it inside embedded in Windows Form WebBrowser control. After you need to care about communication between your application and applet.
Some hints can find here
Hope this helps.

Creating new MDI Window in hosting application

I have an interesting case to solve:
I have a native (winapi) application, which uses MDI. This application allows me to extend itself with a simple scripting language. The scripts are launched on different thread than UI thread (although I can get the UI thread ID with appropriate functions). The scripting language also allow me to launch any c++ code (through LoadLibrary).
What I would like to achieve is to create a new window inside this application, which could host WPF and "attach it" as a MDI child window to MDI client (mdi area). Also, I would like this window to properly "talk" to MDI area, for example update list of windows in mdi menu.
So far, my first guess was to just create a WinForms window, host WPF inside, and then try to make it mdi child window by setting MDI client as it's parent (because my hosting application is not written in c#, I only have a handle, so I did this with User32.SetParent() P/Invoke). This worked almost well, after I attached my script thread to GUI thread, but I had few problems with it: the MDI menu with active windows did not update, the window did not interact correctly (it stayed on stop when it shouldn't etc.).
Then, I tried to set flags (style, exStyles) with SetWindowLongPtr. It changed my window's behavior a bit, but that was still not it.
Now I'm considering using CreateMDIWindow function, or doing it by SendMessage, according to docs sending message should create a window, even if I send it from different thread. The problem is, that this way would give me a native handle only, and I could not find (yet) any way of hosting WinForms / WPF inside it.
I'm curious if anyone tried to do something similar and had any results with it? Which way would be the best - trying to create a WinForms window and add it to MDI client, or create a native window and try to host WinForms in it (any particular way of doing that)?
Most answers for this question I have found are dealing with situation where hosting application is managed, so you can just set .MDIParent property, which won't work in this case I'm afraid.

Is WPF still relevant and can I use it in my C# windows application?

I have a process which I break into multiple processes and even when using threading it takes a very long time to complete.
I'd like to give the user an indication of the status of the execution in a cute way (for each process % complete). Maybe betting on the right horse will ease the pain :)
I found this project long ago: A Guided Tour of WPF (XAML)
I have two questions:
This article was written in 2007. Is there better way to achieve this graphic effect?
I have not understood yet, how the application is started, so I'd like to know if I can integrate such "window" in my window application?
Adam Robinson pointed out that the second question is not clear:
The application generates a window as in the picture below - I like to know if it possible to insert it in my "normal" windows application.
This article was written in 2007, is there better way to achieve this graphic effect?
WPF is the current "best" (or at least most feature-rich) way to develop a Windows Application for the desktop.
I have not understood yet, how the application is started, so I'd like to know if I can
integrate such "window" in my window application?
Make your application a WPF Application. This will automatically give you an application, Window class, and everything else you need to get started. Making a WPF application is just like any other application, except that you need to start the message pump, create the application, setup your startup window, etc. The "WPF Application" template in Visual Studio does all of that for you...
Until you understand what all is happening, I'd recommend starting with that, and customizing from there.
If you choose to stick with a win form for the main app, you can still host the desired window/control via an ElementHostControl. (hosts wpf inside winform).
Blessings,
Jeff

Categories

Resources