home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 25: Programming / pc_actual_25.iso / Basic / GridOne / setup.EXE / MODSHELL.BAS < prev    next >
Encoding:
BASIC Source File  |  2001-09-09  |  2.4 KB  |  67 lines

  1. Attribute VB_Name = "modShell"
  2. '-----------------------------------------------------------------------------
  3. ' This is a part of the BeeGrid ActiveX control.
  4. ' Copyright ⌐ 2000 Stinga
  5. ' All rights reserved.
  6. '
  7. ' You have a right to use and distribute the BeeGrid sample files in original
  8. ' form or modified, provided that you agree that Stinga has no warranty,
  9. ' obligations, or liability for any sample application files.
  10. '-----------------------------------------------------------------------------
  11. Option Explicit
  12.  
  13. Private Declare Function SHGetSpecialFolderLocation Lib "shell32.dll" _
  14.    (ByVal hwndOwner As Long, _
  15.    ByVal nFolder As Long, _
  16.     pidl As Long) As Long
  17. Private Declare Function SHGetPathFromIDList Lib "shell32" _
  18.    (ByVal pidl As Long, ByVal pszPath As String) As Long
  19. Public Const CSIDL_DESKTOP = &H0
  20. Public Const CSIDL_PROGRAMS = &H2
  21. Public Const CSIDL_CONTROLS = &H3
  22. Public Const CSIDL_PRINTERS = &H4
  23. Public Const CSIDL_PERSONAL = &H5
  24. Public Const CSIDL_FAVORITES = &H6
  25. Public Const CSIDL_STARTUP = &H7
  26. Public Const CSIDL_RECENT = &H8
  27. Public Const CSIDL_SENDTO = &H9
  28. Public Const CSIDL_BITBUCKET = &HA
  29. Public Const CSIDL_STARTMENU = &HB
  30. Public Const CSIDL_DESKTOPDIRECTORY = &H10
  31. Public Const CSIDL_DRIVES = &H11
  32. Public Const CSIDL_NETWORK = &H12
  33. Public Const CSIDL_NETHOOD = &H13
  34. Public Const CSIDL_FONTS = &H14
  35. Public Const CSIDL_TEMPLATES = &H15
  36. Public Const CSIDL_COMMON_STARTMENU = &H16
  37. Public Const CSIDL_COMMON_PROGRAMS = &H17
  38. Public Const CSIDL_COMMON_STARTUP = &H18
  39. Public Const CSIDL_COMMON_DESKTOPDIRECTORY = &H19
  40. Public Const CSIDL_APPDATA = &H1A
  41. Public Const CSIDL_PRINTHOOD = &H1B
  42.  
  43. 'play file
  44. Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
  45.    (ByVal hwnd As Long, ByVal lpOperation As String, _
  46.    ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, _
  47.    ByVal nShowCmd As Long) As Long
  48. Public Function GetSpecialFolder(CSIDL As Long) As String
  49.    Dim res As Long
  50.    Dim sPath As String
  51.    Dim pidl As Long
  52.    Const MAX_PATH = 260
  53.    
  54.   'fill pidl with the specified folder item
  55.    res = SHGetSpecialFolderLocation(0, CSIDL, pidl)
  56.    
  57.    If res = 0 Then
  58.       sPath = Space$(MAX_PATH)
  59.       res = SHGetPathFromIDList(ByVal pidl, ByVal sPath)
  60.       If res Then
  61.          GetSpecialFolder = Left$(sPath, _
  62.                             InStr(sPath, Chr$(0)) - 1) & "\"
  63.       End If
  64.    End If
  65. End Function
  66.  
  67.