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


Java LPARAM类代码示例

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


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

示例1: doKeyPress

import com.sun.jna.platform.win32.WinDef.LPARAM; //导入依赖的package包/类
@Override
protected void doKeyPress(final int keyCode, final boolean shifted) throws InterruptedException {
    logger.log(Level.FINER, "doKeyPress " + keyCode + " " + shifted);
    while (isCtrlKeyDown()) {
        Thread.sleep(100);
    }
    final int lParam = 0x00000001 | 0x50 /* scancode */<< 16 | 0x01000000 /* extended */;
    final WPARAM wparam = new WinDef.WPARAM(keyCode);
    final WPARAM wparamShift = new WinDef.WPARAM(KeyEvent.VK_SHIFT);
    final LPARAM lparamDown = new WinDef.LPARAM(lParam);
    final LPARAM lparamUp = new WinDef.LPARAM(lParam | 1 << 30 | 1 << 31);
    if (shifted) {
        User32.INSTANCE.PostMessage(handler, WM_KEYDOWN, wparamShift, lparamDown);
    }
    User32.INSTANCE.PostMessage(handler, WM_KEYDOWN, wparam, lparamDown);
    User32.INSTANCE.PostMessage(handler, WM_KEYUP, wparam, lparamUp);
    if (shifted) {
        User32.INSTANCE.PostMessage(handler, WM_KEYUP, wparamShift, lparamUp);
    }
}
 
开发者ID:paspiz85,项目名称:nanobot,代码行数:21,代码来源:BlueStacksWinPlatform.java

示例2: dispose

import com.sun.jna.platform.win32.WinDef.LPARAM; //导入依赖的package包/类
@Override
public void dispose() {
	super.dispose();
	window.dispose(AppUI.getMainWindow());
	if (ENABLED_NOTIFICATIONS)
		TrayHook.INSTANCE.UnregisterSystemTrayHook();
	User32Ext.INSTANCE.SystemParametersInfo(SPI.SPI_SETWORKAREA, 0, old.getPointer(), 0);
	User32Ext.INSTANCE.DeregisterShellHookWindow(local);
	if (noExplorer) {
		backgroundWindow.getWindow().closeDisplay();
		User32.INSTANCE.PostThreadMessage(keysThreadID, WM_QUIT, new WPARAM(), new LPARAM());
		User32Ext.INSTANCE.SystemParametersInfo(SPI.SPI_SETMINIMIZEDMETRICS, oldMM.size(), oldMM.getPointer(), 0);
	} else {
		if (taskbar != null)
			User32.INSTANCE.ShowWindow(taskbar, SW_SHOW);
	}
}
 
开发者ID:Guerra24,项目名称:NanoUI,代码行数:18,代码来源:TaskBar.java

示例3: cmdSendCommandMsg

import com.sun.jna.platform.win32.WinDef.LPARAM; //导入依赖的package包/类
public boolean cmdSendCommandMsg(String[] args) {
	if (!checkArgumentLength(args, 3))
		return false;
	WinPtr handle = findHandleWithXpath(args[0]); //xpath to HWND is first argument
	if (handle.isEmpty())
		return false;
	int id = Integer.parseInt(args[1]); //context menu id is supplied as second argument
	int idLparam = Integer.parseInt(args[2]); //context menu id is supplied as second argument
	handle.convertToNativeHwnd();
	//LRESULT result = 
	//System.out.println("Send Message  WM_COMMAND to " + handle.toString() + " PARAMS: " + id + ", " + idLparam);
	//api.user32.PostMessage(handle.hWnd, Api.WM_COMMAND, new WPARAM(id), new LPARAM(0));
	api.user32.SendMessage(handle.hWnd, Api.WM_COMMAND, new WPARAM(id), new LPARAM(idLparam));
	
	return true;
}
 
开发者ID:Synthuse,项目名称:synthuse-src,代码行数:17,代码来源:WindowsCommands.java

示例4: cmdSendMessage

