对于想了解在Windows资源pipe理器中显示自定义标题或列的读者,本文将是一篇不可错过的文章,我们将详细介绍在windows资源管理器中,创建新的子目录,并且为您提供关于closuresWindo
对于想了解在Windows资源pipe理器中显示自定义标题或列的读者,本文将是一篇不可错过的文章,我们将详细介绍在windows资源管理器中,创建新的子目录,并且为您提供关于closuresWindows资源pipe理器的特定实例、dynamic添加项目到Windows资源pipe理器的上下文菜单、Java – 对Windows资源pipe理器等string进行sorting、python打开Windows资源pipe理器的有价值信息。
本文目录一览:- 在Windows资源pipe理器中显示自定义标题或列(在windows资源管理器中,创建新的子目录)
- closuresWindows资源pipe理器的特定实例
- dynamic添加项目到Windows资源pipe理器的上下文菜单
- Java – 对Windows资源pipe理器等string进行sorting
- python打开Windows资源pipe理器
在Windows资源pipe理器中显示自定义标题或列(在windows资源管理器中,创建新的子目录)
我的应用程序添加一些自定义元数据文件 我想要像这样在Windows资源pipe理器中显示它:
或这个:
Windows窗体.net框架中的位移控件
从Win XP以编程方式从C#中注销用户
为什么在Vista / 7中,RequestAdditionalTime()方法不能重新启动?
Windows服务 – 封装现有function
WinProcEvent一个或多个SetWinEventHookcallback?
有没有办法在.NET中做到这一点?
从.NET应用程序login到Windows
连接到sql Server 2008 R2 Express时出错
Amazon EC2 API和Windows实例 – 以任何方式获取驱动器号分配?
当父窗口最小化时如何防止子窗口的最小化
我如何枚举所有可用的无线networking并将其显示在列表框中?
它可以在XP上使用列处理程序外壳扩展完成 – 请参阅: http : //www.codeproject.com/Articles/3747/Explorer-column-handler-shell-extension-in-C#
但是,Vista和更高版本不支持IColumnHandler 。 在这里你必须实现PropertyHandler 。 请参阅Windows SDK SampleswinuiShellAppShellIntegrationPropertyHandlers 。
每个属性由属性模式XML文件描述。 此属性架构必须注册PSRegisterPropertySchema() 。 属性处理程序实现IInitializeWithXXX , IPropertyStore和可选的IPropertyStoreCapabilities 。 您必须为每个要处理的文件扩展名注册CLSID 。
不幸的是,你不能在注册中使用AllFileSystemObject或* 。
closuresWindows资源pipe理器的特定实例
我遇到了一个问题,试图WM_CLOSE一个窗口资源pipe理器的过程中,发送该消息,然后将尝试closuresWindows Shell浏览器进程,并提示用户closures窗口。 这不是预期的行为,我想知道如何解决它?
如何优雅地closures个人资源pipe理器窗口,而不必同时closures整个PC? 目标是具有相同的行为,就好像用户自己点击了Xbutton一样。
编辑:我发现,我能够获得所有浏览器进程的子窗口,但从那一点上我不知道如何确定哪些窗口是实际的,用户可见/可交互的资源pipe理器窗口。
11/21/2012 16:27:49 [12] DEBUG - Closing process with PID: 2680 11/21/2012 16:27:49 [12] DEBUG - Window has 11 descendant windows 11/21/2012 16:27:49 [12] DEBUG - Found child window: hWnd: 590746 Window State: normal 11/21/2012 16:27:49 [12] DEBUG - Found child window: 4:27 PM hWnd: 656010 Window State: normal 11/21/2012 16:27:49 [12] DEBUG - Found child window: hWnd: 2294392 Window State: normal 11/21/2012 16:27:49 [12] DEBUG - Found child window: hWnd: 1245586 Window State: normal 11/21/2012 16:27:49 [12] DEBUG - Found child window: User Promoted Notification Area hWnd: 2949496 Window State: normal 11/21/2012 16:27:49 [12] DEBUG - Found child window: System Promoted Notification Area hWnd: 1245548 Window State: normal 11/21/2012 16:27:49 [12] DEBUG - Found child window: hWnd: 852646 Window State: normal 11/21/2012 16:27:49 [12] DEBUG - Found child window: hWnd: 918356 Window State: normal 11/21/2012 16:27:49 [12] DEBUG - Found child window: Running applications hWnd: 1769950 Window State: normal 11/21/2012 16:27:49 [12] DEBUG - Found child window: Running applications hWnd: 1179980 Window State: normal 11/21/2012 16:27:49 [12] DEBUG - Found child window: TF_FloatingLangBar_WndTitle hWnd: 458926 Window State: normal
机器启动时运行exe
.NET中的DLL可以使用不同的扩展名,例如MLL?
任务pipe理器不同意Process Explorer?
为什么我的WPF应用程序不显示?
如何以编程方式更改LAN设置(代理configuration)
是否有可用于可移植类库的System.Environment.Machinename的等价物?
使用SystemParametersInfo协助
如何configurationtoolstripdropdownbutton大小以匹配父级下拉button的大小?
如何在registry中存储securestring?
当ReadOnly = false时,性能计数器显示不同的值
你怎么弄窗户? 你可以通过文本获得winapi调用的句柄,所以也许桌面资源管理器没有标题。 http://msdn.microsoft.com/en-us/library/windows/desktop/ms633499(v=vs.85).aspx查看lpWindowName参数。
另外,我只是猜测在这里,你可能会看到桌面浏览器和其他资源管理器实例之间的关系,只要它们与GetDesktopWindow()返回的hande相关http://msdn.microsoft.com/zh-cn/ -us /库/窗/桌面/ ms633504(v = vs.85)的.aspx
dynamic添加项目到Windows资源pipe理器的上下文菜单
我想要做到以下几点:
当用户右键单击任何文件(在Windows中)我想要上下文菜单popup一个特殊的项目。 我用regedit做了这个,我在互联网上跟着几个例子,并得到了这个
[HKEY_CLASSES_ROOT*shellDo something] [HKEY_CLASSES_ROOT*shellDo somethingcommand] @="notepad.exe %1"
这工作正常,但我想运行一个Java应用程序,并发送选定项目的文件path
当cmd通过上下文菜单运行时,PATHvariables不同
在通过Windows上下文菜单执行时,文件path中的空格会导致出现多个应用程序实例
C#Windows'Open With>'上下文菜单行为
通过上下文菜单打开超过15个文件没有MultipleInvokePromptMinimum
将我的程序添加到右键菜单
Python脚本不会从上下文菜单运行
在registry中添加上下文菜单
是否有可能获得在C#中的指定文件的资源pipe理器上下文菜单?
添加一个自定义“新build文件夹”到Windows资源pipe理器上下文菜单
将一个选项与Electron集成到资源pipe理器上下文菜单中
考虑运行批处理脚本文件,而不是将整个java命令放在注册表编辑器中。 这可能会更容易调试,因为您可以手动运行批处理文件并确保其正常工作。 只需用您的批处理文件替换“notepad.exe”。
您将需要将传递给批处理文件的参数传递给您的Java应用程序。 以下是对批处理文件中参数的快速参考: http : //www.robvanderwoude.com/parameters.PHP
Java – 对Windows资源pipe理器等string进行sorting
我正在尝试使用Sander Pham提出的另一个问题的代码。 我需要我的Java ArrayList的string名称进行sorting像Windows资源pipe理器。 他的代码只适用于一个问题。 我想就这个问题发表意见,但是我需要更多的声望来评论。 无论如何…他build议使用自定义的比较器实现的类,并使用它来比较string名称。 这是这个类的代码:
class IntuitiveStringComparator implements Comparator<String> { private String str1,str2; private int pos1,pos2,len1,len2; public int compare(String s1,String s2) { str1 = s1; str2 = s2; len1 = str1.length(); len2 = str2.length(); pos1 = pos2 = 0; int result = 0; while (result == 0 && pos1 < len1 && pos2 < len2) { char ch1 = str1.charat(pos1); char ch2 = str2.charat(pos2); if (Character.isDigit(ch1)) { result = Character.isDigit(ch2) ? compareNumbers() : -1; } else if (Character.isLetter(ch1)) { result = Character.isLetter(ch2) ? compareOther(true) : 1; } else { result = Character.isDigit(ch2) ? 1 : Character.isLetter(ch2) ? -1 : compareOther(false); } pos1++; pos2++; } return result == 0 ? len1 - len2 : result; } private int compareNumbers() { // Find out where the digit sequence ends,save its length for // later use,then skip past any leading zeroes. int end1 = pos1 + 1; while (end1 < len1 && Character.isDigit(str1.charat(end1))) { end1++; } int fullLen1 = end1 - pos1; while (pos1 < end1 && str1.charat(pos1) == ''0'') { pos1++; } // Do the same for the second digit sequence. int end2 = pos2 + 1; while (end2 < len2 && Character.isDigit(str2.charat(end2))) { end2++; } int fullLen2 = end2 - pos2; while (pos2 < end2 && str2.charat(pos2) == ''0'') { pos2++; } // If the remaining subsequences have different lengths,// they can''t be numerically equal. int delta = (end1 - pos1) - (end2 - pos2); if (delta != 0) { return delta; } // We''re looking at two equal-length digit runs; a sequential // character comparison will yield correct results. while (pos1 < end1 && pos2 < end2) { delta = str1.charat(pos1++) - str2.charat(pos2++); if (delta != 0) { return delta; } } pos1--; pos2--; // They''re numerically equal,but they may have different // numbers of leading zeroes. A final length check will tell. return fullLen2 - fullLen1; } private int compareOther(boolean isLetters) { char ch1 = str1.charat(pos1); char ch2 = str2.charat(pos2); if (ch1 == ch2) { return 0; } if (isLetters) { ch1 = Character.toupperCase(ch1); ch2 = Character.toupperCase(ch2); if (ch1 != ch2) { ch1 = Character.toLowerCase(ch1); ch2 = Character.toLowerCase(ch2); } } return ch1 - ch2; } }
在使用它的时候,除了string名字后面没有数字之外,它的效果很好。 如果它没有一个数字,它就放在列表的最后,这是错误的。 如果没有数字,应该是在开始。
即
filename.jpg filename2.jpg filename03.jpg filename3.jpg
目前它sorting…
与fileName失败的exec.Command包含两个空格
如何注入自定义窗口到Windows资源pipe理器
在mac os上获取新创build文件的通知?
filename2.jpg filename03.jpg filename3.jpg filename.jpg
在代码中需要更改什么来纠正这种行为?
谢谢
这是我第二次尝试回答这个问题。 我用http://www.interact-sw.co.uk/iangblog/2007/12/13/natural-sorting作为开始。 不幸的是,我认为我也发现了问题。 但我认为在我的代码中这些问题是正确的。
信息:Windows资源管理器使用API函数StrCmpLogicalW()函数进行排序。 那里被称为自然排序 。
所以这里是我的WindowsExplorerSort uncentanding – 算法:
文件名是部分明智的比较。 到目前为止,我确定了以下几个部分: 数字 。 '', 空间和其他 。
文件名中的每个数字都被认为是可能的数字比较。
数字作为数字进行比较,但是如果它们相等,则较长的基本字符串首先出现。 这发生在前导零。
filename00.txt,filename0.txt
如果将数字部分与非数字部分进行比较,则将其作为文本进行比较。
文本将被比较为不区分大小写。
此列表部分基于尝试和错误。 我增加了测试文件名的数量,以解决更多的注释中提到的陷阱,结果是检查对Windows资源管理器。
所以这是这个的输出:
filename filename 00 filename 0 filename 01 filename.jpg filename.txt filename00.jpg filename00a.jpg filename00a.txt filename0 filename0.jpg filename0a.txt filename0b.jpg filename0b1.jpg filename0b02.jpg filename0c.jpg filename01.0hjh45-test.txt filename01.0hjh46 filename01.1hjh45.txt filename01.hjh45.txt Filename01.jpg Filename1.jpg filename2.hjh45.txt filename2.jpg filename03.jpg filename3.jpg
新的比较器WindowsExplorerComparator在已经提到的部分中分割文件名,并对两个文件名进行部分明智的比较。 为了正确,新的比较器使用字符串作为输入,所以必须创建一个适配器比较器
new Comparator<File>() { private final Comparator<String> NATURAL_SORT = new WindowsExplorerComparator(); @Override public int compare(File o1,File o2) {; return NATURAL_SORT.compare(o1.getName(),o2.getName()); } }
所以这里是新的比较器源代码和测试:
import java.io.File; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.Iterator; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; public class WindowsSorter { public static void main(String args[]) { //huge test data set ;) List<File> filenames = Arrays.asList(new File[]{new File("Filename01.jpg"),new File("filename"),new File("filename0"),new File("filename 0"),new File("Filename1.jpg"),new File("filename.jpg"),new File("filename2.jpg"),new File("filename03.jpg"),new File("filename3.jpg"),new File("filename00.jpg"),new File("filename0.jpg"),new File("filename0b.jpg"),new File("filename0b1.jpg"),new File("filename0b02.jpg"),new File("filename0c.jpg"),new File("filename00a.jpg"),new File("filename.txt"),new File("filename00a.txt"),new File("filename0a.txt"),new File("filename01.0hjh45-test.txt"),new File("filename01.0hjh46"),new File("filename2.hjh45.txt"),new File("filename01.1hjh45.txt"),new File("filename01.hjh45.txt"),new File("filename 01"),new File("filename 00")}); //adaptor for comparing files Collections.sort(filenames,new Comparator<File>() { private final Comparator<String> NATURAL_SORT = new WindowsExplorerComparator(); @Override public int compare(File o1,o2.getName()); } }); for (File f : filenames) { System.out.println(f); } } public static class WindowsExplorerComparator implements Comparator<String> { private static final Pattern splitPattern = Pattern.compile("\d+|\.|\s"); @Override public int compare(String str1,String str2) { Iterator<String> i1 = splitStringPreserveDelimiter(str1).iterator(); Iterator<String> i2 = splitStringPreserveDelimiter(str2).iterator(); while (true) { //Til here all is equal. if (!i1.hasNext() && !i2.hasNext()) { return 0; } //first has no more parts -> comes first if (!i1.hasNext() && i2.hasNext()) { return -1; } //first has more parts than i2 -> comes after if (i1.hasNext() && !i2.hasNext()) { return 1; } String data1 = i1.next(); String data2 = i2.next(); int result; try { //If both datas are numbers,then compare numbers result = Long.compare(Long.valueOf(data1),Long.valueOf(data2)); //If numbers are equal than longer comes first if (result == 0) { result = -Integer.compare(data1.length(),data2.length()); } } catch (NumberFormatException ex) { //compare text case insensitive result = data1.comparetoIgnoreCase(data2); } if (result != 0) { return result; } } } private List<String> splitStringPreserveDelimiter(String str) { Matcher matcher = splitPattern.matcher(str); List<String> list = new ArrayList<String>(); int pos = 0; while (matcher.find()) { list.add(str.substring(pos,matcher.start())); list.add(matcher.group()); pos = matcher.end(); } list.add(str.substring(pos)); return list; } } }
如果您正在排序或者可以将其表示为文件集合,则可能需要查看Apache Commons IO库NameFileComparator类。 这提供了几个预构建的比较器,你可以利用它来完成你正在寻找的东西。 例如,NAME_INSENSITIVE_COMParaTOR应该做你想要的。
List<File> filenames = Arrays.asList(new File[] { new File("Filename01.jpg"),new File("filename3.jpg")}); Collections.sort(filenames,NameFileComparator.NAME_INSENSITIVE_COMParaTOR); for (File f : filenames) { System.out.println(f); }
输出:
filename.jpg Filename01.jpg filename03.jpg Filename1.jpg filename2.jpg filename3.jpg
在比较方法中切换第一个-1和第一个的符号:
if (Character.isDigit(ch1)) { result = Character.isDigit(ch2) ? compareNumbers() : 1; } else if (Character.isLetter(ch1)) { result = Character.isLetter(ch2) ? compareOther(true) : 1; }
这些决定了当第一个字符串有一个数字但是第二个字符串没有,或者第一个字符串不是第二个字符串时的顺序。
只是从评论中完成我的建议。 这是一个恕我直言更好的可读版本的比较器,(希望)按您需要的方式排序。 主要逻辑就像我所说的那样:
//Compare the namepart caseinsensitive. int result = data1.name.comparetoIgnoreCase(data2.name); //If name is equal,then compare by number if (result == 0) { result = data1.number.compareto(data2.number); } //If numbers are equal then compare by length text of number. This //is valid because it differs only by heading zeros. Longer comes //first. if (result == 0) { result = -Integer.compare(data1.numberText.length(),data2.numberText.length()); } //If all above is equal,compare by ext. if (result == 0) { result = data1.ext.compareto(data2.ext); }
如您所见,这是一个动态版本,可以处理名称和扩展名,而不需要任何假设。 我在这个小测试程序中包含了你的第一个和你在评论中添加的测试数据。
所以这里是你的测试数据的排序输出:
filename.jpg filename00.jpg filename0.jpg Filename01.jpg Filename1.jpg filename2.jpg filename03.jpg filename3.jpg filename0b.jpg filename0b1.jpg filename0b02.jpg filename0c.jpg
最后但并非最不重要的完整代码:
import java.io.File; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; public class WindowsSorter { public static void main(String args[]) { List<File> filenames = Arrays.asList(new File[]{new File("Filename01.jpg"),new File("filename0c.jpg")}); Collections.sort(filenames,new WindowsLikeComparator()); for (File f : filenames) { System.out.println(f); } } private static class WindowsLikeComparator implements Comparator<File> { //Regexp to make the 3 part split of the filename. private static final Pattern splitPattern = Pattern.compile("^(.*?)(\d*)(?:\.([^.]*))?$"); @Override public int compare(File o1,File o2) { SplitteFileName data1 = getSplittedFileName(o1); SplitteFileName data2 = getSplittedFileName(o2); //Compare the namepart caseinsensitive. int result = data1.name.comparetoIgnoreCase(data2.name); //If name is equal,compare by ext. if (result == 0) { result = data1.ext.compareto(data2.ext); } return result; } private SplitteFileName getSplittedFileName(File f) { Matcher matcher = splitPattern.matcher(f.getName()); if (matcher.matches()) { return new SplitteFileName(matcher.group(1),matcher.group(2),matcher.group(3)); } else { return new SplitteFileName(f.getName(),null,null); } } static class SplitteFileName { String name; Long number; String numberText; String ext; public SplitteFileName(String name,String numberText,String ext) { this.name = name; if ("".equals(numberText)) { this.number = -1L; } else { this.number = Long.valueOf(numberText); } this.numberText = numberText; this.ext = ext; } } } }
编辑1:该算法已更改为地址filename00,filename0排序问题。
编辑2:深入探索Windows Explorers排序算法后,很明显,这个答案确实是原始发布和测试数据的解决方案 – 这就是为什么我不会删除它 – 但不是一个完整的解决方案模仿Windows资源管理器的行为。 因此,我将提供另一个希望更完整的解决方案。
总结
以上是小编为你收集整理的Java – 对Windows资源pipe理器等string进行sorting全部内容。
如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。
python打开Windows资源pipe理器
请形象这样的情况:本地文件的图标显示在一个GUI中,右键单击该图标,popup一个上下文菜单,在浏览器中select:显示文件。 单击该选项,然后打开一个资源pipe理器窗口,并select特定的文件。 许多编辑器都有这样的function:在文件夹中显示或在资源pipe理器中显示
事实上,GUI是由PyQt构build的,我的第一个想法很简单,就是打开一个subprocess并通过命令行:
explorer /select,a_full_path_name
这个行为确实是我所需要的,但是当再次点击“显示在文件夹中”时,一个新的资源pipe理器窗口将被打开,甚至旧的窗口也会被打开! 一个顽皮的男孩如何点一下“在文件夹中展示”几十次? 所以我只需要一个窗口,如果存在一个旧窗口,就把它提到前面。
Linux超过启发式提交
c#:如何在Windows客户端上使用C#以编程方式login和pipe理Linux服务器?
Linux进程内存scheme
如何以编程方式切换到compiz中的特定窗口?
为什么更改regkey ProxySettingsPerUser不会影响IneternetSetoption(),如果WinInet库已经在进程中加载
命令start /D a_path . 可能会让淘气的男孩失望(运行几次,只有一个窗口),但是,没有select突出显示选定的文件,因此也让我失望…
如上所述,许多编辑有这样一个“在文件夹中显示”function,但令我惊讶的是, PyCharm “在资源pipe理器中显示”将在同一文件上打开多个窗口,同时还有CodeBlocks “打开包含文件夹” 程序员的记事本 “打开包含文件夹”将始终只打开同一个文件中的一个文件夹(说实话,我只有3个编辑器在我的电脑除了Windows记事本:)
我的问题:
上述function是否可以通过windows cmd实现?
如果不能,是否有python的方式来实现呢?
事实上,我发现在stackoverflow中有几个相关的问题,但是我的问题还没有解决,有人会帮我一个忙吗?
将命令或脚本导出到另一个python脚本
快速查找使用Linux的所有本地networking中是否打开端口
mmap和内存使用情况
当您最小化应用程序时,Windows会做些什么?
Java 8与Jetty在Linux内存问题
最后,一个好人引导我回答。
它来自https://github.com/exaile/exaile/blob/master/xl/common.py#L350
在py3 +中
import ctypes ctypes.windll.ole32.CoInitialize(None) upath = r"C:Windows" pidl = ctypes.windll.shell32.ILCreateFromPathW(upath) ctypes.windll.shell32.SHOpenFolderAndSelectItems(pidl,None,0) ctypes.windll.shell32.ILFree(pidl) ctypes.windll.ole32.CoUninitialize()
在py2 +中
只要给一个unicode路径。
注意: ILCreateFromPathW (Unicode)和ILCreateFromPathA (ANSI)
今天关于在Windows资源pipe理器中显示自定义标题或列和在windows资源管理器中,创建新的子目录的分享就到这里,希望大家有所收获,若想了解更多关于closuresWindows资源pipe理器的特定实例、dynamic添加项目到Windows资源pipe理器的上下文菜单、Java – 对Windows资源pipe理器等string进行sorting、python打开Windows资源pipe理器等相关知识,可以在本站进行查询。
本文标签: