all groups > dotnet windows forms > july 2004 >
You're in the

dotnet windows forms

group:

AddOwnedForm functionallity with extern application?



AddOwnedForm functionallity with extern application? ssunnerberg NO[at]SPAM hotmail.com
7/4/2004 11:47:48 PM
dotnet windows forms: Hi!
I want to make a form i vb.net wish will lay as a little window on the
side of the main window of an extern program. Pretty much like a
tool-window or something to photoshop.
When the extern program is minimized I want also the form to be
minimized and when the extrern app is bringed to front again I want my
form to do the same. Is this possible? With a win-api or something?

I want the functionallity to be pretty much like this code in .net.
Dim fOwnedForm As New OwnedForm()
Me.AddOwnedForm(fOwnedForm)
fOwnedForm.Show()

Best Regards
Re: AddOwnedForm functionallity with extern application? Saurabh
7/5/2004 9:28:22 AM
This is what you need....

WindowsAPI.SetWindowLong(<your form handle>, -8 /*GWL_HWNDPARENT*/, <the
extern application handle>);

In my case WindowsAPI is a class that I have written which I use to make API
calls.

using System;

using System.Runtime.InteropServices;

namespace MyWinAPI

{




public class WindowsAPI

{

public WindowsAPI()

{

//

// TODO: Add constructor logic here

//

}

[DllImport("user32.dll")]

public static extern long SetWindowLong(IntPtr hwnd, int index, long
newValue);

}

}

I have written a show method in my form as follows :

public new void Show()

{

long hOwner = <I don't know how you are getting your owner handle>;

System.IntPtr pOwner = new IntPtr(hOwner);

base.Show();

WindowsAPI.SetWindowLong(this.Handle, -8 /*GWL_HWNDPARENT*/,
pOwner.ToInt32());

}

Note that I have changed the owner after the form is shown, not sure whether
it works if the owner is set first and then the form is shown.

HTH,

--Saurabh

[quoted text, click to view]

Re: AddOwnedForm functionallity with extern application? ssunnerberg NO[at]SPAM hotmail.com
7/6/2004 8:02:26 AM
Thanks a lot!
Exactly what i wanted
Re: AddOwnedForm functionallity with extern application? nnj
7/22/2004 9:02:09 AM
Hello,

I think that the subject discussing here is related to my problem that I am now facing.
So, if you have any hint or suggestion, please let me know.

I want to make a modeless dialog form on excel application by using VB.NET.
I found a following good document and I could successfully compile it. Then I could open a modal dialog in excel.

"Tips and Tricks: Building Microsoft Office Add-ins with
Visual C# .NET and Visual Basic .NET"

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vbtchtipstricksbuildingmicrosoftofficeadd-inswithvisualcnetvisualbasicnet.asp

In the document, I changed the following command

selectionForm.ShowDialog()

to

selectionForm.Show()

and I could successfully open a modeless dialog.

HOWEVER, this dialog window is hidden under the excel window when the excel window is set to TOP position by clicking its title bar.

In VBA, I know that modeless dialog window is always shown above the excel window even if the excel title bar is clicked.

In VB.NET, I want to make my modeless dialog shown always above the EXCEL window like VBA.

I tried SetWindowLong function or SetParent function, but I could not successfully do it.

So, if you have any hint or suggestion, please let me know.
I have been struggling for about three weeks....
Help!


---
Posted using Wimdows.net NntpNews Component -

Re: AddOwnedForm functionallity with extern application? DotNetJunkies User
7/22/2004 9:31:29 AM
Hello,

I think that the subject discussing here is related to my problem that I am now facing.
So, if you have any hint or suggestion, please let me know.

I want to make a modeless dialog form on excel application by using VB.NET.
I found a following good document and I could successfully compile it. Then I could open a modal dialog in excel.

"Tips and Tricks: Building Microsoft Office Add-ins with
Visual C# .NET and Visual Basic .NET"

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vbtchtipstricksbuildingmicrosoftofficeadd-inswithvisualcnetvisualbasicnet.asp

In the document, I changed the following command

selectionForm.ShowDialog()

to

selectionForm.Show()

and I could successfully open a modeless dialog.

HOWEVER, this dialog window is hidden under the excel window when the excel window is set to TOP position by clicking its title bar.

In VBA, I know that modeless dialog window is always shown above the excel window even if the excel title bar is clicked.

In VB.NET, I want to make my modeless dialog shown always above the EXCEL window like VBA.

I tried SetWindowLong function or SetParent function, but I could not successfully do it.

So, if you have any hint or suggestion, please let me know.
I have been struggling for about three weeks....
Help!


---
Posted using Wimdows.net NntpNews Component -

Re: AddOwnedForm functionallity with extern application? DotNetJunkies User
7/22/2004 9:33:05 AM
Hello,

I think that the subject discussing here is related to my problem that I am now facing.
So, if you have any hint or suggestion, please let me know.

I want to make a modeless dialog form on excel application by using VB.NET.
I found a following good document and I could successfully compile it. Then I could open a modal dialog in excel.

"Tips and Tricks: Building Microsoft Office Add-ins with
Visual C# .NET and Visual Basic .NET"

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vbtchtipstricksbuildingmicrosoftofficeadd-inswithvisualcnetvisualbasicnet.asp

In the document, I changed the following command

selectionForm.ShowDialog()

to

selectionForm.Show()

and I could successfully open a modeless dialog.

HOWEVER, this dialog window is hidden under the excel window when the excel window is set to TOP position by clicking its title bar.

In VBA, I know that modeless dialog window is always shown above the excel window even if the excel title bar is clicked.

In VB.NET, I want to make my modeless dialog shown always above the EXCEL window like VBA.

I tried SetWindowLong function or SetParent function, but I could not successfully do it.

So, if you have any hint or suggestion, please let me know.
I have been struggling for about three weeks....
Help!


---
Posted using Wimdows.net NntpNews Component -

AddThis Social Bookmark Button