import com.sun.jna.platform.win32.WinDef.LPARAM; //导入依赖的package包/类
public boolean cmdSendMessage(String[] args) {
	if (!checkArgumentLength(args, 4))
		return false;
	WinPtr handle = findHandleWithXpath(args[0]); //xpath to HWND is first argument
	if (handle.isEmpty())
		return false;
	int msg = Integer.parseInt(args[1]);
	int id = Integer.parseInt(args[2]); //context menu id is supplied as second argument
	int idLparam = Integer.parseInt(args[3]); //context menu id is supplied as second argument
	handle.convertToNativeHwnd();
	//LRESULT result = 
	//System.out.println("Send Message  WM_COMMAND to " + handle.toString() + " PARAMS: " + id + ", " + idLparam);
	//api.user32.PostMessage(handle.hWnd, Api.WM_COMMAND, new WPARAM(id), new LPARAM(0));
	api.user32.SendMessage(handle.hWnd, msg, new WPARAM(id), new LPARAM(idLparam));
	
	return true;
}
 
开发者ID:Synthuse,项目名称:synthuse-src,代码行数:18,代码来源:WindowsCommands.java

示例5: main

import com.sun.jna.platform.win32.WinDef.LPARAM; //导入依赖的package包/类
/**
 * @param args (ignored)
 */
public static void main(String[] args)
{
	System.out.println("Installed Physical Monitors: " + User32.INSTANCE.GetSystemMetrics(WinUser.SM_CMONITORS));
	
	User32.INSTANCE.EnumDisplayMonitors(null, null, new MONITORENUMPROC() {

		@Override
		public int apply(HMONITOR hMonitor, HDC hdc, RECT rect, LPARAM lparam)
		{
			enumerate(hMonitor);

			return 1;
		}
		
	}, new LPARAM(0));
}
 
开发者ID:msteiger,项目名称:MonitorBrightness,代码行数:20,代码来源:MonitorInfoDemo.java

示例6: write

import com.sun.jna.platform.win32.WinDef.LPARAM; //导入依赖的package包/类
/**
 * Writes text to cmd.exe.
 *
 * @param text The text to write to cmd.exe.
 */
public final void write(final String text) {
    for (char c : text.toCharArray()) {
        /* Send the character to cmd.exe. */
        User32.INSTANCE.PostMessage(
            this.hwnd, WinUser.WM_CHAR,
            new WPARAM(c), new LPARAM(0));

        /* Normally cmd.exe won't need a WM_KEYUP, but if this is a
         * repeated series of characters (33, aaa, etc.) then
         * cmd.exe will ignore every character other than the first
         * one unless it gets a WM_KEYUP after each WM_CHAR. */
        short vkey = User32.INSTANCE.VkKeyScan(c);
        int oemScan = User32.INSTANCE.MapVirtualKey(
            vkey & 0xff, 0); /* MAPVK_VK_TO_VSC */
        User32.INSTANCE.PostMessage(
            this.hwnd, WinUser.WM_KEYUP,
            new WPARAM(vkey & 0xff),
            new LPARAM(0 | (oemScan << 16) | (3 << 31)));
    }
}
 
开发者ID:malyn,项目名称:jnaplatext,代码行数:26,代码来源:CmdExeTyper.java

示例7: iconAdded

import com.sun.jna.platform.win32.WinDef.LPARAM; //导入依赖的package包/类
public void iconAdded(NOTIFYICONDATA data) {
	if (true)
		return;
	System.out.println("Added: " + data.uID);
	if (!iconsMap.containsKey(data.guidItem))
		iconsTask.add(() -> {
			NotificationButton btn = new NotificationButton(0, 0, 16, 16, "Test", data);
			btn.setOnButtonPress(() -> {
				User32Ext.INSTANCE.SendMessage(data.hWnd, WM_CONTEXTMENU,
						new WPARAM(Pointer.nativeValue(data.hWnd.getPointer())), new LPARAM());
			});
			icons.addComponent(btn);
			iconsMap.put(data.guidItem, btn);
		});
}
 
开发者ID:Guerra24,项目名称:NanoUI,代码行数:16,代码来源:NotificationsWindow.java

示例8: hookTheMouse

import com.sun.jna.platform.win32.WinDef.LPARAM; //导入依赖的package包/类
private LowLevelMouseProc hookTheMouse() {
    return new LowLevelMouseProc() {
        @Override
        public WinDef.LRESULT callback(int nCode, WinDef.WPARAM wParam, MSLLHOOKSTRUCT info) {
            if (nCode >= 0) {

                switch (wParam.intValue()) {
                    case JNIMouseHook.WM_LBUTTONDOWN:
                        addEventToQueue(info.pt.x, info.pt.y);
                        break;
                    case JNIMouseHook.WM_RBUTTONDOWN:
                        addEventToQueue(info.pt.x, info.pt.y);
                        break;
                    case JNIMouseHook.WM_MBUTTONDOWN:
                        addEventToQueue(info.pt.x, info.pt.y);
                        break;
                    case JNIMouseHook.WM_MOUSEMOVE:

                        break;
                    default:
                        break;
                }
                // unhook if needed
                if (threadFinish == true) {
                    USER32INST.PostQuitMessage(0);
                }
            }

            Pointer ptr = info.getPointer();
            long peer = Pointer.nativeValue(ptr);
            return USER32INST.CallNextHookEx(hhk, nCode, wParam, new LPARAM(peer));
        }
    };
}
 
开发者ID:martin-lizner,项目名称:trezor-ssh-agent,代码行数:35,代码来源:JNIMouseHook.java

示例9: cmdSelectMenu

import com.sun.jna.platform.win32.WinDef.LPARAM; //导入依赖的package包/类
public boolean cmdSelectMenu(String[] args) {
	if (!checkArgumentLength(args, 1))
		return false;
	WinPtr handle = findHandleWithXpath(args[0]);
	if (handle.isEmpty())
		return false;
	int id = findMenuIdWithXpath(args[0]);
	handle.convertToNativeHwnd();
	//LRESULT result = 
	//System.out.println("PostMessage to " + handle.hWndStr + " for id " + id);
	api.user32.PostMessage(handle.hWnd, Api.WM_COMMAND, new WPARAM(id), new LPARAM(0));
	//api.user32.SendMessage(handle.hWnd, Api.WM_COMMAND, new WPARAM(id), new LPARAM(0));
	return true;
}
 
开发者ID:Synthuse,项目名称:synthuse-src,代码行数:15,代码来源:WindowsCommands.java

示例10: cmdSelectContextMenuId

import com.sun.jna.platform.win32.WinDef.LPARAM; //导入依赖的package包/类
public boolean cmdSelectContextMenuId(String[] args) {
	if (!checkArgumentLength(args, 2))
		return false;
	WinPtr handle = findHandleWithXpath(args[0]); //xpath to HWND is first argument
	if (handle.isEmpty())
		return false;
	int id = Integer.parseInt(args[1]); //context menu id is supplied as second argument
	handle.convertToNativeHwnd();
	//LRESULT result = 
	System.out.println("PostMessage to " + handle.toString() + " for id " + id + " - " + Api.MAKELONG(id, 0));
	//api.user32.PostMessage(handle.hWnd, Api.WM_COMMAND, new WPARAM(id), new LPARAM(0));
	api.user32.SendMessage(handle.hWnd, Api.WM_COMMAND, new WPARAM(Api.MAKELONG(id, 0)), new LPARAM(0));
	
	return true;
}
 
开发者ID:Synthuse,项目名称:synthuse-src,代码行数:16,代码来源:WindowsCommands.java

示例11: getFirstItemHandle

import com.sun.jna.platform.win32.WinDef.LPARAM; //导入依赖的package包/类
private static HWND getFirstItemHandle(final String title,
		final String text, final String control) {
	HWND firstItemHWND = null;
	HWND hWnd = Control.getHandle_(title, text, control);
	if (hWnd != null) {
		firstItemHWND = Win32.user32.SendMessage(hWnd, TVM_GETNEXTITEM,
				new WPARAM(TVGN_ROOT), new LPARAM(0));
	}
	return firstItemHWND;
}
 
开发者ID:wangzhengbo,项目名称:JAutoItX,代码行数:11,代码来源:TreeView.java

示例12: MonitorControllerJna

import com.sun.jna.platform.win32.WinDef.LPARAM; //导入依赖的package包/类
public MonitorControllerJna()
{
	System.out.println("Monitors: " + User32.INSTANCE.GetSystemMetrics(User32.SM_CMONITORS));
	
	User32.INSTANCE.EnumDisplayMonitors(null, null, new MONITORENUMPROC() {

		@Override
		public int apply(HMONITOR hMonitor, HDC hdc, RECT rect, LPARAM lparam)
		{
			System.out.println("Monitor handle: " + hMonitor);

			MONITORINFOEX info = new MONITORINFOEX();
			User32.INSTANCE.GetMonitorInfo(hMonitor, info);
			System.out.println(info.rcMonitor);
			
			DWORDByReference pdwNumberOfPhysicalMonitors = new DWORDByReference();
			Dxva2.INSTANCE.GetNumberOfPhysicalMonitorsFromHMONITOR(hMonitor, pdwNumberOfPhysicalMonitors);
			int monitorCount = pdwNumberOfPhysicalMonitors.getValue().intValue();
			
			System.out.println("Physical monitors for " + hMonitor + ": " + monitorCount);
			
			PHYSICAL_MONITOR[] physMons = new PHYSICAL_MONITOR[monitorCount];
			Dxva2.INSTANCE.GetPhysicalMonitorsFromHMONITOR(hMonitor, monitorCount, physMons);
			
			for (PHYSICAL_MONITOR mon : physMons)
			{
				String desc = new String(mon.szPhysicalMonitorDescription);
				monitors.add(new MonitorJna(mon.hPhysicalMonitor, desc));
			}
			
			return 1;
		}
	}, new LPARAM(0));
}
 
开发者ID:msteiger,项目名称:MonitorBrightness,代码行数:35,代码来源:MonitorControllerJna.java

示例13: GET_X_LPARAM

import com.sun.jna.platform.win32.WinDef.LPARAM; //导入依赖的package包/类
public static int GET_X_LPARAM(LPARAM lParam) {
	return (int) lParam.longValue() & 0xFFFF;
}
 
开发者ID:Guerra24,项目名称:NanoUI,代码行数:4,代码来源:Macros.java

示例14: GET_Y_LPARAM

import com.sun.jna.platform.win32.WinDef.LPARAM; //导入依赖的package包/类
public static int GET_Y_LPARAM(LPARAM lParam) {
	return (int) (lParam.longValue() >> 16);
}
 
开发者ID:Guerra24,项目名称:NanoUI,代码行数:4,代码来源:Macros.java

示例15: update

import com.sun.jna.platform.win32.WinDef.LPARAM; //导入依赖的package包/类
@Override
public void update(float delta) {
	compWin.update(delta, window);
	if (run) {
		compWin.dispose(window);
		Container bottomBtns = new Container(0, 0, 200, 60);

		char[] name = new char[1024];
		User32Ext.INSTANCE.GetWindowTextW(hwndWin, name, name.length);
		String title = Native.toString(name);

		Button btnClose = new Button(0, 0, 200, 30, "Close");
		btnClose.setPreicon(Theme.ICON_CHROME_CLOSE);
		btnClose.setPreiconSize(12);
		btnClose.setOnButtonPress(() -> {
			User32.INSTANCE.PostMessage(this.hwndWin, WM_CLOSE, new WPARAM(), new LPARAM());
			TaskManager.addTask(() -> window.setVisible(false));
		});
		Button btnOpen = new Button(0, 30, 200, 30, title);
		btnOpen.setOnButtonPress(() -> {
			char[] classNameC = new char[128];
			User32.INSTANCE.GetClassName(hwndWin, classNameC, classNameC.length);
			String className = Native.toString(classNameC);
			if (!className.equals("ApplicationFrameWindow"))
				try {
					new ProcessBuilder(WindowUtils.getProcessFilePath(hwndWin), "").start();
				} catch (IOException e) {
					e.printStackTrace();
				}
			TaskManager.addTask(() -> window.setVisible(false));
		});
		bottomBtns.addComponent(btnClose);
		bottomBtns.addComponent(btnOpen);

		Image icon = new Image(13, 38, 16, 16, Util.getIcon(hwndWin, window), true);
		bottomBtns.addComponent(icon);
		compWin.addComponent(bottomBtns);

		Container tasks = new Container(-20, 0, 220, 140);
		tasks.setLayout(new FlowLayout(Direction.DOWN, 0, 10));
		for (int i = 0; i < 4; i++) {
			Button t = new Button(0, 0, 220, 30, "Task " + i);
			t.setWindowAlignment(Alignment.LEFT_TOP);
			t.setAlignment(Alignment.RIGHT_BOTTOM);
			tasks.addComponent(t);
		}
		compWin.addComponent(tasks);
		TaskManager.addTask(() -> window.setVisible(true));
		run = false;
	}

}
 
开发者ID:Guerra24,项目名称:NanoUI,代码行数:53,代码来源:ContextWindow.java


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