Exemplo n.º 1
0
 internal static extern bool GetWindowInfo(HandleRef hwnd, out WINDOWINFO pwi);
Exemplo n.º 2
0
      private bool FileDialogEnumWindowCallBack(IntPtr hwnd, int lParam)
      {
        StringBuilder className = new StringBuilder(256);
        NativeMethods.GetClassName(new HandleRef(this, hwnd), className, className.Capacity);
        int controlID = NativeMethods.GetDlgCtrlID(hwnd);
        WINDOWINFO windowInfo;
        NativeMethods.GetWindowInfo(new HandleRef(this, hwnd), out windowInfo);

        // Dialog Window
        if (className.ToString().StartsWith("#32770"))
        {
          _BaseDialogNative = new MSFileDialogWrapper(_CustomControl);
          _BaseDialogNative.AssignHandle(hwnd);
          return true;
        }

        switch ((ControlsId)controlID)
        {
          case ControlsId.DefaultView:
            _CustomControl._hListViewPtr = hwnd;
            NativeMethods.GetWindowInfo(new HandleRef(this, 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;
            _CustomControl._hFileName = hwnd;
            //}
            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;
            //Win32Types.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;
      }