'Classes/ActiveBasic/Windows/Windows.ab

Namespace ActiveBasic
Namespace Windows

Function GetPathFromIDList(pidl As LPITEMIDLIST) As String
	Dim buf[ELM(MAX_PATH)] As TCHAR
	If SHGetPathFromIDList(pidl, buf) Then
		Return New String(buf)
	Else
		Return ""
	End If
End Function

Function GetFolderPath(hwnd As HWND, folder As Long) As String
	Dim pidl As LPITEMIDLIST
	Dim hr = SHGetSpecialFolderLocation(hwnd, folder, pidl)
	If SUCCEEDED(hr) Then
		GetFolderPath = GetPathFromIDList(pidl)
		CoTaskMemFree(pidl)
	Else
		GetFolderPath = ""
	End If
End Function

Function GetFolderPath(folder As Long) As String
	Return GetFolderPath(0, folder)
End Function
/*
Function MessageBox(hw As HWND, s As PCSTR, t As PCSTR, b As DWord) As DWord
	Return MessageBoxA(hw, s, t, b)
End Function

Function MessageBox(hw As HWND, s As PCWSTR, t As PCWSTR, b As DWord) As DWord
	Return MessageBoxW(hw, s, t, b)
End Function
*/

Namespace Detail
Function _System_MessageBox(hw As HWND, s As PCSTR, t As PCSTR, b As DWord) As DWord
	Return MessageBoxA(hw, s, t, b)
End Function

Function _System_MessageBox(hw As HWND, s As PCWSTR, t As PCWSTR, b As DWord) As DWord
	Return MessageBoxW(hw, s, t, b)
End Function
End Namespace

End Namespace 'Widnows
End Namespace 'ActiveBasic
