Solved

Hide a .NET Window Form using Win32 API

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Help with consolidating excel files using VB.net 2 29
Sending receiving text messages in vb.net 15 48
vb.net winforms sizing/resolution? 4 43
VB.NET 2008 - SQL Timeout 9 34
Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

831 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