本文整理汇总了C#中QTTabBarLib.IDLWrapper类的典型用法代码示例。如果您正苦于以下问题:C# IDLWrapper类的具体用法?C# IDLWrapper怎么用?C# IDLWrapper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IDLWrapper类属于QTTabBarLib命名空间,在下文中一共展示了IDLWrapper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleClick
private void HandleClick(Point pt, Keys modifierKeys) {
IShellItem item = null;
try {
TVHITTESTINFO structure = new TVHITTESTINFO { pt = pt };
IntPtr wParam = PInvoke.SendMessage(treeController.Handle, 0x1111, IntPtr.Zero, ref structure);
if(wParam != IntPtr.Zero) {
if((structure.flags & 0x10) == 0 && (structure.flags & 0x80) == 0) {
treeControl.HitTest(pt, out item);
if(item != null) {
IntPtr pidl;
if(PInvoke.SHGetIDListFromObject(item, out pidl) == 0) {
using(IDLWrapper wrapper = new IDLWrapper(pidl)) {
TreeViewMiddleClicked(wrapper, modifierKeys);
}
}
}
}
}
}
finally {
if(item != null) {
Marshal.ReleaseComObject(item);
}
}
}
示例2: AppLauncher
public AppLauncher(Address[] addresses, string pathCurrent) {
List<string> list = new List<string>();
List<string> list2 = new List<string>();
this.strCurrentPath = this.strSelFiles = this.strSelDirs = this.strSelObjs = string.Empty;
this.iSelItemsCount = this.iSelFileCount = this.iSelDirsCount = 0;
if(addresses != null) {
this.iSelItemsCount = addresses.Length;
for(int i = 0; i < addresses.Length; i++) {
using(IDLWrapper wrapper = new IDLWrapper(addresses[i].ITEMIDLIST)) {
if(wrapper.Available && wrapper.HasPath) {
if(wrapper.IsFileSystemFile) {
list.Add(addresses[i].Path);
}
else {
list2.Add(addresses[i].Path);
}
}
}
}
}
if(Directory.Exists(pathCurrent)) {
this.strCurrentPath = "\"" + pathCurrent + "\"";
}
foreach(string str in list) {
this.strSelFiles = this.strSelFiles + "\"" + str + "\" ";
}
foreach(string str2 in list2) {
this.strSelDirs = this.strSelDirs + "\"" + str2 + "\" ";
}
this.strSelObjs = (this.strSelFiles + this.strSelDirs).Trim();
this.strSelFiles = this.strSelFiles.Trim();
this.strSelDirs = this.strSelDirs.Trim();
this.iSelFileCount = list.Count;
this.iSelDirsCount = list2.Count;
}
示例3: RunDialog
protected override bool RunDialog(IntPtr hwndOwner)
{
string root = Environment.GetFolderPath(RootFolder);
using(IDLWrapper wrapper = new IDLWrapper(root)) {
BROWSEINFO bi = new BROWSEINFO();
bi.hwndOwner = hwndOwner;
bi.pidlRoot = wrapper.PIDL;
bi.lpszTitle = Description;
bi.ulFlags = BROWSEINFO.BIF_NEWDIALOGSTYLE | BROWSEINFO.BIF_SHAREABLE | BROWSEINFO.BIF_EDITBOX;
if(!ShowNewFolderButton) {
bi.ulFlags |= BROWSEINFO.BIF_NONEWFOLDERBUTTON;
}
using(IDLWrapper wrapper2 = new IDLWrapper(PInvoke.SHBrowseForFolder(ref bi))) {
SelectedPath = wrapper2.Path;
SelectedIDL = wrapper2.IDL;
return !String.IsNullOrEmpty(SelectedPath);
}
}
}
示例4: DoItemClick
private bool DoItemClick(int itemId, Keys modKeys, bool middle)
{
IntPtr lParam = GetButtonLParam(itemId);
IntPtr ptr = PInvoke.DPA_GetPtr(hdpa, (int)lParam); // This pointer is NOT AddRef'd. Do not Release it!!
if(ptr == IntPtr.Zero) return false;
IntPtr pidl;
PInvoke.SHGetIDListFromObject(ptr, out pidl);
using(IDLWrapper wrapper = new IDLWrapper(pidl)) {
return ItemClicked(wrapper, modKeys, middle);
}
}
示例5: PopUpSystemContextMenu
public static int PopUpSystemContextMenu(IDLWrapper idlw, Point pntShow, ref IContextMenu2 pIContextMenu2, IntPtr hwndParent, bool fCanRemove) {
IShellFolder ppv = null;
int num5;
try {
IntPtr ptr;
if((!idlw.Available || (PInvoke.SHBindToParent(idlw.PIDL, ExplorerGUIDs.IID_IShellFolder, out ppv, out ptr) != 0)) || (ppv == null)) {
return -1;
}
IntPtr[] apidl = new IntPtr[] { ptr };
uint rgfReserved = 0;
Guid riid = ExplorerGUIDs.IID_IContextMenu;
object obj2 = null;
ppv.GetUIObjectOf(IntPtr.Zero, (uint)apidl.Length, apidl, ref riid, ref rgfReserved, out obj2);
if(pIContextMenu2 != null) {
Marshal.ReleaseComObject(pIContextMenu2);
pIContextMenu2 = null;
}
pIContextMenu2 = obj2 as IContextMenu2;
if(pIContextMenu2 == null) {
return -2;
}
ContextMenu menu = new ContextMenu();
uint uFlags = 0;
if((Control.ModifierKeys & Keys.Shift) == Keys.Shift) {
uFlags |= 0x100;
}
pIContextMenu2.QueryContextMenu(menu.Handle, 0, 1, 0xffff, uFlags);
if(fCanRemove) {
PInvoke.AppendMenu(menu.Handle, 0x800, IntPtr.Zero, null);
PInvoke.AppendMenu(menu.Handle, 0, new IntPtr(0xffff), QTUtility.ResMain[0x19]);
}
if((idlw.HasPath && (idlw.Path.Length > 3)) && (idlw.IsFileSystemFolder || idlw.IsFileSystemFile)) {
if(!fCanRemove) {
PInvoke.AppendMenu(menu.Handle, 0x800, IntPtr.Zero, null);
}
PInvoke.AppendMenu(menu.Handle, 0, new IntPtr(0xfffe), QTUtility.ResMain[0x1a]);
}
uint num3 = PInvoke.TrackPopupMenu(menu.Handle, 0x100, pntShow.X, pntShow.Y, 0, hwndParent, IntPtr.Zero);
int num4 = -3;
switch(num3) {
case 0:
num4 = 0xfffd;
break;
case 0xffff:
menu.Dispose();
return 0xffff;
case 0xfffe:
if(idlw.HasPath) {
try {
string directoryName = Path.GetDirectoryName(idlw.Path);
if(Directory.Exists(directoryName)) {
IntPtr currentHandle = QTUtility.instanceManager.CurrentHandle;
if(PInvoke.IsWindow(currentHandle)) {
QTUtility2.SendCOPYDATASTRUCT(currentHandle, (IntPtr)0x10, directoryName, IntPtr.Zero);
num4 = 0xfffe;
}
else {
Process.Start(directoryName);
num4 = -4;
}
}
}
catch {
SystemSounds.Asterisk.Play();
}
}
break;
default: {
CMINVOKECOMMANDINFO structure = new CMINVOKECOMMANDINFO();
structure.cbSize = Marshal.SizeOf(structure);
structure.fMask = 0;
structure.hwnd = hwndParent;
structure.lpVerb = (IntPtr)((num3 - 1) & 0xffff);
structure.lpParameters = IntPtr.Zero;
structure.lpDirectory = IntPtr.Zero;
structure.nShow = 1;
structure.dwHotKey = 0;
structure.hIcon = IntPtr.Zero;
num4 = pIContextMenu2.InvokeCommand(ref structure);
break;
}
}
menu.Dispose();
num5 = num4;
}
catch {
num5 = -1;
}
finally {
if(ppv != null) {
Marshal.ReleaseComObject(ppv);
ppv = null;
}
}
return num5;
}
示例6: dataGridView1_CellMouseDoubleClick
private void dataGridView1_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
{
if(e.RowIndex >= 0 && e.ColumnIndex > 0) {
string path = dgvHash.Rows[e.RowIndex].Cells[1].ToolTipText;
InstanceManager.InvokeMain(tabBar => {
using(IDLWrapper idlw = new IDLWrapper(Path.GetDirectoryName(path))) {
if(idlw.Available) {
tabBar.OpenNewTabOrWindow(idlw);
}
}
});
}
}
示例7: DoFileTools
private void DoFileTools(int index)
{
// desktop thread
// 0 copy path
// 1 copy name
// 2 copy path current
// 3 copy name current
// 4 file hash
// 5 show SubDirTip for selected folder
// 6 copy file hash
try {
if(index == 2 || index == 3) {
// Send desktop path/name to Clipboard.
string str = String.Empty;
if(index == 2) {
str = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
}
else {
byte[] idl = new byte[] {0, 0};
using(IDLWrapper idlw = new IDLWrapper(idl)) {
if(idlw.Available) {
str = idlw.DisplayName;
}
}
}
if(str.Length > 0) {
QTUtility2.SetStringClipboard(str);
}
return;
}
// File Hash
if(index == 4 || index == 6) {
List<string> lstPaths = new List<string>();
foreach(IDLWrapper idlw in ShellBrowser.GetItems(true)) {
if(idlw.IsLink) {
string pathLinkTarget = ShellMethods.GetLinkTargetPath(idlw.Path);
if(File.Exists(pathLinkTarget)) {
lstPaths.Add(pathLinkTarget);
}
}
else if(idlw.IsFileSystemFile) {
lstPaths.Add(idlw.Path);
}
}
/* TODO
if(index == 4) {
FileHashComputer.ShowForm(lstPaths.ToArray());
}
else {
FileHashComputer.GetForPath(lstPaths, hwndListView);
}*/
return;
}
// Show subdirtip.
if(index == 5) {
slvDesktop.ShowAndClickSubDirTip();
return;
}
// Copy name/path
if(index == 0 || index == 1) {
string str = ShellBrowser.GetItems(true)
.Select(idlw => index == 0 ? idlw.ParseName : idlw.DisplayName)
.StringJoin(Environment.NewLine);
if(str.Length > 0) QTUtility2.SetStringClipboard(str);
}
}
catch(Exception ex) {
QTUtility2.MakeErrorLog(ex);
}
}
示例8: OpenWindow
private static void OpenWindow(IDLWrapper pidl)
{
const int SW_SHOWNORMAL = 1;
const int SEE_MASK_IDLIST = 0x00000004;
SHELLEXECUTEINFO sei = new SHELLEXECUTEINFO {
cbSize = Marshal.SizeOf(typeof(SHELLEXECUTEINFO)),
nShow = SW_SHOWNORMAL,
fMask = SEE_MASK_IDLIST,
lpIDList = pidl.PIDL
};
PInvoke.ShellExecuteEx(ref sei);
}
示例9: timer_HoverSubDirTipMenu_Tick
private void timer_HoverSubDirTipMenu_Tick(object sender, EventArgs e)
{
// drop hilited and MouseHoverTime elapsed
// desktop thread
timer_HoverSubDirTipMenu.Enabled = false;
int iItem = itemIndexDROPHILITED;
if(MouseButtons != MouseButtons.None) {
Point pnt = MousePosition;
PInvoke.MapWindowPoints(IntPtr.Zero, hwndListView, ref pnt, 1);
if(iItem == PInvoke.ListView_HitTest(hwndListView, QTUtility2.Make_LPARAM(pnt.X, pnt.Y))) {
using(IDLWrapper idlw = new IDLWrapper(GetItemPIDL(iItem))) {
if(idlw.Available) {
if(subDirTip != null) {
subDirTip.HideMenu();
}
if(!String.Equals(idlw.Path, CLSIDSTR_TRASHBIN, StringComparison.OrdinalIgnoreCase)) {
if(ShowSubDirTip(idlw.PIDL, iItem, true)) {
itemIndexDROPHILITED = iItem;
PInvoke.SetFocus(hwndListView);
PInvoke.SetForegroundWindow(hwndListView);
HideThumbnailTooltip();
subDirTip.ShowMenuForDropHilited(GetDesktopIconSize());
return;
}
}
}
}
}
if(subDirTip != null) {
if(subDirTip.IsMouseOnMenus) {
itemIndexDROPHILITED = -1;
return;
}
}
}
HideSubDirTip();
}
示例10: GetTargetWindow
// TODO: figure out what this is
private bool GetTargetWindow(IDLWrapper idlw, bool fNeedWait, out IntPtr hwndTabBar, out bool fOpened) {
hwndTabBar = IntPtr.Zero;
fOpened = false;
using(RegistryKey key = Registry.CurrentUser.CreateSubKey(@"Software\Quizo\QTTabBar")) {
if(key != null) {
hwndTabBar = QTUtility2.ReadRegHandle("Handle", key);
}
if((hwndTabBar == IntPtr.Zero) || !PInvoke.IsWindow(hwndTabBar)) { // what?! --.
hwndTabBar = QTUtility.instanceManager.CurrentHandle; // v
if((idlw.Available && ((hwndTabBar == IntPtr.Zero) || !PInvoke.IsWindow(hwndTabBar))) && ShellBrowser.Navigate(idlw) == 0) {
fOpened = true;
if(fNeedWait) {
int num = 0;
while(!PInvoke.IsWindow(hwndTabBar)) {
Thread.Sleep(100);
hwndTabBar = QTUtility2.ReadRegHandle("Handle", key);
if(++num > 50) {
goto Label_00EB;
}
}
}
else {
return true;
}
}
}
}
Label_00EB:
if(hwndTabBar != IntPtr.Zero) {
return PInvoke.IsWindow(hwndTabBar);
}
return false;
}
示例11: dropDownMenues_ItemRightClicked
private void dropDownMenues_ItemRightClicked(object sender, ItemRightClickedEventArgs e) {
QMenuItem clickedItem = e.ClickedItem as QMenuItem;
if(clickedItem == null) {
return;
}
Point pnt = e.IsKey ? e.Point : MousePosition;
if(clickedItem.Target == MenuTarget.VirtualFolder) {
return;
}
if(clickedItem.Genre == MenuGenre.Group) {
fContextmenuedOnMain_Grp = sender == contextMenu;
string str = MenuUtility.TrackGroupContextMenu(e.ClickedItem.Text, pnt, ((DropDownMenuReorderable)sender).Handle);
fContextmenuedOnMain_Grp = false;
if(!string.IsNullOrEmpty(str)) {
OpenTab(new object[] { str, ModifierKeys });
return;
}
e.HRESULT = 0xfffd;
return;
}
bool fCanRemove = clickedItem.Genre != MenuGenre.Application;
using(IDLWrapper wrapper = new IDLWrapper(clickedItem.Path)) {
e.HRESULT = ShellMethods.PopUpSystemContextMenu(wrapper, pnt, ref iContextMenu2, ((DropDownMenuReorderable)sender).Handle, fCanRemove);
}
if(e.HRESULT != 0xffff) {
return;
}
if(clickedItem.Genre == MenuGenre.History) {
QTUtility.ClosedTabHistoryList.Remove(clickedItem.Path);
UndoClosedItemsList.Remove(clickedItem);
try {
using(RegistryKey key = Registry.CurrentUser.CreateSubKey(@"Software\Quizo\QTTabBar")) {
QTUtility.SaveRecentlyClosed(key);
}
goto Label_019F;
}
catch {
goto Label_019F;
}
}
if(clickedItem.Genre == MenuGenre.RecentFile) {
QTUtility.ExecutedPathsList.Remove(clickedItem.Path);
RecentFileItemsList.Remove(clickedItem);
try {
using(RegistryKey key2 = Registry.CurrentUser.CreateSubKey(@"Software\Quizo\QTTabBar")) {
QTUtility.SaveRecentFiles(key2);
}
}
catch {
}
}
Label_019F:
clickedItem.Dispose();
}
示例12: DoFileTools
private void DoFileTools(int index) {
try {
switch(index) {
case 0:
case 1: {
bool flag = index == 0;
string str = ShellBrowser.GetItems()
.Select(wrapper2 => flag ? wrapper2.ParseName : wrapper2.DisplayName)
.Where(name => name.Length > 0).StringJoin("\r\n");
if(str.Length > 0) {
QTTabBarClass.SetStringClipboard(str);
}
break;
}
case 2:
case 3: {
string folderPath = string.Empty;
if(index == 2) {
folderPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
}
else {
byte[] idl = new byte[2];
using(IDLWrapper wrapper = new IDLWrapper(idl)) {
if(wrapper.Available) {
folderPath = ShellMethods.GetDisplayName(wrapper.PIDL, true);
}
}
}
if(folderPath.Length > 0) {
QTTabBarClass.SetStringClipboard(folderPath);
}
break;
}
case 4: {
List<string> list2 = new List<string>();
foreach(IDLWrapper wrapper2 in ShellBrowser.GetItems(true)) {
if(wrapper2.IsLink) {
string linkTargetPath = ShellMethods.GetLinkTargetPath(wrapper2.Path);
if(File.Exists(linkTargetPath)) {
list2.Add(linkTargetPath);
}
}
else if(wrapper2.IsFileSystemFile) {
list2.Add(wrapper2.Path);
}
}
if(hashForm == null) {
hashForm = new FileHashComputerForm();
}
hashForm.ShowFileHashForm(list2.ToArray());
break;
}
case 5:
listView.ShowAndClickSubDirTip();
break;
}
}
catch(Exception exception) {
QTUtility2.MakeErrorLog(exception);
}
}
示例13: subDirTip_MultipleMenuItemsClicked
private void subDirTip_MultipleMenuItemsClicked(object sender, EventArgs e) {
List<string> executedDirectories = ((SubDirTipForm)sender).ExecutedDirectories;
if(executedDirectories.Count > 0) {
List<byte[]> list2 = new List<byte[]>();
foreach(string str in executedDirectories) {
using(IDLWrapper wrapper = new IDLWrapper(str)) {
IDLWrapper wrapper2;
if(IDLIsFolder(wrapper, out wrapper2)) {
if(wrapper2 != null) {
list2.Add(wrapper2.IDL);
wrapper2.Dispose();
}
else {
list2.Add(wrapper.IDL);
}
}
continue;
}
}
Keys modifierKeys = ModifierKeys;
if(!QTUtility.CheckConfig(Settings.ActivateNewTab)) {
switch(modifierKeys) {
case Keys.Shift:
modifierKeys = Keys.None;
break;
case Keys.None:
modifierKeys = Keys.Shift;
break;
}
}
if(list2.Count == 1) {
object[] objArray = new object[3];
objArray[1] = modifierKeys;
objArray[2] = list2[0];
OpenTab(objArray);
}
else if(list2.Count > 1) {
byte[] buffer = list2[0];
list2.RemoveAt(0);
Thread thread = new Thread(OpenFolders2);
thread.SetApartmentState(ApartmentState.STA);
thread.IsBackground = true;
thread.Start(new object[] { buffer, list2, modifierKeys });
}
}
}
示例14: subDirTip_MenuItemRightClicked
private void subDirTip_MenuItemRightClicked(object sender, ItemRightClickedEventArgs e) {
using(IDLWrapper wrapper = new IDLWrapper(((QMenuItem)e.ClickedItem).Path)) {
e.HRESULT = ShellMethods.PopUpSystemContextMenu(wrapper, e.IsKey ? e.Point : MousePosition, ref iContextMenu2, ((SubDirTipForm)sender).Handle, false);
}
}
示例15: subDirTip_MenuItemClicked
private void subDirTip_MenuItemClicked(object sender, ToolStripItemClickedEventArgs e) {
QMenuItem clickedItem = (QMenuItem)e.ClickedItem;
if(clickedItem.Target == MenuTarget.Folder) {
if(clickedItem.IDLData == null) {
OpenTab(new object[] { clickedItem.TargetPath, ModifierKeys });
return;
}
using(IDLWrapper wrapper = new IDLWrapper(clickedItem.IDLData)) {
SHELLEXECUTEINFO structure = new SHELLEXECUTEINFO();
structure.cbSize = Marshal.SizeOf(structure);
structure.nShow = 1;
structure.fMask = 4;
structure.lpIDList = wrapper.PIDL;
try {
PInvoke.ShellExecuteEx(ref structure);
}
catch {
}
return;
}
}
try {
string path = clickedItem.Path;
ProcessStartInfo startInfo = new ProcessStartInfo(path);
startInfo.WorkingDirectory = Path.GetDirectoryName(path);
startInfo.ErrorDialog = true;
Process.Start(startInfo);
if(!QTUtility.CheckConfig(Settings.NoRecentFiles)) {
QTUtility.ExecutedPathsList.Add(path);
}
}
catch {
}
}