Link to home
Start Free TrialLog in
Avatar of crystalsoft
crystalsoft

asked on

How to close Selected folder

Hello experts
I got this code from egl1044's post from EE..But this code is closing all open folder.
I want to close selected folder.

i am looking code for closing folder which is selected from my list box.

Please help
Thanks

''''''''''''''''''''''''''''
egl1044:

Option Explicit

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Const WM_CLOSE = &H10

Private Sub Command1_Click()

Dim I As Integer
For I = 1 To 100 ' I doubt you will have more than 100 folders open so this will work
Dim cabinetwclass As Long
cabinetwclass = FindWindow("cabinetwclass", vbNullString)
Call PostMessage(cabinetwclass, WM_CLOSE, 0&, 0&)
Sleep 100
DoEvents
Next I

End Sub
ASKER CERTIFIED SOLUTION
Avatar of nffvrxqgrcfqvvc
nffvrxqgrcfqvvc

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of crystalsoft
crystalsoft

ASKER

Thanks it helps me great.
Related to  to this problem i have an question
how can i use this application from server to client .
like if i install on server and client
then i want to see what client doing
so how can i see this list box and if i found something wrong than i can close..
if you will provide me solution i will give you 500 points with A grade
Thanks and hello..
Happy New Year..:-)
Hi
Can you please check following question
i am facing problem some where to kill process from server to client

https://www.experts-exchange.com/questions/25014770/How-to-close-Selected-folder-From-Server-to-Client.html

Thanks in advance