本文整理汇总了Java中com.sun.jna.win32.W32APIFunctionMapper类的典型用法代码示例。如果您正苦于以下问题:Java W32APIFunctionMapper类的具体用法?Java W32APIFunctionMapper怎么用?Java W32APIFunctionMapper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
W32APIFunctionMapper类属于com.sun.jna.win32包,在下文中一共展示了W32APIFunctionMapper类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: WindowsShutdownManagerImpl
import com.sun.jna.win32.W32APIFunctionMapper; //导入依赖的package包/类
WindowsShutdownManagerImpl() {
// Use the Unicode versions of Win32 API calls
Map<String, Object> m = new HashMap<>();
m.put(OPTION_TYPE_MAPPER, W32APITypeMapper.UNICODE);
m.put(OPTION_FUNCTION_MAPPER, W32APIFunctionMapper.UNICODE);
options = Collections.unmodifiableMap(m);
}
示例2: defaultDirectory
import com.sun.jna.win32.W32APIFunctionMapper; //导入依赖的package包/类
/**
* Returns the correct userDataFolder for the given application name.
*/
public static String defaultDirectory() {
// default
String folder = "." + File.separator;
if (isMac()) {
folder = System.getProperty("user.home") + File.separator + "Library" + File.separator
+ "Application Support";
} else if (isWindows()) {
Map<String, Object> options = Maps.newHashMap();
options.put(Library.OPTION_TYPE_MAPPER, W32APITypeMapper.UNICODE);
options.put(Library.OPTION_FUNCTION_MAPPER, W32APIFunctionMapper.UNICODE);
HWND hwndOwner = null;
int nFolder = Shell32.CSIDL_LOCAL_APPDATA;
HANDLE hToken = null;
int dwFlags = Shell32.SHGFP_TYPE_CURRENT;
char pszPath[] = new char[Shell32.MAX_PATH];
Shell32 instance = (Shell32) Native.loadLibrary("shell32", Shell32.class, options);
int hResult = instance.SHGetFolderPath(hwndOwner, nFolder, hToken, dwFlags, pszPath);
if (Shell32.S_OK == hResult) {
String path = new String(pszPath);
int len = path.indexOf('\0');
folder = path.substring(0, len);
} else {
System.err.println("Error: " + hResult);
}
}
folder = folder + File.separator + "SpaceCubes" + File.separator;
return folder;
}
示例3: WindowsShutdownManagerImpl
import com.sun.jna.win32.W32APIFunctionMapper; //导入依赖的package包/类
WindowsShutdownManagerImpl() {
// Use the Unicode versions of Win32 API calls
Map<String, Object> m = new HashMap<String, Object>();
m.put(OPTION_TYPE_MAPPER, W32APITypeMapper.UNICODE);
m.put(OPTION_FUNCTION_MAPPER, W32APIFunctionMapper.UNICODE);
options = Collections.unmodifiableMap(m);
}