Click here to Skip to main content
15,891,513 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I need to somehow find the folder's window handle (e.g.
Quote:
hwnd=0x002C0F1A 64bit class="DirectUIHWND" style=0x56000000 ex=0x0
) inside any folder e.g. DOWNLOADS folder,
Please help me as i am stuck

What I have tried:

Cannot find the same using uiautomationclient dll.
Posted
Updated 14-Nov-19 1:57am
Comments
Richard MacCutchan 14-Nov-19 7:37am    
Windows handles are not stored anywhere in files, they are dynamically created for running applications.
isaketranjan 14-Nov-19 8:45am    
Yes, That' what i am trying to find on run time, tried to find the same using uiautomationclient dll (by Microsoft), But that also failed, somehow i found all items inside the directory, and trying to find the handle of them using name or full directory path (if possible)
Richard MacCutchan 14-Nov-19 8:51am    
Please read my comment again.
isaketranjan 14-Nov-19 8:58am    
May be i could not make my question clear, Just like we find any window's controls using uiautomationclient dll e.g
AutomationElement.RootElement.FindFirst(TreeScope.Children, new PropertyCondition(AutomationElement.NameProperty, "This PC"));

, the same way i want to find the files/folder as well, that may be present anywhere
Richard MacCutchan 14-Nov-19 10:47am    
What do you mean by "find the files/folder as well"?

Your original question is asking to find a Windows handle which does not exist. Now you are asking about finding files or folders. Please edit your question and explain exactly what information you are trying to find.

1 solution

No.
Windows handles are a limited resource, and are allocated dynamically on demand when a window is created at run time, and recycled when the window is closed. In addition, an application does not have "one windows handle", it will commonly have many - at least one for each form, and for each control.

Think about it: if it was stored in a file, it would be the same handle for all instances of the same application - and most applications do not limit you to a single running instance.
 
Share this answer
 
Comments
isaketranjan 14-Nov-19 8:56am    
May be i could not make my question clear, Just like we find any window's controls using uiautomationclient dll e.g
AutomationElement.RootElement.FindFirst(TreeScope.Children, new PropertyCondition(AutomationElement.NameProperty, "This PC"));

, the same way i want to find the files/folder as well, that may be present anywhere

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900