Solved

Hide a .NET Window Form using Win32 API

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
XML & .net 5 41
POWERSHELL: do / until, should continue even when there is an error 4 54
Help with sorting data in Listbox using VB.NET 3 53
Syntax Error 2 46
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…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

920 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

16 Experts available now in Live!

Get 1:1 Help Now