그래서 좀 더 창조적 인 구글 검색 한 후, 나는 여기에 shdocvw.dll (마이크로 소프트 인터넷 컨트롤)로 설정 참조하여, VB/A에서
shdocvw.dll을
에서 ShellWindows 클래스를 사용하는 방법을 발견 나는 때문에 어떤 이유로 FocusedItem가 아무것도하지 않을 다음 다시 시작 오류에 사용했다
Function GetSelectedFilesInWinExplorers() As Collection
Dim Result As New Collection
Dim ExpWin As Object
Set ExpWin = New SHDocVw.ShellWindows
Dim CurrWin As SHDocVw.InternetExplorer
On Error Resume Next
Dim CurrSelFile As String
For Each CurrWin In ExpWin
If Not CurrWin.Document Is Nothing Then
If Not CurrWin.Document.FocusedItem Is Nothing Then
CurrSelFile = CurrWin.Document.FocusedItem.Path
If CurrSelFile <> "" Then
Result.Add CurrSelFile
Debug.Print CurrSelFile
End If
CurrSelFile = ""
End If
End If
Next CurrWin
Set GetSelectedFilesInWinExplorers = Result
End Function
하지만 것 : 코드는 그냥 열려있는 모든 Explorer 창에서 선택한 모든 파일 이름의 컬렉션을 가져 오는 데 사용 여전히 오류가 발생합니다. 그것과 나는이 문맥에서 그것을 사용하는 것에 대해 정말로 신경 쓰지 않는다.
레이몬드 첸 (Raymond Chen)이이 블로그 게시물로 정확히 귀하의 질문에 답변했다고 생각합니다. http://blogs.msdn.com/oldnewthing/archive/2004/07/20/188696.aspx 그 인상적인 코드는 생각하지만 그분이 말했듯이 "이것은 본질적으로 어려운 작업이 아니며 많은 작은 조각들을 모아야합니다." ;) –