简体   繁体   中英

Select file/folder in namespace extension in windows explorer c#/vb .net

I am having a namespace extension implemented, which is visible in "MY Computer". I want to write automated test cases to browse through the same. I am able to open the explorer window till the namespace extension. as -

Process.Start("explorer.exe", "shell:::{CLSID of my namespace }")

next I want to search for a particular folder name inside the window opened. For example if i give input as "temp", then my mouse should move to "temp" folder in the namespace explorer window. then I double click on the mouse's current position and enter that folder. next i give input as "doc1.doc", then my mouse should be able to locate & move to "doc1.doc" file. Also getDirectory or GetFile etc APIs won't work because I don't have a standard drive associated with my namespace & don't have a relative path either.

Please help.

I was able to achieve the browsing part of my namesapce extension by using sendkeys command. I used it to open the explorer window first (Win + E). Next I try simulating the keypress, say if i have to double click a folder called 'temp', I send 'temp' as keystrokes and press 'Enter'. The ' Input Simulator ' proved very helpful in achieving the same.

Doing a mouse simulation seemed very tricky and risky, as read from a number of posts, so avoided that.

I did not want to execute my code directly (for that I already have unit tests written), but I wanted to simulate the way user works and that would fire my code internally.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM