Shell32Util (JNA API)
Description: declaration: package: com.sun.jna.platform.win32, class: Shell32Util

Package com.sun.jna.platform.win32

# Class Shell32Util

java.lang.Object
com.sun.jna.platform.win32.Shell32Util

public abstract class Shell32Util extends Object
Shell32 Utility API.

Author:
  dblock[at]dblock.org, markus[at]headcrashing[dot]eu

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Shell32Util()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static final String[]`
  `CommandLineToArgv(String cmdLine)`
  Parses a command line string and returns an array of Strings of the command line arguments.
  `static String`
  `getFolderPath(int nFolder)`
  Get a special folder path.
  `static String`
  `getFolderPath(WinDef.HWND hwnd, int nFolder, WinDef.DWORD dwFlags)`
  Get a special folder path.
  `static String`
  `getKnownFolderPath(Guid.GUID guid)`
  Retrieves the full path of a known folder identified by the folder's KNOWNFOLDERID.
  `static final String`
  `getSpecialFolderPath(int csidl, boolean create)`
  Retrieves the path of a special folder, identified by its CSIDL.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### Shell32Util

    public Shell32Util()

- ## Method Details

  - ### getFolderPath

    public static String getFolderPath(WinDef.HWND hwnd, int nFolder, WinDef.DWORD dwFlags)
    Get a special folder path.
    Parameters:
      `hwnd` - Parent window.
      `nFolder` - Folder CSLID.
      `dwFlags` - Flags.
    Returns:
      Special folder.

  - ### getFolderPath

    public static String getFolderPath(int nFolder)
    Get a special folder path.
    Parameters:
      `nFolder` - Folder CSLID.
    Returns:
      Special folder path.

  - ### getKnownFolderPath

    public static String getKnownFolderPath(Guid.GUID guid) throws Win32Exception
    Retrieves the full path of a known folder identified by the folder's KNOWNFOLDERID. This function replaces `getFolderPath(com.sun.jna.platform.win32.WinDef.HWND, int, com.sun.jna.platform.win32.WinDef.DWORD)`. That older function is now simply a wrapper for getKnownFolderPath
    Parameters:
      `guid` - the KNOWNFOLDERS GUID as defined in `KnownFolders`
    Returns:
      the path of the known folder. The returned path does not include a trailing backslash. For example, "C:\Users" is returned rather than "C:\Users\".
    Throws:
      `Win32Exception` - if the guid references a KNOWNFOLDERID which does not have a path (such as a folder marked as KF_CATEGORY_VIRTUAL) or that the KNOWNFOLDERID is not present on the system. Not all KNOWNFOLDERID values are present on all systems.

  - ### getSpecialFolderPath

    public static final String getSpecialFolderPath(int csidl, boolean create)
    Retrieves the path of a special folder, identified by its CSIDL.
    Parameters:
      `csidl` - A CSIDL that identifies the folder of interest. If a virtual folder is specified, this function will fail.
      `create` - Indicates whether the folder should be created if it does not already exist. If this value is nonzero, the folder is created. If this value is zero, the folder is not created.
    Returns:
      The drive and path of the specified folder

  - ### CommandLineToArgv

    public static final String[] CommandLineToArgv(String cmdLine)
    Parses a command line string and returns an array of Strings of the command line arguments.
    Parameters:
      `cmdLine` - A string that contains the full command line. If this parameter is an empty string the function returns the path to the current executable file.
    Returns:
      An array of strings, similar to `argv`.