home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 4_2005-2006.ISO / data / Zips / MyPSCDownl2013028132006.psc / cLaunchExplorer.cls < prev    next >
Text File  |  2004-11-19  |  3KB  |  82 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4.   Persistable = 0  'NotPersistable
  5.   DataBindingBehavior = 0  'vbNone
  6.   DataSourceBehavior  = 0  'vbNone
  7.   MTSTransactionMode  = 0  'NotAnMTSObject
  8. END
  9. Attribute VB_Name = "cLaunchExplorer"
  10. Attribute VB_GlobalNameSpace = False
  11. Attribute VB_Creatable = True
  12. Attribute VB_PredeclaredId = False
  13. Attribute VB_Exposed = False
  14. ' cLaunchExplorer
  15. ' 2004/11/19 Copyright ⌐ 2004, Larry Rebich, using the DELL8500
  16. ' 2004/11/19 larry@larryrebich.com, www.buygold.net
  17.  
  18.     Option Explicit
  19.     DefLng A-Z
  20.     
  21.     Private Const SW_SHOWNORMAL As Long = 1
  22.     Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
  23.         (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, _
  24.          ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
  25.     Private Declare Function GetDesktopWindow Lib "user32" () As Long
  26.     Private msPath As String
  27.     Private mbExplorerFormat As Boolean
  28.     '
  29.  
  30. Public Property Get bExplorerFormat() As Boolean
  31.     bExplorerFormat = mbExplorerFormat
  32. End Property
  33.  
  34. Public Property Let bExplorerFormat(ByVal bValue As Boolean)
  35.     mbExplorerFormat = bValue
  36. End Property
  37.  
  38. Public Property Get sPath() As String
  39.     sPath = msPath
  40. End Property
  41.  
  42. Public Property Let sPath(ByVal StrValue As String)
  43.     msPath = StrValue
  44. End Property
  45.  
  46. Public Function Launch(Optional vntPath As Variant, Optional vntExplorerFormat As Variant) As Boolean
  47. ' 2004/11/19 Function added by Larry Rebich using the DELL8500 while in Las Vegas, NV
  48. ' 2004/11/19 Based upon OpenURL from modConnectToWebSite.bas
  49.  
  50.     Dim lRtn As Long
  51.     Dim sOpenHow As String
  52.     
  53.     On Error GoTo LaunchEH
  54.     If Not IsMissing(vntPath) Then
  55.         Me.sPath = vntPath
  56.     End If
  57.     If Not IsMissing(vntExplorerFormat) Then
  58.         Me.bExplorerFormat = vntExplorerFormat
  59.     End If
  60.     
  61.     If Me.bExplorerFormat Then
  62.         sOpenHow = "Explore"
  63.     Else
  64.         sOpenHow = "Open"
  65.     End If
  66.     
  67.     lRtn = RunShellExecute(sOpenHow, Me.sPath, 0&, 0&, SW_SHOWNORMAL)
  68.     If lRtn > 32 Then       'success
  69.         Launch = True
  70.     End If
  71.     Exit Function
  72. LaunchEH:
  73.     Err.Raise Err.Number, "cLaunchExplorer:Launch", Err.Description
  74. End Function
  75.  
  76. Private Function RunShellExecute(sTopic As String, sFile As Variant, sParams As Variant, sDirectory As Variant, nShowCmd As Long) As Long
  77. ' 2004/11/19 Function added by Larry Rebich using the DELL8500 while in Las Vegas, NV
  78.     RunShellExecute = ShellExecute(GetDesktopWindow(), sTopic, sFile, sParams, sDirectory, nShowCmd)
  79.  
  80. End Function
  81.  
  82.