private bool OpenFileDialogEnumWindowCallBack(IntPtr hwnd, int lParam) { StringBuilder className = new StringBuilder(256); Win32.GetClassName(hwnd, className, className.Capacity); int controlID = Win32.GetDlgCtrlID(hwnd); WINDOWINFO windowInfo; Win32.GetWindowInfo(hwnd, out windowInfo); // Dialog Window if (className.ToString().StartsWith("#32770")) { mBaseDialogNative = new BaseDialogNative(hwnd); mBaseDialogNative.FileNameChanged += new BaseDialogNative.FileNameChangedHandler(BaseDialogNative_FileNameChanged); mBaseDialogNative.FolderNameChanged += new BaseDialogNative.FileNameChangedHandler(BaseDialogNative_FolderNameChanged); return true; } switch((ControlsID) controlID) { case ControlsID.DefaultView: mListViewPtr = hwnd; Win32.GetWindowInfo(hwnd, out mListViewInfo); if (mSourceControl.DefaultViewMode != FolderViewMode.Default) Win32.SendMessage(mListViewPtr, (int) Msg.WM_COMMAND, (int) mSourceControl.DefaultViewMode, 0); break; case ControlsID.ComboFolder: mComboFolders = hwnd; mComboFoldersInfo = windowInfo; break; case ControlsID.ComboFileType: mComboExtensions = hwnd; mComboExtensionsInfo = windowInfo; break; case ControlsID.ComboFileName: if (className.ToString().ToLower() == "comboboxex32") { mComboFileName = hwnd; mComboFileNameInfo = windowInfo; } break; case ControlsID.GroupFolder: mGroupButtons = hwnd; mGroupButtonsInfo = windowInfo; break; case ControlsID.LeftToolBar: mToolBarFolders = hwnd; mToolBarFoldersInfo = windowInfo; break; case ControlsID.ButtonOpen: mOpenButton = hwnd; mOpenButtonInfo = windowInfo; break; case ControlsID.ButtonCancel: mCancelButton = hwnd; mCancelButtonInfo = windowInfo; break; case ControlsID.ButtonHelp: mHelpButton = hwnd; mHelpButtonInfo = windowInfo; break; case ControlsID.CheckBoxReadOnly: mChkReadOnly = hwnd; mChkReadOnlyInfo = windowInfo; break; case ControlsID.LabelFileName: mLabelFileName = hwnd; mLabelFileNameInfo = windowInfo; break; case ControlsID.LabelFileType: mLabelFileType = hwnd; mLabelFileTypeInfo = windowInfo; break; } return true; }
public static extern bool GetWindowInfo(IntPtr hwnd, out WINDOWINFO pwi);