|
-
Mar 29th, 2019, 06:37 AM
#1
Thread Starter
Addicted Member
-
Mar 29th, 2019, 04:30 PM
#2
Re: Highlight a filename in the current directory (explorer window)
Try this...
Code:
Process.Start("explorer.exe", "/select," & "PATH_TO_FILETOSELECT")
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Mar 29th, 2019, 05:18 PM
#3
Re: Highlight a filename in the current directory (explorer window)
 Originally Posted by .paul.
Try this...
Code:
Process.Start("explorer.exe", "/select," & "PATH_TO_FILETOSELECT")
Doesn't that start a new explorer, which he stated he didn't want.
 Originally Posted by Precision999
...
Something similar was done in this post, but I need to work with the current explorer window, not open a new one.
Is this possible?
...
-
Mar 29th, 2019, 05:21 PM
#4
Re: Highlight a filename in the current directory (explorer window)
 Originally Posted by passel
Doesn't that start a new explorer, which he stated he didn't want.
I noticed that after i posted. I had a look in spy++. Don't think that's possible that way. Doesn't classic vb have a curdir method? Is there something similar for setting the current file?
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Mar 29th, 2019, 05:26 PM
#5
Re: Highlight a filename in the current directory (explorer window)
Might be possible with SendKeys...
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Apr 1st, 2019, 03:11 AM
#6
Thread Starter
Addicted Member
Re: Highlight a filename in the current directory (explorer window)
Thanks for replies guys.
I do indeed need this to work with the current window rather then opening a new one. I'm not sure how Sendkeys would help, but from experience I'm sure that using it would bite me in the bum at some point or another!
Maybe I need to get the name of the window I'm in - but that still leaves how to 'select' the file - I've no idea how to do that.
Would a different copy method help? - maybe there's a way to do it which leaves the file selected as part of it's process?
Currently I'm just using:
Code:
mydir = Directory.GetCurrentDirectory()
My.Computer.FileSystem.CopyFile(<filename and path to copy>, mydir & "\<name of destination file>")
-
Apr 1st, 2019, 05:42 AM
#7
Re: Highlight a filename in the current directory (explorer window)
hi,
this will return what is selected in the "current" Explorer, see if this helps
the selected Files I added to a Listbox
Code:
Option Strict On
'Add Ref. COM :
'1)Microsoft Shell Controls
'2)Microsoft Shell Controls and Automation
Imports Shell32
Imports SHDocVw
Public Class Form1
Private Function GetExplorerSelectedFiles() As String()
Dim ExplorerFiles As New List(Of String)
Dim exShell As New Shell
For Each window As ShellBrowserWindow In DirectCast(exShell.Windows, IShellWindows)
' check both for either interface to work
' add an Exit for to just work the first explorer window
If TryCast(window.Document, IShellFolderViewDual) IsNot Nothing Then
For Each fi As FolderItem In DirectCast(window.Document, IShellFolderViewDual).SelectedItems
ExplorerFiles.Add(fi.Path)
Next
ElseIf TryCast(window.Document, ShellFolderView) IsNot Nothing Then
For Each fi As FolderItem In DirectCast(window.Document, ShellFolderView).SelectedItems
ExplorerFiles.Add(fi.Path)
Next
End If
Next
Return ExplorerFiles.ToArray
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim files = GetExplorerSelectedFiles()
ListBox1.Items.AddRange(files)
End Sub
End Class
HTH
to hunt a species to extinction is not logical !
since 2010 the number of Tigers are rising again in 2016 - 3900 were counted. with Baby Callas it's 3901, my wife and I had 2-3 months the privilege of raising a Baby Tiger.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|