Skip to content

Commit

Permalink
是否配置了进行捕获微信选中的文件
Browse files Browse the repository at this point in the history
  • Loading branch information
indiff committed Feb 29, 2024
1 parent c63a281 commit 3a51a3e
Showing 1 changed file with 33 additions and 30 deletions.
63 changes: 33 additions & 30 deletions QTTabBar/QTTabBarClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4876,18 +4876,14 @@ private void ListView_SelectionChanged(/*object sender, SelectionChangedEventArg
// timerSelectionChanged.Enabled = true;
}

if (!Config.Window.CaptureWeChatSelection)
{
return;
}
// 获取选中文件数据
try
{
var selectedCount = ShellBrowser.GetSelectedCount();
// var selectedCount = ShellBrowser.GetSelectedCount();
var tabText = tabControl1.TabPages[0].Text;
QTUtility2.log("ListView_SelectionChanged this.TabCount " + this.TabCount +
" fHideExplorer " + fHideExplorer +
" selectedCount " + selectedCount +
// " selectedCount " + selectedCount +
" mCmdType " + mCmdType +
" tabItem Text " + tabText
);
Expand All @@ -4896,46 +4892,56 @@ private void ListView_SelectionChanged(/*object sender, SelectionChangedEventArg
if (this.TabCount == 1 && // 当前捕获到的新进程是只有一个窗口
fHideExplorer && // 需要进行退出的窗口
(mCmdType == 2) && // factory 捕获 // || mCmdType == 3
Config.Window.CaptureWeChatSelection && // 是否配置了进行捕获微信选中的文件
QTUtility2.IsEmpty(tabText) // 标签文本是空的
)
{
try
{
var tabItem = tabControl1.TabPages[0];
// var tabItem = tabControl1.TabPages[0];
IShellView shellView = null;

if (0 == ShellBrowser.GetIShellBrowser().QueryActiveShellView(out shellView))
{
var iid = new Guid("{0000010e-0000-0000-C000-000000000046}");
object ppv;
shellView.GetItemObject((uint)SVSIF.SELECT, ref iid, out ppv);
if (ppv != null)
// QTTabBarLib.Common.HResult hr = shellView.GetItemObject((uint)SVSIF.SELECT, ref iid, out ppv);
var hr = shellView.GetItemObject((uint)SVSIF.SELECT, ref iid, out ppv);
if (hr == QTTabBarLib.Common.HResult.Ok)
{
IDataObject pDataObject = (IDataObject)ppv;
var shellObjectCollection = ShellObjectCollection.FromDataObject(pDataObject);
if (shellObjectCollection.Count > 0)
if (ppv != null)
{
string key = "";
foreach (ShellObject so in shellObjectCollection)
IDataObject pDataObject = (IDataObject)ppv;
var shellObjectCollection = ShellObjectCollection.FromDataObject(pDataObject);
if (shellObjectCollection.Count > 0)
{
FileInfo info = new FileInfo(so.ParsingName);
if (info.Exists)
string key = "";
foreach (ShellObject so in shellObjectCollection)
{
key = info.Directory.FullName;

if (QTUtility2.IsNotEmpty(key))
FileInfo info = new FileInfo(so.ParsingName);
if (info.Exists)
{
RegistryUtil.WriteSelection(key, so.ParsingName);
QTUtility2.log(
" WriteSelection " +
key +
" path " + so.ParsingName
);
break;
key = info.Directory.FullName;

if (QTUtility2.IsNotEmpty(key))
{
RegistryUtil.WriteSelection(key, so.ParsingName);
QTUtility2.log(
" WriteSelection " +
key +
" path " + so.ParsingName
);
break;
}
}
}
}
}

// release com object
if (hr != QTTabBarLib.Common.HResult.Ok && null != ppv)
{
Marshal.ReleaseComObject(ppv);
}
}
}
}
Expand All @@ -4947,8 +4953,6 @@ private void ListView_SelectionChanged(/*object sender, SelectionChangedEventArg
{
Explorer.Quit();
WindowUtils.CloseExplorer(ExplorerHandle, 0);


}
}
catch (Exception e)
Expand All @@ -4962,7 +4966,6 @@ private void ListView_SelectionChanged(/*object sender, SelectionChangedEventArg
{
QTUtility2.MakeErrorLog(e, "获取选中文件数据");
}


if (
this.TabCount == 1 &&
Expand Down

0 comments on commit 3a51a3e

Please sign in to comment.