Solved

Hide a .NET Window Form using Win32 API

Posted on 2009-06-29
2
422 Views
Last Modified: 2013-12-17
Opening a .NET created Window form in VB 6 using late binding. I want to hide that form using some other application throught Win 32 API [using ShowWindow API]. But while HIding form is geeting closed.

To stop the closing event, we called e.cancel=true but it is not able to stop the closing event of the form.
   
To Open a .NET Window Form:
 
Public a  As Object
Private Sub Command1_Click()
    Set a = CreateObject("WindowsFormsApplication1.Form1")
     a.Text = CStr(a.Handle)
    a.ShowDialog
End Sub
 
 
To Hide the form using other VB6 application following API has been used:
 
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long

Open in new window

0
Comment
Question by:utkarsh_agrawal
2 Comments
 
LVL 25

Accepted Solution

by:
SStory earned 500 total points
ID: 24765581
Here's some c# code on having the window hide itself:
http://www.codeproject.com/KB/cs/windowhider.aspx?display=PrintAll&fid=3881&df=90&mpp=25&noise=3&sort=Position&view=Quick&fr=26

Maybe you should expose a method from the DOTNET app called Hide that uses the above code to tell it to hide itself.

Why are you doing ShowDialog?  Try just Show...if that causes problems set the owner of the dotnet Window to the vb6 window handle and see what happens.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question