CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Jan 2005
    Location
    germany
    Posts
    160

    how to show the "share folder" Dlg

    Hi all,

    there is a function called "ShowShareFolderUIW" in ntshrui.dll, that shows a folders property page with the sharing options of that folder. But this function is not there on Win2k, only on XP.

    Does anybody know, how to achive this on Win2k (or even better: on all Win32 platforms)?

    regards
    HoM

  2. #2
    Join Date
    Aug 1999
    Location
    <Classified>
    Posts
    6,882

    Re: how to show the "share folder" Dlg

    Regards,
    Ramkrishna Pawar

  3. #3
    Join Date
    Aug 1999
    Location
    <Classified>
    Posts
    6,882

    Re: how to show the "share folder" Dlg

    Also IShellFolder interface can be used to get the Context menu interface, and then you can use IContextmenu::ExecuteCommand to invoke folder properties.

    http://msdn.microsoft.com/library/de...older_info.asp
    Regards,
    Ramkrishna Pawar

  4. #4
    Join Date
    Jan 2005
    Location
    germany
    Posts
    160

    Re: how to show the "share folder" Dlg

    thanks a lot.
    Actually we achieved showing the "properties" by doing a shellexecute on the folder with the verb "properties". But ... we would be much more happy, if the "sharing" page would be open, not the properties.

    regards
    HoM

  5. #5
    Join Date
    Aug 1999
    Location
    <Classified>
    Posts
    6,882

    Re: how to show the "share folder" Dlg

    I think the SHObjectProperties can do that, see the last argument szPage, there you can specify which page to open initially.
    Regards,
    Ramkrishna Pawar

  6. #6
    Join Date
    Jan 2005
    Location
    germany
    Posts
    160

    Re: how to show the "share folder" Dlg

    Thanks a lot. One can really get the dialog with this API.

    The sad part of it: It is one of the most stupid APIs I have ever seen, because one must spezify the text, that is on the tab of the page to be opened (in my case: "sharing" or - in german - "freigabe").

    Of course this is different on each language version of windows, so - acutally the function is more or less useless, if you want it to work with all languages. :-(

    If there are other ideas outside, that overcome the language problem, please let me know.
    regards
    HoM

  7. #7
    Join Date
    Jan 2005
    Location
    germany
    Posts
    160

    Resolved(?): how to show the "share folder" Dlg

    Finally: Maybe there is a way to do it right for all languages:

    Open the file ntshrui.dll as a resource and read the String resource with the ID 103 and take that as input for the API ShObjectProperties. On english systems ist "sharing", on german systems it is "freigabe" so hopefully it works on other languages, too (maybe some of you can test and write here?).

    regards
    HoM

  8. #8
    Join Date
    Jan 2005
    Location
    germany
    Posts
    160

    Re: how to show the "share folder" Dlg

    For sake of completness: This is sample code how to get the string, that you need for the call to SHObjectProperties :

    Code:
    CComBSTR bstrNtShrUiDll;
    // read the path to Systen32 folder and copy it to bstrNtShrUiDll
    ...
    
    bstrNtShrUiDll.Append( L"\\ntshrui.dll" );
    HMODULE hDLL = ::GetModuleHandleW( bstrNtShrUiDll );
    WCHAR wszBuffer[MAX_PATH] = {0};
    ::LoadStringW( hDLL, 103, wszBuffer, MAX_PATH );  // The string resource 103 stands for the "Sharing" (or "Freigabe" in German)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured