\\computer\shared
-
Hi, I'm developing kind of an explorer-like application, that lists local drives/folders and also network drives, as explorer does. When the user enters a path like C:\folder1\folder2, I can browse the tree to select that tree. However, when the user enters something like \\computername, or \\computername\shared, then how should I browse the tree to select that one? I can't enumerate all domains to check where that computername can be found (takes hours), so what is the correct approch? Can I, for example, check to which domain a computername belongs, or something like that? Kind regards, Ludwig
-
Hi, I'm developing kind of an explorer-like application, that lists local drives/folders and also network drives, as explorer does. When the user enters a path like C:\folder1\folder2, I can browse the tree to select that tree. However, when the user enters something like \\computername, or \\computername\shared, then how should I browse the tree to select that one? I can't enumerate all domains to check where that computername can be found (takes hours), so what is the correct approch? Can I, for example, check to which domain a computername belongs, or something like that? Kind regards, Ludwig
lustuyck wrote: Can I, for example, check to which domain a computername belongs, or something like that? Yes, you can, but you'll need to P/Invoke
NetWkstaGetInfo
and declare theWKSTA_INFO_100
structure that goes with it. Lookup this function in the MSDN Library[^] for more information. Windows Explorer does this using ITEMIDs and monikers to get those IDs. Using this information - a namespace, if you will - it can determine a path rather quickly (of course, a shell namespace provider parses the moniker). While it would be possible to use the necessary shell APIs to do this, you're looking at a huge effort to P/Invoke, interop, and declare all the necessary structs and consts to do this in C#. If you take this route, I recommend you create a mixed-mode Managed C++ assembly (i.e., contains both native instructions and IL that can be used by other managed projects). This way you don't have to worry about interop - just use the native methods, include the headers with the pre-proc defs you need, etc., etc.Microsoft MVP, Visual C# My Articles
-
Hi, I'm developing kind of an explorer-like application, that lists local drives/folders and also network drives, as explorer does. When the user enters a path like C:\folder1\folder2, I can browse the tree to select that tree. However, when the user enters something like \\computername, or \\computername\shared, then how should I browse the tree to select that one? I can't enumerate all domains to check where that computername can be found (takes hours), so what is the correct approch? Can I, for example, check to which domain a computername belongs, or something like that? Kind regards, Ludwig
Have a look at Furty's FolderTreeView[^] control.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
Have a look at Furty's FolderTreeView[^] control.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
lustuyck wrote: Can I, for example, check to which domain a computername belongs, or something like that? Yes, you can, but you'll need to P/Invoke
NetWkstaGetInfo
and declare theWKSTA_INFO_100
structure that goes with it. Lookup this function in the MSDN Library[^] for more information. Windows Explorer does this using ITEMIDs and monikers to get those IDs. Using this information - a namespace, if you will - it can determine a path rather quickly (of course, a shell namespace provider parses the moniker). While it would be possible to use the necessary shell APIs to do this, you're looking at a huge effort to P/Invoke, interop, and declare all the necessary structs and consts to do this in C#. If you take this route, I recommend you create a mixed-mode Managed C++ assembly (i.e., contains both native instructions and IL that can be used by other managed projects). This way you don't have to worry about interop - just use the native methods, include the headers with the pre-proc defs you need, etc., etc.Microsoft MVP, Visual C# My Articles