Private Declare Function SHChangeIconDialogA Lib "shell32" Alias "#62" (ByVal hWnd As Long, ByVal szFilename As String, ByVal Reserved As Long, lpIconIndex As Long) As Long Private Declare Function SHChangeIconDialogW Lib "shell32" Alias "#62" (ByVal hWnd As Long, ByVal szFilename As Long, ByVal Reserved As Long, lpIconIndex As Long) As Long Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Public Function ChangeIconDialog(ByVal hWnd As Long, strPath As String, Optional Iconidx As Long = 0) As Boolean Const MAX_PATH As Long = 260 Dim strBuf As String * MAX_PATH, strRet(MAX_PATH) As Byte Dim lPtr As Long, lRet As Long
strBuf = strPath & vbNullChar If IsWinNT() Then ←OSがNTかどうか判断。自分で作る lPtr = StrPtr(strBuf) lRet = SHChangeIconDialogW(hWnd, lPtr, MAX_PATH, Iconidx) CopyMemory strRet(0), ByVal lPtr, MAX_PATH strBuf = CStr(strRet) Else lRet = SHChangeIconDialogA(hWnd, strBuf, MAX_PATH, Iconidx) End If
If lRet Then ChangeIconDialog = True strPath = Left$(strBuf, InStr(strBuf, vbNullChar) - 1) End If End Function
switch(LOWORD(msg.wParam)){ case VK_RETURN: ::SendMessage(ComboHandle,WM_KEYDOWN,VK_RETURN,0); break; case VK_LEFT: ::SendMessage(ComboHandle,WM_KEYDOWN,VK_LEFT,0); break; case VK_RIGHT: ::SendMessage(ComboHandle,WM_KEYDOWN,VK_RIGHT,0); break; case VK_UP: ::SendMessage(ComboHandle,WM_KEYDOWN,VK_UP,0); break; case VK_DOWN: ::SendMessage(ComboHandle,WM_KEYDOWN,VK_DOWN,0); break; } }