コード例 #1
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(hwnd, out windowInfo);

            // Dialog Window
            if (className.ToString().StartsWith("#32770"))
            {
                _hwndFileDialogEmbedded = hwnd;

                return(true);
            }

            switch ((NativeMethods.ControlsId)controlID)
            {
            //not available at startup
            case NativeMethods.ControlsId.DefaultView:
                UpdateListView(hwnd);
                break;

            case NativeMethods.ControlsId.ComboFolder:
                _ComboFolders     = hwnd;
                _ComboFoldersInfo = windowInfo;
                break;

            case NativeMethods.ControlsId.ComboFileType:
                _hComboExtensions    = hwnd;
                _ComboExtensionsInfo = windowInfo;
                break;

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

            case NativeMethods.ControlsId.GroupFolder:
                _hGroupButtons    = hwnd;
                _GroupButtonsInfo = windowInfo;
                break;

            case NativeMethods.ControlsId.LeftToolBar:
                _hToolBarFolders    = hwnd;
                _ToolBarFoldersInfo = windowInfo;
                break;

            case NativeMethods.ControlsId.ButtonOk:
                _hOKButton    = new HandleRef(this, hwnd);
                _OKButtonInfo = windowInfo;
                break;

            case NativeMethods.ControlsId.ButtonCancel:
                _hCancelButton    = hwnd;
                _CancelButtonInfo = windowInfo;
                break;

            case NativeMethods.ControlsId.ButtonHelp:
                _hHelpButton    = hwnd;
                _HelpButtonInfo = windowInfo;
                break;

            case NativeMethods.ControlsId.CheckBoxReadOnly:
                _hChkReadOnly    = hwnd;
                _ChkReadOnlyInfo = windowInfo;
                break;

            case NativeMethods.ControlsId.LabelFileName:
                _hLabelFileName    = hwnd;
                _LabelFileNameInfo = windowInfo;
                break;

            case NativeMethods.ControlsId.LabelFileType:
                _hLabelFileType    = hwnd;
                _LabelFileTypeInfo = windowInfo;
                break;
            }

            return(true);
        }
コード例 #2
0
 internal static extern bool GetWindowInfo(IntPtr hwnd, out WINDOWINFO pwi);
コード例 #3
0
 internal static extern bool GetWindowInfo(IntPtr hwnd, out WINDOWINFO pwi);