private bool OpenFileDialogEnumWindowCallBack(IntPtr hwnd, int lParam)
        {
            var className = new StringBuilder(256);

            Win32.GetClassName(hwnd, className, className.Capacity);
            var        controlId = Win32.GetDlgCtrlID(hwnd);
            WindowInfo windowInfo;

            Win32.GetWindowInfo(hwnd, out windowInfo);
            switch ((ControlsId)controlId)
            {
            case ControlsId.DefaultView:
                _listViewPtr  = hwnd;
                _listViewInfo = windowInfo;
                break;

            case ControlsId.ComboFolder:
                _comboFolders     = hwnd;
                _comboFoldersInfo = windowInfo;
                break;

            case ControlsId.ComboFileType:
                _comboExtensions     = hwnd;
                _comboExtensionsInfo = windowInfo;
                break;

            case ControlsId.ComboFileName:
                if (className.ToString().ToLower() == "comboboxex32")
                {
                    _comboFileName     = hwnd;
                    _comboFileNameInfo = windowInfo;
                }
                break;

            case ControlsId.GroupFolder:
                _groupButtons     = hwnd;
                _groupButtonsInfo = windowInfo;
                break;

            case ControlsId.LeftToolBar:
                _toolBarFolders     = hwnd;
                _toolBarFoldersInfo = windowInfo;
                break;

            case ControlsId.ButtonOpen:
                _openButton     = hwnd;
                _openButtonInfo = windowInfo;
                break;

            case ControlsId.ButtonCancel:
                _cancelButton     = hwnd;
                _cancelButtonInfo = windowInfo;
                break;

            case ControlsId.ButtonHelp:
                _helpButton     = hwnd;
                _helpButtonInfo = windowInfo;
                break;

            case ControlsId.CheckBoxReadOnly:
                _chkReadOnly     = hwnd;
                _chkReadOnlyInfo = windowInfo;
                break;

            case ControlsId.LabelFileName:
                _labelFileName     = hwnd;
                _labelFileNameInfo = windowInfo;
                break;

            case ControlsId.LabelFileType:
                _labelFileType     = hwnd;
                _labelFileTypeInfo = windowInfo;
                break;

            case ControlsId.LabelLookIn:
                _labelLookIn     = hwnd;
                _labelLookInInfo = windowInfo;
                break;
            }
            return(true);
        }
示例#2
0
 public static extern bool GetWindowInfo(IntPtr hwnd, out WindowInfo pwi);