Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.dotnet.languages.csharp,microsoft.public.office.developer.com.add_ins
external usenet poster
 
Posts: 1
Default Getting .NET form to respond to Excel window events

Hi,

I am writing a COM add-in for Excel using c#. Everything works fine,
but I am trying to get the some finishing touches sorted out and one
of them is bugging me and I cannot see anything written on the web
trying to achieve this:

My add-in displays a couple of windows forms and some of these behave
more like floating toolbars than standalone modal dialogs. I want to
be able to somehow mirror the behaviour that normal Office commandbars
exhibit (and to some extent modal windows forms) in that:

* when Excel is minimized or deactivated I would like these
"floating" forms to disappear and when Excel is reactivated or
restored to reappear

* when Excel has the focus I would like the form to float over
other windows (if it is not positioned over Excel).

My natural approach is to try to use the api setparent call, but this
does not do what I want. does anyone have any other dieas about how
to do this. ideally, I do not want to hook Excel and respond to
events myself, but would prefer it if their was a natural way I can
"attach" the window to Excel.

Any help is much appreciated.
Seth

  #2   Report Post  
Posted to microsoft.public.dotnet.languages.csharp,microsoft.public.excel.programming,microsoft.public.office.developer.com.add_ins
external usenet poster
 
Posts: 4
Default Getting .NET form to respond to Excel window events

Seth,

In VB.NET the following snippet code makes the form to be part of Excel:

Dim frm As New AboutBox1
Dim appWindow As New NativeWindow

Try

appWindow.AssignHandle(Process.GetCurrentProcess() .MainWindowHandle)
frm.ShowDialog(appWindow)
Catch ex As Exception
MessageBox.Show(ex.ToString, My.Application.Info.Title.ToString)
Finally
appWindow.ReleaseHandle()
End Try


Is this what You want?

---------------
With kind regards,
Dennis
Weekly Blog .NET & Excel: http://xldennis.wordpress.com/
My English site: http://www.excelkb.com/default.aspx
My Swedish site: http://www.xldennis.com/
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[URGENT] How to Trap Excel Window Scroll Events in VSTO Surjya Excel Programming 2 January 24th 06 03:55 PM
TurnOff Form Events ? RAFAAJ2000[_2_] Excel Programming 6 May 29th 05 06:55 PM
Embedded command button doesn't respond in new window Jim Cable Excel Programming 0 February 20th 04 03:38 PM
Handling Excel Events in a Designer form in an ActiveX DLL Terry Excel Programming 0 October 31st 03 06:04 PM
minize excel Window but not my app form Tom Ogilvy Excel Programming 0 August 27th 03 12:33 PM


All times are GMT +1. The time now is 02:53 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"