When I get the IUIAutomationElement of a file that is desktop's or windows explorer's, How can i get the full path of the element? Is there the COM interface or the method about that? I can get just the file's name using CurrentName.
Asked
Active
Viewed 235 times
1
-
Please stop asking the same question in a new question multiple times. This isn't how Stack Overflow works. Also, why do you need to get the path of the files selected in all file dialogs anyway? What is your ultimate goal with this? – andlabs Nov 28 '16 at 01:30
-
This question is just 'Can i get the path of file at the IUIAutomation level or can not?'. I just wonder this. This is not related the previous question. – Nov 28 '16 at 01:51
-
You can't get the full name from the element itself, you'll have to determine it using its ancestry (parent elements) that contain the path. Use inspect (https://msdn.microsoft.com/en-us/library/windows/desktop/dd318521.aspx) to determine how you can get to it. I think depending how your explorer is configured, it may not be possible at all. – Simon Mourier Nov 28 '16 at 07:42
-
I used Inspect. I looked into all parent element but nowhere was the information about path. Did you say about the "ToolbarWindow32"? – Nov 28 '16 at 08:25
1 Answers
0
There is a property IUIAutomationElement::CurrentProcessId (Just read the MSDN documentation).
The rest can be found with another simple query on stackoverflow: C++ Windows - How to get process path from its PID
-
I want to get the file's path not process's. When the IUIAutomationElement of the file as item of the file open dialog call CurrentProcessId method, It'll return a process id of the process that create the file open dialog. – Nov 29 '16 at 01:19
-
There is no way to get the DLL or module that hosts a COM object. Just think about it? Just having an vtable plus a pointer to the class gives you no chance to see who runs the code, and even if the vtable targets are in the DLL, the host may be the EXE or another DLL. Give a more precise question for what you need the information. – xMRi Nov 29 '16 at 06:47