public override void HandleF2() { IntPtr hWnd = GetEditControl(); if (hWnd == IntPtr.Zero) { return; } string str; using (SafePtr lParam = new SafePtr(520)) { if (0 >= ((int)PInvoke.SendMessage(hWnd, 13, (IntPtr)260, lParam))) { return; } str = Marshal.PtrToStringUni(lParam); } if (str.Length <= 2) { return; } int num = str.LastIndexOf("."); if (num != -1) { IntPtr ptr3 = PInvoke.SendMessage(hWnd, 0xb0, IntPtr.Zero, IntPtr.Zero); int start = QTUtility2.GET_X_LPARAM(ptr3); int length = QTUtility2.GET_Y_LPARAM(ptr3); if ((length - start) >= 0) { if ((start == 0) && (length == num)) { start = length = num; } else if ((start == length) && (length == num)) { start = num + 1; length = str.Length; } else if ((start == (num + 1)) && (length == str.Length)) { start = 0; length = -1; } else if ((start == 0) && (length == str.Length)) { start = 0; length = 0; } else { start = 0; length = num; } PInvoke.SendMessage(hWnd, 0xb1, (IntPtr)start, (IntPtr)length); } } }
public static IntPtr SendCOPYDATASTRUCT(IntPtr hWnd, IntPtr wParam, string strMsg, IntPtr dwData) { if (String.IsNullOrEmpty(strMsg)) { strMsg = "null"; } using (SafePtr hglobal = new SafePtr(strMsg)) { COPYDATASTRUCT structure = new COPYDATASTRUCT { lpData = hglobal, cbData = (strMsg.Length + 1) * 2, dwData = dwData }; return(PInvoke.SendMessage(hWnd, WM.COPYDATA, wParam, ref structure)); } }
private void OnFileRename(IDLWrapper idl) { if (!idl.Available || idl.IsFileSystemFolder) { return; } string path = idl.Path; if (File.Exists(path)) { string extension = Path.GetExtension(path); if (!string.IsNullOrEmpty(extension) && extension.PathEquals(".lnk")) { return; } } IntPtr hWnd = GetEditControl(); if (hWnd == IntPtr.Zero) { return; } using (SafePtr lParam = new SafePtr(520)) { if ((int)PInvoke.SendMessage(hWnd, WM.GETTEXT, (IntPtr)260, lParam) <= 0) { return; } string str3 = Marshal.PtrToStringUni(lParam); if (str3.Length > 2) { int num = str3.LastIndexOf("."); if (num > 0) { // Explorer will send the EM_SETSEL message to select the // entire filename. We will intercept this message and // change the params to select only the part before the // extension. EditController = new NativeWindowController(hWnd); EditController.OptionalHandle = (IntPtr)num; EditController.MessageCaptured += EditController_MessageCaptured; } } } }
private static IntPtr SendCOPYDATASTRUCT_IDL(IntPtr hWnd, IntPtr wParam, byte[] idl, IntPtr dwData) { if((idl == null) || (idl.Length == 0)) { return (IntPtr)(-1); } int length = idl.Length; using(SafePtr destination = new SafePtr(length)) { Marshal.Copy(idl, 0, destination, length); COPYDATASTRUCT structure = new COPYDATASTRUCT { lpData = destination, cbData = length, dwData = dwData }; return PInvoke.SendMessage(hWnd, 0x4a, wParam, ref structure); } }
private void OnFileRename(IDLWrapper idl) { if(!idl.Available || idl.IsFileSystemFolder) return; string path = idl.Path; if(File.Exists(path)) { string extension = Path.GetExtension(path); if(!string.IsNullOrEmpty(extension) && extension.PathEquals(".lnk")) { return; } } IntPtr hWnd = GetEditControl(); if(hWnd == IntPtr.Zero) return; using(SafePtr lParam = new SafePtr(520)) { if((int)PInvoke.SendMessage(hWnd, WM.GETTEXT, (IntPtr)260, lParam) <= 0) return; string str3 = Marshal.PtrToStringUni(lParam); if(str3.Length > 2) { int num = str3.LastIndexOf("."); if(num > 0) { // Explorer will send the EM_SETSEL message to select the // entire filename. We will intercept this message and // change the params to select only the part before the // extension. EditController = new NativeWindowController(hWnd); EditController.OptionalHandle = (IntPtr)num; EditController.MessageCaptured += EditController_MessageCaptured; } } } }
protected override Point GetSubDirTipPoint(bool fByKey) { int iItem = fByKey ? ShellBrowser.GetFocusedIndex() : GetHotItem(); int x, y; Point ret; RECT rect; switch(ShellBrowser.ViewMode) { case FVM.DETAILS: rect = GetItemRect(iItem, LVIR.LABEL); x = rect.right; y = rect.top; y += (rect.bottom - y)/2; ret = new Point(x - 19, y - 7); break; case FVM.SMALLICON: rect = GetItemRect(iItem); x = rect.right; y = rect.top; x -= (rect.bottom - y) / 2; y += (rect.bottom - y) / 2; ret = new Point(x - 9, y - 7); break; case FVM.CONTENT: case FVM.TILE: rect = GetItemRect(iItem, LVIR.ICON); y = rect.bottom; x = rect.right; ret = new Point(x - 16, y - 16); break; case FVM.THUMBSTRIP: case FVM.THUMBNAIL: rect = GetItemRect(iItem, LVIR.ICON); if(QTUtility.IsXP) rect.right -= 13; y = rect.bottom; x = rect.right; ret = new Point(x - 16, y - 16); break; case FVM.ICON: rect = GetItemRect(iItem, LVIR.ICON); if(QTUtility.IsXP) { int num3 = (int)PInvoke.SendMessage(Handle, LVM.GETITEMSPACING, IntPtr.Zero, IntPtr.Zero); Size iconSize = SystemInformation.IconSize; rect.right = ((rect.left + (((num3 & 0xffff) - iconSize.Width) / 2)) + iconSize.Width) + 8; rect.bottom = (rect.top + iconSize.Height) + 6; } y = rect.bottom; x = rect.right; ret = new Point(x - 16, y - 16); break; case FVM.LIST: if(QTUtility.IsXP) { rect = GetItemRect(iItem, LVIR.ICON); using(SafePtr pszText = new SafePtr(520)) { LVITEM structure = new LVITEM { pszText = pszText, cchTextMax = 260, iItem = iItem, mask = 1 }; PInvoke.SendMessage(Handle, LVM.GETITEM, IntPtr.Zero, ref structure); int num4 = (int)PInvoke.SendMessage(Handle, LVM.GETSTRINGWIDTH, IntPtr.Zero, pszText); num4 += 20; rect.right += num4; rect.top += 2; rect.bottom += 2; } } else { rect = GetItemRect(iItem, LVIR.LABEL); } y = rect.bottom; x = rect.right; ret = new Point(x - 16, y - 16); break; default: rect = GetItemRect(iItem); y = rect.bottom; x = rect.right; ret = new Point(x - 16, y - 16); break; } PInvoke.ClientToScreen(Handle, ref ret); return ret; }
protected override Point GetSubDirTipPoint(bool fByKey) { int iItem = fByKey ? ShellBrowser.GetFocusedIndex() : GetHotItem(); int x, y; Point ret; RECT rect; switch (ShellBrowser.ViewMode) { case FVM.DETAILS: rect = GetItemRect(iItem, LVIR.LABEL); x = rect.right; y = rect.top; y += (rect.bottom - y) / 2; ret = new Point(x - 19, y - 7); break; case FVM.SMALLICON: rect = GetItemRect(iItem); x = rect.right; y = rect.top; x -= (rect.bottom - y) / 2; y += (rect.bottom - y) / 2; ret = new Point(x - 9, y - 7); break; case FVM.CONTENT: case FVM.TILE: rect = GetItemRect(iItem, LVIR.ICON); y = rect.bottom; x = rect.right; ret = new Point(x - 16, y - 16); break; case FVM.THUMBSTRIP: case FVM.THUMBNAIL: rect = GetItemRect(iItem, LVIR.ICON); if (QTUtility.IsXP) { rect.right -= 13; } y = rect.bottom; x = rect.right; ret = new Point(x - 16, y - 16); break; case FVM.ICON: rect = GetItemRect(iItem, LVIR.ICON); if (QTUtility.IsXP) { int num3 = (int)PInvoke.SendMessage(Handle, LVM.GETITEMSPACING, IntPtr.Zero, IntPtr.Zero); Size iconSize = SystemInformation.IconSize; rect.right = ((rect.left + (((num3 & 0xffff) - iconSize.Width) / 2)) + iconSize.Width) + 8; rect.bottom = (rect.top + iconSize.Height) + 6; } y = rect.bottom; x = rect.right; ret = new Point(x - 16, y - 16); break; case FVM.LIST: if (QTUtility.IsXP) { rect = GetItemRect(iItem, LVIR.ICON); using (SafePtr pszText = new SafePtr(520)) { LVITEM structure = new LVITEM { pszText = pszText, cchTextMax = 260, iItem = iItem, mask = 1 }; PInvoke.SendMessage(Handle, LVM.GETITEM, IntPtr.Zero, ref structure); int num4 = (int)PInvoke.SendMessage(Handle, LVM.GETSTRINGWIDTH, IntPtr.Zero, pszText); num4 += 20; rect.right += num4; rect.top += 2; rect.bottom += 2; } } else { rect = GetItemRect(iItem, LVIR.LABEL); } y = rect.bottom; x = rect.right; ret = new Point(x - 16, y - 16); break; default: rect = GetItemRect(iItem); y = rect.bottom; x = rect.right; ret = new Point(x - 16, y - 16); break; } PInvoke.ClientToScreen(Handle, ref ret); return(ret); }
public override void HandleF2() { IntPtr hWnd = GetEditControl(); if(hWnd == IntPtr.Zero) return; string str; using(SafePtr lParam = new SafePtr(520)) { if(0 >= ((int)PInvoke.SendMessage(hWnd, 13, (IntPtr)260, lParam))) return; str = Marshal.PtrToStringUni(lParam); } if(str.Length <= 2) return; int num = str.LastIndexOf("."); if(num != -1) { IntPtr ptr3 = PInvoke.SendMessage(hWnd, 0xb0, IntPtr.Zero, IntPtr.Zero); int start = QTUtility2.GET_X_LPARAM(ptr3); int length = QTUtility2.GET_Y_LPARAM(ptr3); if((length - start) >= 0) { if((start == 0) && (length == num)) { start = length = num; } else if((start == length) && (length == num)) { start = num + 1; length = str.Length; } else if((start == (num + 1)) && (length == str.Length)) { start = 0; length = -1; } else if((start == 0) && (length == str.Length)) { start = 0; length = 0; } else { start = 0; length = num; } PInvoke.SendMessage(hWnd, 0xb1, (IntPtr)start, (IntPtr)length); } } }