Created
March 28, 2014 09:29
-
-
Save kumatti1/9828829 to your computer and use it in GitHub Desktop.
エクスプローラ検索
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Option Explicit | |
Declare Function ILCreateFromPathW& Lib "Shell32.dll" (ByVal pszPath&) | |
Declare Sub MoveMemory Lib "kernel32" Alias "RtlMoveMemory" _ | |
(Destination As Any, Source As Any, ByVal Length As Long) | |
Declare Sub ILFree Lib "Shell32.dll" (ByVal pidl&) | |
Declare Function ILGetSize& Lib "Shell32.dll" (ByVal pidl&) | |
Private Declare _ | |
Function InitVariantFromBuffer Lib "propsys.dll" ( _ | |
ByVal pv As LongPtr, _ | |
ByVal cb As Long, _ | |
ByRef pvar As Variant _ | |
) As Long | |
Sub test() | |
Dim IE As Object | |
Dim tmp&, pidl&, v, strPath$, hr& | |
strPath = "d:\" | |
pidl = ILCreateFromPathW(StrPtr(strPath)) | |
hr = InitVariantFromBuffer(pidl, ILGetSize(pidl), v) | |
If hr <> 0 Then Exit Sub | |
Set IE = CreateObject("Shell.Application").Windows.findwindowSW(v, Empty, 1&, tmp, 1&) | |
Debug.Print IE Is Nothing, tmp | |
ILFree pidl | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment