<< 이 강좌는 오른쪽 링크의 강좌와 연계돼 있습니다. http://www.abyul.com/zbxe/138852 >>
예전에 적어놨던 거 같은데.. 없네요? ^_^:;
못 찾는건가.. 이 넘의 홈페이지가 구조가 너무 지랄 맞아서.. ㅎㅎ
암튼.. 정리합니다.
MS 오피스에 64비트 버전이 생기면서 여러가지가 달라졌지만..
엑셀 추가기능을 개발하는 입장에서는 API선언이 좀 귀찮아진게 가장 표면적으로 와 닿는 문제네요..
VBE(Visual Basic Editor)창에서 F1눌러서 도움말 창을 띄우신 다음,
검색란에 "64비트"로 검색해보시면 많은 정보를 얻으실 수 있을 겁니다.
그 중에서 "64비트 Visual Basic for Applications 개요"라는 도움말이 제일 맘에 드네요.
그건 각자 검색해보시구요.. ^^
여기다 카피해 넣어봤자 의미가 없을 것 같구요.. 제 나름 설명을 하자면..
1. 일반적인 32비트 코드도 64비트에서 에러가 안납니다.
2. 에러는 Windows API를 호출하는 Declare문에서 발생합니다.
3. 예를 들어보겠습니다.
활성창의 핸들값을 갖고 오는 GetActiveWindows라는 API를 선언해보겠습니다.
[ 32비트에서는 아래처럼 선언했었죠.. ]
Private Declare Function GetActiveWindow Lib "user32" () As Long
[ 64비트에서는 아래처럼 선언해야합니다. ]
Private Declare PtrSafe Function GetActiveWindow Lib "user32" () As LongPtr
도움말을 참조하자면..
PtrSafe : PtrSafe 키워드는 64비트 버전의 Office에서 Declare 문이 안전하게 실행됨을 나타냅니다.
LongPtr : VBA에 변수 형식의 별칭 LongPtr이 추가되었습니다. LongPtr이 확인되는 실제 데이터 형식은 실행 중인 Office 버전에 따라 다릅니다. 32비트 버전의 Office에서는 LongPtr이 Long으로 확인되고, 64비트 버전의 Office에서는 LongPtr이 LongLong으로 확인됩니다. LongPtr은 포인터 및 핸들에 사용됩니다
그냥 64비트만 사용한다고 하면.. 위 선언문의 LongPtr은 LongLong로 바꾸셔도 됩니다만..
확장성 없이 코딩하는 건 좀 아마추어같죠.. ㅎㅎ
그리하여...
32비트와 64비트에서 모두 사용할 수 있는 코드를 작성해보겠습니다.
#If VBA7 Then
#If Win64 Then
Private Declare PtrSafe Function GetActiveWindow Lib "user32" () As LongPtr
#Else
Private Declare Function GetActiveWindow Lib "user32" () As Long
#End If
#Else
Private Declare Function GetActiveWindow Lib "user32" () As Long
#End If
[ 설명 ]
#If...Then...#Else 지시문은 Visual Basic 코드 중 선택된 블록들만 조건부로 컴파일합니다.
라고 도움말에 나와 있습니다.
"#IF"를 검색해보시면 관련 도움말이 나옵니다.
시스템의 사양에 따라서 해당하는 코드만 컴파일해서 실행한다는 얘기죠..
VBA7 은 컴파일러 상수라고 해서.. 시스템에 따라서 True 또는 False 값을 갖습니다.
오피스 2010에선 VBA7이 True값을 갖지만.. 그 하위 버전의 엑셀에서는 False 값을 갖습니다.
비슷하게 VBA6, WIN32, WIN64 같은게 있습니다. 코드가 실행되는 시스템에 따라, TRUE 또는 FALSE 값을 갖지요..
위 선언문을 좀 요약하면 아래와 같습니다.
좀 알아보기 쉬워졌죠?
#If VBA7 Then
#If Win64 Then
오피스 2010이면서 64비트 일때 선언할 선언문..
#Else
오피스 2010이지만 64비트가 아닐때.. 즉 32비트일때의 선언문..
#End If
#Else
그렇지 않은 경우.. 오피스 2007이나 2003 또는 이하 버전..
#End If
어차피 현재 64비트 오피스는 엑셀2010뿐이니까..
아래처럼 간략하게 작성해도 됩니다.
#If Win64 Then
64비트 일때 선언할 선언문..
#Else
그렇지 않은 경우.. 오피스 2010 32비트나.. 오피스 2007이나 2003 또는 이하 버전..
#End If
이때 유의해야할게..
1. 오피스 2010이면서 64비트일때의 선언문을 작성할때에는..
Declare 단어 뒤에 PtrSafe를 삽입해주시구요.. 결과값이 Long 형이라면 LongPtr 형으로 변경해줍니다.
2. API의 결과물을 사용하는 변수형도 LongPtr로 선언해주셔야겠죠?
아니면 강제로 Long형으로 변환해버리는 CLng()를 사용하셔야합니다.
훨씬 큰 숫자 범위를 갖는 LongLong형을 작은 범위를 갖는 Long형에 때려 넣기 때문에..
결과값이 Long의 숫자 범위를 벗어나는 숫자였다면 정보가 유실되어 버리겠죠?.. 이것만 주의하시면 됩니다.
머.. 새벽에 주저리 주저리 작성해서 도움이 되실지.. ㅎㅎ
졸리네요.. ^_^;;
잘 이해 안가시면 댓글 남기세요..
보강해드리겠습니다.
즐거운 하루 보내세요.. ^^)/
참고로..
VB전처리구문에 대한 자세한 설명은 아래 카페의 게시물을 참고하세요...
http://cafe.naver.com/xlsvba/3439
참고로..
네이버 클럽.. 엑셀 하루에 하나씩에서 활동중이신 리에님이 공개해주신 컬러픽커 클래스를
64비트 엑셀 2010에서도 사용할 수 있도록 수정한 파일을 공유합니다.
실제 적용예를 파일로 보시는게 확실할 것 같아 올려놓습니다.
다운 받기 : VBA_API__ColorPicker_For_64bit.xlsm
[ 참고사이트 ]
1. MSDN Office 2010 32비트 버전과 64비트 버전 간의 호환성
2. MS에서 제공하는 Help파일 다운로드 : Win32 API를 64비트로 선언하는 방법과 상수들 목록이 있다.
http://www.microsoft.com/download/en/confirmation.aspx?id=9970
위 사이트에 들어가면 "Office2010Win32API_PtrSafe.exe"을 다운 받을 수 있다.
실행파일이라 다운 받기 그러면.. 이글에 첨부된 "Win32API_PtrSafe.TXT" 파일을 다운 받아도 된다.
댓글 '2'
많이 사용하는 API함수를 64비트에서 사용할 수 있도록 코드를 제공한 사이트가 있어 링크합니다.
From. http://www.jkp-ads.com/articles/apideclarations.asp
FindWindow | Private Declare Function FindWindow Lib "USER32" Alias "FindWindowA" (ByVal lpClassName As String, ByVallpWindowName As String) As Long Private Declare PtrSafe Function FindWindow Lib "USER32" Alias "FindWindowA" (ByVal lpClassName As String,ByVal lpWindowName As String) As LongPtr |
FindWindowEx | Private Declare Function FindWindowEx Lib "USER32" _ Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, _ ByVal lpsz1 As String, ByVal lpsz2 As String) As Long Private Declare PtrSafe Function FindWindowEx Lib "USER32" _ Alias "FindWindowExA" (ByVal hWnd1 As LongPtr, ByVal hWnd2 As LongPtr, _ ByVal lpsz1 As String, ByVal lpsz2 As String) As LongPtr |
GdipCreateBitmapFromFile | Private Declare Function GdipCreateBitmapFromFile Lib "GDIPlus" (ByVal filename As Long, bitmap As Long) AsLong Private Declare PtrSafe Function GdipCreateBitmapFromFile Lib "GDIPlus" (ByVal filename As LongPtr, bitmapAs LongPtr) As LongPtr |
GdipCreateHBITMAPFromBitmap | Private Declare Function GdipCreateHBITMAPFromBitmap Lib "GDIPlus" (ByVal bitmap As Long, hbmReturn As Long,ByVal background As Long) As Long Private Declare PtrSafe Function GdipCreateHBITMAPFromBitmap Lib "GDIPlus" (ByVal bitmap As LongPtr, hbmReturn As LongPtr, ByVal background As Long) As LongPtr |
GdipDisposeImage | Private Declare Function GdipDisposeImage Lib "GDIPlus" (ByVal image As Long) As Long Private Declare PtrSafe Function GdipDisposeImage Lib "GDIPlus" (ByVal image As LongPtr) As LongPtr |
GdiplusShutdown | Private Declare Function GdiplusShutdown Lib "GDIPlus" (ByVal token As Long) As Long Private Declare PtrSafe Function GdiplusShutdown Lib "GDIPlus" (ByVal token As LongPtr) As LongPtr |
GdiplusStartup | Private Declare Function GdiplusStartup Lib "GDIPlus" (token As Long, inputbuf As GdiplusStartupInput,Optional ByVal outputbuf As Long = 0) As Long Private Type GdiplusStartupInput GdiplusVersion As Long DebugEventCallback As Long SuppressBackgroundThread As Long SuppressExternalCodecs As Long End Type Private Declare PtrSafe Function GdiplusStartup Lib "GDIPlus" (token As LongPtr, inputbuf AsGdiplusStartupInput, Optional ByVal outputbuf As LongPtr = 0) As LongPtr Private Type GdiplusStartupInput GdiplusVersion As Long DebugEventCallback As LongPtr SuppressBackgroundThread As Long SuppressExternalCodecs As Long End Type |
GetClassName | Public Declare Function GetClassName Lib "USER32" Alias "GetClassNameA" _ (ByVal hWnd As Long, ByVal lpClassName As String, _ ByVal nMaxCount As Long) As Long Public Declare PtrSafe Function GetClassName Lib "USER32" Alias "GetClassNameA" _ (ByVal hWnd As LongPtr, ByVal lpClassName As String, _ ByVal nMaxCount As LongPtr) As Long |
GetDiskFreeSpaceEx | Private Declare Function GetDiskFreeSpaceEx Lib "kernel32" _ Alias "GetDiskFreeSpaceExA" (ByVal lpDirectoryName As String, _ lpFreeBytesAvailableToCaller As Currency, _ lpTotalNumberOfBytes As Currency, _ lpTotalNumberOfFreeBytes As Currency) As Long Private Declare PtrSafe Function GetDiskFreeSpaceEx Lib "kernel32" Alias _ "GetDiskFreeSpaceExA" (ByVal lpDirectoryName As String, _ lpFreeBytesAvailableToCaller As Currency, lpTotalNumberOfBytes As _ Currency, lpTotalNumberOfFreeBytes As Currency) As LongPtr |
getDC | Private Declare Function GetDC Lib "USER32" (ByVal hWnd As Long) As Long Private Declare PtrSafe Function GetDC Lib "USER32" (ByVal hWnd As LongPtr) As LongPtr |
GetDesktopWindow | Public Declare Function GetDesktopWindow Lib "USER32" () As Long Public Declare PtrSafe Function GetDesktopWindow Lib "USER32" () As LongPtr |
getDeviceCaps | Private Declare Function GetDeviceCaps Lib "gdi32" (ByVal hDC As Long, ByVal nIndex As Long) As Long Private Declare PtrSafe Function GetDeviceCaps Lib "gdi32" (ByVal hDC As LongPtr, ByVal nIndex As Long) AsLong |
GetDriveType | Private Declare Function GetDriveType Lib "kernel32" Alias _ "GetDriveTypeA" (ByVal sDrive As String) As Long Private Declare PtrSafe Function GetDriveType Lib "kernel32" Alias _ "GetDriveTypeA" (ByVal sDrive As String) As LongPtr |
GetExitCodeProcess | #If VBA7 Then Declare PtrSafe Function GetExitCodeProcess Lib "kernel32" (ByVal _ hProcess As LongPtr, lpExitCode As Long) As Long #Else Declare Function GetExitCodeProcess Lib "kernel32" (ByVal _ hProcess As Long, lpExitCode As Long) As Long #End If |
GetForegroundWindow | Declare Function GetForegroundWindow Lib "user32.dll" () As Long Declare PtrSafe Function GetForegroundWindow Lib "user32.dll" () As LongPtr |
getFrequency | Declare Function getFrequency Lib "kernel32" Alias "QueryPerformanceFrequency" (cyFrequency As Currency) AsLong Private Declare PtrSafe Function getFrequency Lib "kernel32" Alias "QueryPerformanceFrequency" (cyFrequency As Currency) As Long |
GetKeyState | Declare Function GetKeyState Lib "USER32" (ByVal vKey As Long) As Integer Declare PtrSafe Function GetKeyState Lib "USER32" (ByVal vKey As Long) As Integer |
GetLastInputInfo | #If VBA7 Then Private Type LASTINPUTINFO cbSize As LongPtr dwTime As LongPtr End Type Private Declare PtrSafe Sub GetLastInputInfo Lib "USER32" (ByRef plii As LASTINPUTINFO) #Else Private Type LASTINPUTINFO cbSize As Long dwTime As Long End Type Private Declare Sub GetLastInputInfo Lib "USER32" (ByRef plii As LASTINPUTINFO) #End If |
GetOpenFileName | Option Explicit #If VBA7 Then Public Declare PtrSafe Function GetOpenFileName Lib "comdlg32.dll" Alias _ "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long Public Type OPENFILENAME lStructSize As Long hwndOwner As LongPtr hInstance As LongPtr lpstrFilter As String lpstrCustomFilter As String nMaxCustFilter As Long nFilterIndex As Long lpstrFile As String nMaxFile As Long lpstrFileTitle As String nMaxFileTitle As Long lpstrInitialDir As String lpstrTitle As String flags As Long nFileOffset As Integer nFileExtension As Integer lpstrDefExt As String lCustData As Long lpfnHook As LongPtr lpTemplateName As String End Type #Else Public Declare Function GetOpenFileName Lib "comdlg32.dll" Alias _ "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long Public Type OPENFILENAME lStructSize As Long hwndOwner As Long hInstance As Long lpstrFilter As String lpstrCustomFilter As String nMaxCustFilter As Long nFilterIndex As Long lpstrFile As String nMaxFile As Long lpstrFileTitle As String nMaxFileTitle As Long lpstrInitialDir As String lpstrTitle As String flags As Long nFileOffset As Integer nFileExtension As Integer lpstrDefExt As String lCustData As Long lpfnHook As Long lpTemplateName As String End Type #End If '///////////////////////////////// '// End code GetOpenFileName // '///////////////////////////////// Public Function GetMyFile(strTitle As String) As String Dim OpenFile As OPENFILENAME Dim lReturn As Long OpenFile.lpstrFilter = "" OpenFile.nFilterIndex = 1 OpenFile.hwndOwner = 0 OpenFile.lpstrFile = String(257, 0) #If VBA7 Then OpenFile.nMaxFile = LenB(OpenFile.lpstrFile) - 1 OpenFile.lStructSize = LenB(OpenFile) #Else OpenFile.nMaxFile = Len(OpenFile.lpstrFile) - 1 OpenFile.lStructSize = Len(OpenFile) #End If OpenFile.lpstrFileTitle = OpenFile.lpstrFile OpenFile.nMaxFileTitle = OpenFile.nMaxFile OpenFile.lpstrInitialDir = "C:\" OpenFile.lpstrTitle = strTitle OpenFile.flags = 0 lReturn = GetOpenFileName(OpenFile) If lReturn = 0 Then GetMyFile = "" Else GetMyFile = Trim(Left(OpenFile.lpstrFile, InStr(1, OpenFile.lpstrFile, vbNullChar) - 1)) End If End Function |
GetSystemMetrics | Private Declare Function GetSystemMetrics Lib "USER32" (ByVal nIndex As Long) As Long Private Declare PtrSafe Function GetSystemMetrics Lib "USER32" (ByVal nIndex As Long) As Long |
GetTempPath | Declare Function GetTempPath Lib "kernel32" _ Alias "GetTempPathA" (ByVal nBufferLength As Long, _ ByVal lpbuffer As String) As Long Declare PtrSafe Function GetTempPath Lib "kernel32" _ Alias "GetTempPathA" (ByVal nBufferLength As longptr, _ ByVal lpbuffer As String) As Long |
getTickCount | Private Declare Function getTickCount Lib "kernel32" Alias "QueryPerformanceCounter" (cyTickCount AsCurrency) As Long Private Declare PtrSafe Function getTickCount Lib "kernel32" Alias "QueryPerformanceCounter" (cyTickCount AsCurrency) As Long ' |
getTime | Private Declare Function timeGetTime Lib "winmm.dll" () As Long Private Declare PtrSafe Function timeGetTime Lib "winmm.dll" () As Long |
GetWindow | Public Declare Function GetWindow Lib "USER32" _ (ByVal hWnd As Long, ByVal wCmd As Long) As Long Public Declare PtrSafe Function GetWindow Lib "USER32" _ (ByVal hWnd As LongPtr, ByVal wCmd As Long) As LongPtr |
GetWindowLong | This is one of the few API functions that requires the Win64 compile constant: #If VBA7 Then #If Win64 Then Private Declare PtrSafe Function GetWindowLongPtr Lib "USER32" Alias "GetWindowLongPtrA" (ByVal hWnd As LongPtr, ByVal nIndex As Long) As LongPtr #Else Private Declare PtrSafe Function GetWindowLongPtr Lib "USER32" Alias "GetWindowLongA" (ByVal hWnd AsLongPtr, ByVal nIndex As Long) As LongPtr #End If #Else Private Declare Function GetWindowLongPtr Lib "USER32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByValnIndex As Long) As Long #End If |
GetWindowsDirectory | Declare Function GetWindowsDirectory& Lib "kernel32" Alias _ "GetWindowsDirectoryA" (ByVal lpbuffer As String, _ ByVal nSize As Long) Declare PtrSafe Function GetWindowsDirectory& Lib "kernel32" Alias _ "GetWindowsDirectoryA" (ByVal lpbuffer As String, _ ByVal nSize As LongPtr) |
GetWindowText | Public Declare Function GetWindowText Lib "USER32" Alias "GetWindowTextA" _ (ByVal hWnd As Long, ByVal lpString As String, _ ByVal cch As Long) As Long Public Declare PtrSafe Function GetWindowText Lib "USER32" Alias "GetWindowTextA" _ (ByVal hWnd As LongPtr, ByVal lpString As String, _ ByVal cch As LongPtr) As Long |
InternetGetConnectedState | Public Declare Function InternetGetConnectedState _ Lib "wininet.dll" (lpdwFlags As Long, _ ByVal dwReserved As Long) As Boolean Public Declare PtrSafe Function InternetGetConnectedState _ Lib "wininet.dll" (lpdwFlags As LongPtr, _ ByVal dwReserved As long) As Boolean |
IsCharAlphaNumericA | Private Declare Function IsCharAlphaNumericA Lib "USER32" (ByVal byChar As Byte) As Long Private Declare PtrSafe Function IsCharAlphaNumericA Lib "USER32" (ByVal byChar As Byte) As Long |
OleCreatePictureIndirect | Private Declare Function OleCreatePictureIndirect Lib "oleaut32.dll" (PicDesc As PICTDESC, RefIID As GUID, ByVal fPictureOwnsHandle As Long, IPic As IPicture) As Long Private Type PICTDESC Size As Long Type As Long hPic As Long hPal As Long End Type Private Declare PtrSafe Function OleCreatePictureIndirect Lib "oleaut32.dll" (PicDesc As PICTDESC, RefIID As GUID, ByVal fPictureOwnsHandle As LongPtr, IPic As IPicture) As LongPtr Private Type PICTDESC Size As Long Type As Long hPic As LongPtr hPal As LongPtr End Type |
OpenProcess | #If VBA7 Then Declare PtrSafe Function OpenProcess Lib "kernel32" (ByVal _ dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal _ dwProcessId As Long) As LongPtr #Else Declare Function OpenProcess Lib "kernel32" (ByVal _ dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal _ dwProcessId As Long) As Long #End If |
ReleaseDC | Private Declare Function ReleaseDC Lib "USER32" (ByVal hWnd As Long, ByVal hDC As Long) As Long Private Declare PtrSafe Function ReleaseDC Lib "USER32" (ByVal hWnd As LongPtr, ByVal hDC As LongPtr) As Long |
SendMessage | Public Declare Function SendMessageA Lib "user32" (ByVal hWnd As Long, ByVal wMsg As Long, _ ByVal wParam As Long, lParam As Any) As Long Public Declare PtrSafe Function SendMessageA Lib "user32" (ByVal hWnd As LongPtr, ByVal wMsg As Long, _ ByVal wParam As LongPtr, lParam As Any) As LongPtr |
SetActiveWindow | Declare Function SetActiveWindow Lib "user32.dll" (ByVal hWnd As Long) As Long Declare PtrSafe Function SetActiveWindow Lib "user32.dll" (ByVal hWnd As LongPtr) As LongPtr |
SetCurrentDirectory | Private Declare Function SetCurrentDirectoryA Lib "kernel32" (ByVal lpPathName As String) As Long Private Declare PtrSafe Function SetCurrentDirectoryA Lib "kernel32" (ByVal lpPathName As String) As Long |
SetWindowLongPtr | This is one of the few API functions that requires the Win64 compile constant: #If VBA7 Then #If Win64 Then Private Declare PtrSafe Function SetWindowLongPtr Lib "USER32" Alias "SetWindowLongPtrA" (ByVal hWnd As LongPtr, ByVal nIndex As Long, ByVal dwNewLong As LongPtr) As LongPtr #Else Private Declare Function SetWindowLongPtr Lib "USER32" Alias "SetWindowLongA" (ByVal hWnd AsLongPtr, ByVal nIndex As Long, ByVal dwNewLong As LongPtr) As LongPtr #End If #Else Private Declare Function SetWindowLongPtr Lib "USER32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByValnIndex As Long, ByVal dwNewLong As Long) As Long #End If |
SHBrowseForFolder | #If VBA7 Then Private Type BROWSEINFO hOwner As LongPtr pidlRoot As LongPtr pszDisplayName As String lpszTitle As String ulFlags As Long lpfn As LongPtr lParam As LongPtr iImage As Long End Type Private Declare PtrSafe Function SHBrowseForFolder Lib "shell32.dll" Alias "SHBrowseForFolderA" _ (lpBrowseInfo As BROWSEINFO) As LongPtr #Else Private Type BROWSEINFO hOwner As Long pidlRoot As Long pszDisplayName As String lpszTitle As String ulFlags As Long lpfn As Long lParam As Long iImage As Long End Type Private Declare Function SHBrowseForFolder Lib "shell32.dll" Alias "SHBrowseForFolderA" _ (lpBrowseInfo As BROWSEINFO) As Long #End If Private Const BIF_RETURNONLYFSDIRS = &H1 |
ShellExecute | Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" ( _ ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, _ ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long Private Declare PtrSafe Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" ( _ ByVal hwnd As LongPtr, ByVal lpOperation As String, ByVal lpFile As String, _ ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As LongPtr |
SHFileOperation | #If VBA7 Then Type SHFILEOPSTRUCT hWnd As LongPtr wFunc As Long pFrom As String pTo As String fFlags As Integer fAborted As Boolean hNameMaps As Longptr sProgress As String End Type Declare PtrSafe Function SHFileOperation Lib "shell32.dll" Alias "SHFileOperationA" _ (lpFileOp As SHFILEOPSTRUCT) As LongPtr #Else Type SHFILEOPSTRUCT hWnd As Long wFunc As Long pFrom As String pTo As String fFlags As Integer fAborted As Boolean hNameMaps As Long sProgress As String End Type Declare Function SHFileOperation Lib "shell32.dll" Alias "SHFileOperationA" _ (lpFileOp As SHFILEOPSTRUCT) As Long #End If |
SHGetPathFromIDList | Private Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias "SHGetPathFromIDListA" _ (ByVal pidl As Long, ByVal pszPath As String) As Boolean Private Declare PtrSafe Function SHGetPathFromIDList Lib "shell32.dll" Alias "SHGetPathFromIDListA" _ (ByVal pidl As LongPtr, ByVal pszPath As String) As Boolean |
SHGetSpecialFolderLocation | Private Declare Function SHGetSpecialFolderLocation Lib _ "shell32.dll" (ByVal hwndOwner As Long, ByVal nFolder As Long, _ pidl As ITEMIDLIST) As Long Private Declare PtrSafe Function SHGetSpecialFolderLocation Lib _ "shell32.dll" (ByVal hwndOwner As LongPtr, ByVal nFolder As Long, _ pidl As ITEMIDLIST) As LongPtr Private Type SHITEMID cb As Long abID As Byte End Type Private Type ITEMIDLIST mkid As SHITEMID End Type |
timeGetTime | Private Declare Function timeGetTime Lib "winmm.dll" () As Long Private Declare PtrSafe Function timeGetTime Lib "winmm.dll" () As Long |