当前位置: 首页>>代码示例>>Java>>正文


Java WinDef.DWORD属性代码示例

本文整理汇总了Java中com.sun.jna.platform.win32.WinDef.DWORD属性的典型用法代码示例。如果您正苦于以下问题:Java WinDef.DWORD属性的具体用法?Java WinDef.DWORD怎么用?Java WinDef.DWORD使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.sun.jna.platform.win32.WinDef的用法示例。


在下文中一共展示了WinDef.DWORD属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findChildWindowByText

public static WindowHolder findChildWindowByText(WindowHolder parenWindow, String text) {
	WinDef.DWORD fiveButton = new WinDef.DWORD(Long.parseLong(text));
	WinDef.HWND fiveButtonWnd = user32.GetWindow(parenWindow.getParentWindow(), fiveButton);
	if (fiveButtonWnd == null) {
		return null;
	}
	WINDOWINFO pwi = new WINDOWINFO();
	System.out.println(user32.GetWindowInfo(fiveButtonWnd, pwi));
	WindowHolder windowHolder = new WindowHolder(fiveButtonWnd, pwi);
	return windowHolder;
}
 
开发者ID:frolovm,项目名称:poker-bot,代码行数:11,代码来源:User32Utils.java

示例2: setShutdownPrivileges

private static void setShutdownPrivileges() {
    final WinNT.HANDLEByReference token = new WinNT.HANDLEByReference();
    Advapi32.INSTANCE.OpenProcessToken(Kernel32.INSTANCE.GetCurrentProcess(), WinNT.TOKEN_ADJUST_PRIVILEGES, token);

    final WinNT.LUID luid = new WinNT.LUID();
    Advapi32.INSTANCE.LookupPrivilegeValue(null, WinNT.SE_SHUTDOWN_NAME, luid);

    final WinNT.TOKEN_PRIVILEGES tp = new WinNT.TOKEN_PRIVILEGES(1);
    tp.Privileges[0] = new WinNT.LUID_AND_ATTRIBUTES(luid, new WinDef.DWORD(WinNT.SE_PRIVILEGE_ENABLED));
    Advapi32.INSTANCE.AdjustTokenPrivileges(token.getValue(), false, tp, 0, null, new IntByReference(0));
}
 
开发者ID:yajsw,项目名称:yajsw,代码行数:11,代码来源:WindowsXPProcess.java

示例3: detectAutoProxyConfigUrl

/**
 * Finds the URL for the Proxy Auto-Configuration (PAC) file using WPAD.
 * This is merely a wrapper around
 * {@link WinHttp#WinHttpDetectAutoProxyConfigUrl(com.sun.jna.platform.win32.WinDef.DWORD, com.github.markusbernhardt.proxy.jna.win.WTypes2.LPWSTRByReference)
 * WinHttpDetectAutoProxyConfigUrl}
 *
 * <p>
 * This method is blocking and may take some time to execute.
 * 
 * @param dwAutoDetectFlags
 * @return the url of the PAC file or {@code null} if it cannot be located
 *         using WPAD method.
 */
public static String detectAutoProxyConfigUrl(WinDef.DWORD dwAutoDetectFlags) {

    WTypes2.LPWSTRByReference ppwszAutoConfigUrl = new WTypes2.LPWSTRByReference();
    boolean result = false;
    try {
        result = WinHttp.INSTANCE.WinHttpDetectAutoProxyConfigUrl(dwAutoDetectFlags, ppwszAutoConfigUrl);
    } catch (LastErrorException ex) {
        if (ex.getErrorCode() == WinHttp.ERROR_WINHTTP_AUTODETECTION_FAILED) {
            // This error is to be expected. It just means that the lookup
            // using either DHCP, DNS or both, failed because there wasn't
            // a useful reply from DHCP / DNS. (meaning the site hasn't
            // configured their DHCP Server or their DNS Server for WPAD)
            return null;
        }
        // Something more serious is wrong. There isn't much we can do
        // about it but at least we would like to log it.
        Logger.log(WinHttpHelpers.class, Logger.LogLevel.ERROR,
                "Windows function WinHttpDetectAutoProxyConfigUrl returned error : {0}", ex.getMessage());
        return null;
    }
    if (result) {
        return ppwszAutoConfigUrl.getString();
    } else {
        return null;
    }
}
 
开发者ID:MarkusBernhardt,项目名称:proxy-vole,代码行数:39,代码来源:WinHttpHelpers.java

示例4: setCurrentThreadAffinityWin32

private static void setCurrentThreadAffinityWin32(int coreId) {
  final CLibrary lib = CLibrary.INSTANCE;
  try {
    WinDef.DWORD mask = new WinDef.DWORD(1L << coreId);
    lib.SetThreadAffinityMask(lib.GetCurrentThread(), mask);
  } catch (LastErrorException e) {
    System.err.format("Error setting thread affinity; last error: %d", e.getErrorCode());
  }
}
 
开发者ID:FIXTradingCommunity,项目名称:silverflash,代码行数:9,代码来源:CoreManager.java

示例5: InitiateSystemShutdown

boolean InitiateSystemShutdown(
    String lpMachineName,
    String lpMessage,
    WinDef.DWORD dwTimeout,
    boolean bForceAppsClosed,
    boolean bRebootAfterShutdown
);
 
开发者ID:msiedlarek,项目名称:winthing,代码行数:7,代码来源:Advapi32.java

示例6: adjustPrivileges

public static boolean adjustPrivileges() {

        WinNT.TOKEN_PRIVILEGES tp = new WinNT.TOKEN_PRIVILEGES(1);
        WinNT.TOKEN_PRIVILEGES oldtp = new WinNT.TOKEN_PRIVILEGES(1);
        WinNT.LUID luid = new WinNT.LUID();
        WinNT.HANDLEByReference hTokenRef = new WinNT.HANDLEByReference();
        if (!Advapi32.INSTANCE.OpenProcessToken(Kernel32.INSTANCE.GetCurrentProcess(), WinNT.TOKEN_ADJUST_PRIVILEGES | WinNT.TOKEN_QUERY, hTokenRef)) {
            return false;
        }
        WinNT.HANDLE hToken = hTokenRef.getValue();
        if (!Advapi32.INSTANCE.LookupPrivilegeValue(null, WinNT.SE_DEBUG_NAME, luid)) {
            Kernel32.INSTANCE.CloseHandle(hToken);
            return false;
        }

        tp.PrivilegeCount = new WinDef.DWORD(1);
        tp.Privileges = new WinNT.LUID_AND_ATTRIBUTES[1];
        tp.Privileges[0] = new WinNT.LUID_AND_ATTRIBUTES(luid, new WinDef.DWORD(WinNT.SE_PRIVILEGE_ENABLED));

        IntByReference retSize = new IntByReference(0);
        if (!Advapi32.INSTANCE.AdjustTokenPrivileges(hToken, false, tp, tp.size(), oldtp, retSize)) {
            Kernel32.INSTANCE.CloseHandle(hToken);
            return false;
        }
        Kernel32.INSTANCE.CloseHandle(hToken);
        privAdjusted = true;
        return true;
    }
 
开发者ID:jindrapetrik,项目名称:jpexs-decompiler,代码行数:28,代码来源:Win32ProcessTools.java

示例7: SetThreadAffinityMask

public void SetThreadAffinityMask(final int pid, final WinDef.DWORD lpProcessAffinityMask)
throws LastErrorException;
 
开发者ID:FIXTradingCommunity,项目名称:silverflash,代码行数:2,代码来源:CoreManager.java

示例8: PROCESSENTRY32

public PROCESSENTRY32() {
	dwSize = new WinDef.DWORD(size());
}
 
开发者ID:laurent-clouet,项目名称:sheepit-client,代码行数:3,代码来源:Kernel32Lib.java

示例9: WinHttpDetectAutoProxyConfigUrl

/**
 * The WinHttpDetectAutoProxyConfigUrl function finds the URL for the Proxy
 * Auto-Configuration (PAC) file. This function reports the URL of the PAC
 * file, but it does not download the file.
 * 
 * @param dwAutoDetectFlags
 *            A data type that specifies what protocols to use to locate the
 *            PAC file. If both the DHCP and DNS auto detect flags are set,
 *            DHCP is used first; if no PAC URL is discovered using DHCP,
 *            then DNS is used. Set {@code WINHTTP_AUTO_DETECT_TYPE_DHCP},
 *            {@code WINHTTP_AUTO_DETECT_TYPE_DNS_A} or both.
 * @param ppwszAutoConfigUrl
 *            A data type that returns a pointer to a null-terminated
 *            Unicode string that contains the configuration URL that
 *            receives the proxy data. You must free the string pointed to
 *            by ppwszAutoConfigUrl using the GlobalFree function.
        * 
 * @return {@code true} if successful; otherwise, {@code false}.
        * @see WinHttpHelpers#detectAutoProxyConfigUrl
 */
boolean WinHttpDetectAutoProxyConfigUrl(
               WinDef.DWORD dwAutoDetectFlags, 
           WTypes2.LPWSTRByReference ppwszAutoConfigUrl) throws LastErrorException;
 
开发者ID:MarkusBernhardt,项目名称:proxy-vole,代码行数:23,代码来源:WinHttp.java

示例10: CreateToolhelp32Snapshot

/**
 * Takes a snapshot of the specified processes, as well as the heaps, modules, and threads used by these processes.
 *
 * @param dwFlags       The portions of the system to be included in the snapshot.
 * @param th32ProcessID The process identifier of the process to be included in the snapshot. This parameter can be zero to indicate
 *                      the current process. This parameter is used when the TH32CS_SNAPHEAPLIST, TH32CS_SNAPMODULE,
 *                      TH32CS_SNAPMODULE32, or TH32CS_SNAPALL value is specified. Otherwise, it is ignored and all processes are
 *                      included in the snapshot.
 *                      <p/>
 *                      If the specified process is the Idle process or one of the CSRSS processes, this function fails and the last
 *                      error code is ERROR_ACCESS_DENIED because their access restrictions prevent user-level code from opening them.
 *                      <p/>
 *                      If the specified process is a 64-bit process and the caller is a 32-bit process, this function fails and the
 *                      last error code is ERROR_PARTIAL_COPY (299).
 * @return If the function succeeds, it returns an open handle to the specified snapshot.
 * <p/>
 * If the function fails, it returns INVALID_HANDLE_VALUE. To get extended error information, call GetLastError.
 * Possible error codes include ERROR_BAD_LENGTH.
 */
public WinNT.HANDLE CreateToolhelp32Snapshot(WinDef.DWORD dwFlags, WinDef.DWORD th32ProcessID);
 
开发者ID:laurent-clouet,项目名称:sheepit-client,代码行数:20,代码来源:Kernel32Lib.java

示例11: CreateProcess

public boolean CreateProcess(String lpApplicationName, String lpCommandLine, WinBase.SECURITY_ATTRIBUTES lpProcessAttributes, WinBase.SECURITY_ATTRIBUTES lpThreadAttributes, WinDef.BOOL bInheritHandles, WinDef.DWORD dwCreationFlags, Pointer lpEnvironment, String lpCurrentDirectory, WinBase.STARTUPINFO lpStartupInfo, WinBase.PROCESS_INFORMATION lpProcessInformation); 
开发者ID:vanjadardic,项目名称:KiTTY2,代码行数:1,代码来源:Kernel32.java

示例12: WaitForInputIdle

public WinDef.DWORD WaitForInputIdle(WinNT.HANDLE hProcess, WinDef.DWORD dwMilliseconds); 
开发者ID:vanjadardic,项目名称:KiTTY2,代码行数:1,代码来源:User32.java

示例13: SetWinEventHook

public WinNT.HANDLE SetWinEventHook(WinDef.UINT eventMin, WinDef.UINT eventMax, WinDef.HMODULE hmodWinEventProc, Callback lpfnWinEventProc, WinDef.DWORD idProcess, WinDef.DWORD idThread, WinDef.UINT dwflags); 
开发者ID:vanjadardic,项目名称:KiTTY2,代码行数:1,代码来源:User32.java

示例14: GetWindowThreadProcessId

public WinDef.DWORD GetWindowThreadProcessId(WinDef.HWND hWnd, IntByReference lpdwProcessId); 
开发者ID:vanjadardic,项目名称:KiTTY2,代码行数:1,代码来源:User32.java

示例15: SetThreadAffinityMask

void SetThreadAffinityMask(final int pid, final WinDef.DWORD lpProcessAffinityMask) throws LastErrorException; 
开发者ID:OpenHFT,项目名称:Java-Thread-Affinity,代码行数:1,代码来源:WindowsJNAAffinity.java


注:本文中的com.sun.jna.platform.win32.WinDef.DWORD属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。