please help me madshi.

just write whatever you want
Post Reply
Armagedon
Posts: 14
Joined: Tue May 27, 2008 4:30 am

please help me madshi.

Post by Armagedon »

hi
i want a (delphi) code to:
geting path for clicking on folders in windows explorer.
excusme for bad english.
madshi
Site Admin
Posts: 10749
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

You mean you want us to do the work for you? No thanks.

You can try using SetWindowsHookEx to hook into mouse clicks. Then maybe you can use the listview messages to find out the folder *name*. If the listview doesn't list the paths, I don't know how you can get them.
iconic
Site Admin
Posts: 1064
Joined: Wed Jun 08, 2005 5:08 am

Post by iconic »

Armagedon,

Why not visit experts exchange and ask there, they compete for points and will give you a fully working code example. I am not sure the fee per month but it can not be that terribly much cost wise.

--Iconic
Armagedon
Posts: 14
Joined: Tue May 27, 2008 4:30 am

Post by Armagedon »

this technic used in "al antivirus" (writen in VB but i working delphi)
and i found this code:

Code: Select all


VERSION 5.00
Begin VB.UserControl IEWatch 
   BackColor       =   &H00C0E0FF&
   CanGetFocus     =   0   'False
   ClientHeight    =   555
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   570
   ClipControls    =   0   'False
   HasDC           =   0   'False
   InvisibleAtRuntime=   -1  'True
   ScaleHeight     =   555
   ScaleWidth      =   570
End
Attribute VB_Name = "IEWatch"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit

Event PathChange(strPath As String)
Event FileNameSeletedChange(strFilename As String, Fullpath As String)
Event IEClosed()

Dim WithEvents IEObject As SHDocVw.WebBrowser
Attribute IEObject.VB_VarHelpID = -1
Dim WithEvents SpaceIE  As Shell32.ShellFolderView
Attribute SpaceIE.VB_VarHelpID = -1

Dim var_Quit As Boolean
Dim var_Enabled As Boolean
Dim var_hwnd As Long
Private Declare Function IsWindow Lib "user32" (ByVal hwnd As Long) As Long

Property Get IEKey() As Long
On Error GoTo salah
    IEKey = IEObject.hwnd
salah:
End Property

Function AddSubClass(Value As Object) As Boolean
On Error GoTo salah
  'If var_hwnd = 0 Or IsWindow(var_hwnd) = False Then
     Set IEObject = Nothing
     Set SpaceIE = Nothing
     
     Set IEObject = Value
     Set SpaceIE = IEObject.Document
         var_hwnd = Value.hwnd
         Call ChangePath
         SpaceIE_SelectionChanged
         AddSubClass = True
  'End If
  Exit Function
salah:
'MsgBox Error
End Function

Private Sub ChangePath()
On Error Resume Next
Dim buff As String
buff = ValidatePath(CStr(IEObject.LocationURL))
If Trim(buff) <> "" Then
   RaiseEvent PathChange(buff)
End If
End Sub

Private Sub IEObject_DocumentComplete(ByVal pDisp As Object, URL As Variant)
On Error Resume Next
    RaiseEvent PathChange(CStr(URL))

End Sub

Private Sub IEObject_OnQuit()
var_hwnd = 0
On Error GoTo salah
Set IEObject = Nothing
Set SpaceIE = Nothing
RaiseEvent IEClosed
salah:
End Sub

Private Sub IEObject_TitleChange(ByVal Text As String)
On Error Resume Next
     Set SpaceIE = Nothing
     Set SpaceIE = IEObject.Document
End Sub

Private Sub SpaceIE_SelectionChanged()
If var_Enabled Then
    Dim FI As Object
    For Each FI In SpaceIE.SelectedItems
        RaiseEvent FileNameSeletedChange(FI.name, FI.path)
        DoEvents
    Next FI
    Set FI = Nothing
End If
End Sub

Private Sub UserControl_Terminate()
'On Error GoTo salah
'Set IEObject = Nothing
'Set SpaceIE = Nothing
'var_hwnd = 0
'salah:
End Sub

Sub SetIENothing()
On Error GoTo salah
Set IEObject = Nothing
Set SpaceIE = Nothing
var_hwnd = 0
salah:
End Sub

Function ValidatePath(nstr As String) As String
On Error Resume Next
Dim buff As String
Dim i As Integer
buff = nstr
buff = Replace(buff, "file:///", "")
buff = Replace(buff, "/", "\")

For i = 32 To 255
    buff = Replace(buff, "%" & Hex(i), Chr(i), , , vbTextCompare)
Next i
ValidatePath = buff
End Function

Sub EnabledMonitoring(Value As Boolean)
var_Enabled = Value
End Sub
i think used with this code
do you think?

you can download all project:
http://www.pscode.com/vb/scripts/ShowZi ... a719927841

i want delphi code to answer my question.

thanks!
iconic
Site Admin
Posts: 1064
Joined: Wed Jun 08, 2005 5:08 am

Post by iconic »

i want delphi code to answer my question.
Please read my comment about this because you're apparently not reading what both Madshi and I have said in this thread. (1) Nobody is writing code for you on this forum. You need to learn how to do this yourself. (2) If you do not like (1) have somebody at Experts Exchange do this for you. Phrase your question the same way under the Delphi Programming area there and get an answer.

--Iconic
Outsourcingser
Posts: 1
Joined: Wed Apr 14, 2010 3:01 am

great

Post by Outsourcingser »

i do follow and have good result.
Post Reply