Created
December 31, 2015 08:28
-
-
Save kumatti1/b76b7fe81cc86efee82b 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 | |
Private Declare PtrSafe Function ILCreateFromPathW Lib "Shell32.dll" (ByVal pszPath As LongPtr) As Long | |
Private Declare PtrSafe Function SHGetIDispatchForFolder Lib "shdocvw.dll" (ByVal pidl As Long, arg2 As Any) As Long | |
Private Declare PtrSafe Sub ILFree Lib "Shell32.dll" (ByVal pidl As Long) | |
Private Declare PtrSafe Function SHGetSpecialFolderLocation Lib "Shell32" (ByVal hwndOwner As LongPtr, ByVal nFolder As Long, ppidl As Any) As Long | |
Const CSIDL_PERSONAL = &H5 | |
Sub hoge() | |
Dim pidl&, hr& | |
'pidl = ILCreateFromPathW(StrPtr("C:\")) | |
SHGetSpecialFolderLocation 0, CSIDL_PERSONAL, pidl | |
Dim o As Object | |
hr = SHGetIDispatchForFolder(pidl, o) | |
Debug.Print TypeName(o), hr | |
ILFree pidl | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment