| 1 | 'Classes/ActiveBasic/Windows/Windows.ab
|
|---|
| 2 |
|
|---|
| 3 | Namespace ActiveBasic
|
|---|
| 4 | Namespace Windows
|
|---|
| 5 |
|
|---|
| 6 | Function GetPathFromIDList(pidl As LPITEMIDLIST) As String
|
|---|
| 7 | Dim buf[ELM(MAX_PATH)] As TCHAR
|
|---|
| 8 | If SHGetPathFromIDList(pidl, buf) Then
|
|---|
| 9 | Return New String(buf)
|
|---|
| 10 | Else
|
|---|
| 11 | Return ""
|
|---|
| 12 | End If
|
|---|
| 13 | End Function
|
|---|
| 14 |
|
|---|
| 15 | Function GetFolderPath(hwnd As HWND, folder As Long) As String
|
|---|
| 16 | Dim pidl As LPITEMIDLIST
|
|---|
| 17 | Dim hr = SHGetSpecialFolderLocation(hwnd, folder, pidl)
|
|---|
| 18 | If SUCCEEDED(hr) Then
|
|---|
| 19 | GetFolderPath = GetPathFromIDList(pidl)
|
|---|
| 20 | CoTaskMemFree(pidl)
|
|---|
| 21 | Else
|
|---|
| 22 | GetFolderPath = ""
|
|---|
| 23 | End If
|
|---|
| 24 | End Function
|
|---|
| 25 |
|
|---|
| 26 | Function GetFolderPath(folder As Long) As String
|
|---|
| 27 | Return GetFolderPath(0, folder)
|
|---|
| 28 | End Function
|
|---|
| 29 | /*
|
|---|
| 30 | Function MessageBox(hw As HWND, s As PCSTR, t As PCSTR, b As DWord) As DWord
|
|---|
| 31 | Return MessageBoxA(hw, s, t, b)
|
|---|
| 32 | End Function
|
|---|
| 33 |
|
|---|
| 34 | Function MessageBox(hw As HWND, s As PCWSTR, t As PCWSTR, b As DWord) As DWord
|
|---|
| 35 | Return MessageBoxW(hw, s, t, b)
|
|---|
| 36 | End Function
|
|---|
| 37 | */
|
|---|
| 38 |
|
|---|
| 39 | Namespace Detail
|
|---|
| 40 | Function _System_MessageBox(hw As HWND, s As PCSTR, t As PCSTR, b As DWord) As DWord
|
|---|
| 41 | Return MessageBoxA(hw, s, t, b)
|
|---|
| 42 | End Function
|
|---|
| 43 |
|
|---|
| 44 | Function _System_MessageBox(hw As HWND, s As PCWSTR, t As PCWSTR, b As DWord) As DWord
|
|---|
| 45 | Return MessageBoxW(hw, s, t, b)
|
|---|
| 46 | End Function
|
|---|
| 47 | End Namespace
|
|---|
| 48 |
|
|---|
| 49 | End Namespace 'Widnows
|
|---|
| 50 | End Namespace 'ActiveBasic
|
|---|