![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi, I want to use forms in my Excel application-level add-in that have the main Excel window set as their owner. Could someone who knows these thins tell me, am I disposing the handle correctly? public partial class ExcelForm : Form { NativeWindow nativeWindow; public void Show(IntPtr handle) { nativeWindow = new NativeWindow(); nativeWindow.AssignHandle(handle); base.Show(nativeWindow); } protected override void Dispose(bool disposing) { if (disposing && (components != null)) // Windows Form Designer generated code { components.Dispose(); } // Is this the correct way and place? if (nativeWindow != null) { nativeWindow.ReleaseHandle(); |
|
} base.Dispose(disposing); } } Usage: ExcelForm excelForm = new ExcelForm(); excelForm.Show(new IntPtr(Application.Hwnd)); |
#3
| |||
| |||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |