Solved

Hide a .NET Window Form using Win32 API

Posted on 2009-06-29
2
410 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

762 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now