public void Dispose() { //ReleaseHandle(); if (_CustomControl != null && _CustomControl.MSDialog != null) { _CustomControl.MSDialog.Disposed -= new EventHandler(DialogWrappper_Disposed); _CustomControl.MSDialog.Dispose(); _CustomControl.MSDialog = null; } if (_CustomControl != null) { _CustomControl.Disposed -= new EventHandler(DialogWrappper_Disposed); _CustomControl.Dispose(); _CustomControl = null; } if (_BaseDialogNative != null) { _BaseDialogNative.Dispose(); _BaseDialogNative = null; } NativeMethods.DestroyWindow(_hDummyWnd); DestroyHandle(); }
private bool FileDialogEnumWindowCallBack(IntPtr hwnd, int lParam) { StringBuilder className = new StringBuilder(256); NativeMethods.GetClassName(hwnd, className, className.Capacity); int controlID = NativeMethods.GetDlgCtrlID(hwnd); WINDOWINFO windowInfo; NativeMethods.GetWindowInfo(hwnd, out windowInfo); // Dialog Window if (className.ToString().StartsWith("#32770")) { _BaseDialogNative = new NativeFileDialogWrapper(_CustomControl); _BaseDialogNative.AssignHandle(hwnd); return(true); } switch ((ControlsId)controlID) { case ControlsId.DefaultView: _CustomControl._hListViewPtr = hwnd; NativeMethods.GetWindowInfo(hwnd, out _ListViewInfo); _CustomControl.UpdateListView(); break; case ControlsId.ComboFolder: _ComboFolders = hwnd; _ComboFoldersInfo = windowInfo; break; case ControlsId.ComboFileType: _hComboExtensions = hwnd; _ComboExtensionsInfo = windowInfo; break; case ControlsId.ComboFileName: if (className.ToString().ToLower() == "comboboxex32") { _hComboFileName = hwnd; _ComboFileNameInfo = windowInfo; } break; case ControlsId.GroupFolder: _hGroupButtons = hwnd; _GroupButtonsInfo = windowInfo; break; case ControlsId.LeftToolBar: _hToolBarFolders = hwnd; _ToolBarFoldersInfo = windowInfo; break; case ControlsId.ButtonOk: _hOKButton = hwnd; _OKButtonInfo = windowInfo; _CustomControl._hOKButton = hwnd; //Feng.Windows.Forms.NativeMethods.EnableWindow(_hOKButton, false); break; case ControlsId.ButtonCancel: _hCancelButton = hwnd; _CancelButtonInfo = windowInfo; break; case ControlsId.ButtonHelp: _hHelpButton = hwnd; _HelpButtonInfo = windowInfo; break; case ControlsId.CheckBoxReadOnly: _hChkReadOnly = hwnd; _ChkReadOnlyInfo = windowInfo; break; case ControlsId.LabelFileName: _hLabelFileName = hwnd; _LabelFileNameInfo = windowInfo; break; case ControlsId.LabelFileType: _hLabelFileType = hwnd; _LabelFileTypeInfo = windowInfo; break; } return(true); }