Open Form in Dll C#

Posts 1–5 of 5 · Page 1 of 1
Open Form in Dll C#
help me...
when the dll is injected open a "FORM" with the functions.
Wtf. Please give some detailed information about your problem.. so the community can find a suitable solution


Edit:
Maybe you ment showing a form with code in the dll you created after it's injected...
Try adding System.Windows.Forms reference to your dll project, so you could possibly use this code...

Code:
public void MyFunction() {
     using (var myFormObj = new Form()) {
          myFormObj.Show();
     }
}
You could also create your own custom form to show... hope it helped.

It closes instantly when opened
Quote Originally Posted by tf2nex View Post
It closes instantly when opened
maybe you start some kind of thread that terminates after executing .Show() function?
in this case I suggest you to use ShowDialog() instead of Show() which will block executing code until form is closed by an user or code in form
Code:
public void DllMain()
{
     new Thread(new ThreadStart(OpenForm)).Start();
}
public void OpenForm()
{
   Application.Run(new Form1());
    //Or
    Form1 MyForm = new Form1();
    Form1.ShowDialog();
}
Posts 1–5 of 5 · Page 1 of 1

Post a Reply

Similar Threads

Talk with us