Results 1 to 5 of 5

Thread: To show the "properties" for a drive, printer or file.

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2023
    Posts
    976

    To show the "properties" for a drive, printer or file.

    Code:
    Public Enum SHOP_Flags
            SHOP_PRINTERNAME = &H1        'pszObjectName points to a printer friendly name
            SHOP_FILEPATH = &H2                'pszObjectName points to a fully qualified path+file name
            SHOP_VOLUMEGUID = &H4         'pszObjectName points to a Volume GUID
    End Enum
    
    Public Declare Function SHObjectProperties Lib "shell32.dll" (ByVal hWnd As Long, ByVal shopObjectType As SHOP_Flags, ByVal pszObjectName As Long, ByVal pszPropertyPage As Long) As Long
    
    Public Function GetObjectProperties(ByVal hwndOwner As Long, ByVal ShowFlags As SHOP_Flags, ByVal sNameOrPath As String) As Boolean
       GetObjectProperties = SHObjectProperties(hwndOwner, ShowFlags, StrPtr(sNameOrPath), StrPtr(" "))
    End Function
    
    GetObjectProperties Me.hWnd, SHOP_FILEPATH, "c:\windows\explorer.exe"

  2. #2
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    7,667

    Re: To show the "properties" for a drive, printer or file.

    Nice, had forgotten that function took a volume guid or printer too.

    See also: SHMultiFileProperties; how to create the 'Properties' dialog for more than one file at a time. Example

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2023
    Posts
    976

    Re: To show the "properties" for a drive, printer or file.

    Thanx
    The did forgot to set an example for the last param in that API which tells which tab that will be selected. (0 or strptr(" ") is default the first tab.

    Code:
    Public Function GetObjectProperties(ByVal hwndOwner As Long, ByVal ShowFlags As SHOP_Flags, ByVal sNameOrPath As String, Optional ByVal sActiveTab As String = " ") As Boolean
       GetObjectProperties = SHObjectProperties(hwndOwner, ShowFlags, StrPtr(sNameOrPath), StrPtr(sActiveTab & Chr(0)))
    End Function
    Attached Images Attached Images  

  4. #4
    Fanatic Member
    Join Date
    Jun 2016
    Location
    España
    Posts
    633

    Re: To show the "properties" for a drive, printer or file.

    put the name of the tab
    It depends on the language, in my case Spanish.

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2023
    Posts
    976

    Re: To show the "properties" for a drive, printer or file.

    Yes, indeed but 0 or strptr(” ”) is default tab. The first leftmost tab.

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