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


Java WPARAM类代码示例

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


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

示例1: doKeyPress

import com.sun.jna.platform.win32.WinDef.WPARAM; //导入依赖的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.WPARAM; //导入依赖的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.WPARAM; //导入依赖的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.WPARAM; //导入依赖的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: write

import com.sun.jna.platform.win32.WinDef.WPARAM; //导入依赖的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

示例6: iconAdded

import com.sun.jna.platform.win32.WinDef.WPARAM; //导入依赖的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

示例7: cmdSelectMenu

import com.sun.jna.platform.win32.WinDef.WPARAM; //导入依赖的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

示例8: cmdSelectContextMenuId

import com.sun.jna.platform.win32.WinDef.WPARAM; //导入依赖的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

示例9: getFirstChildHandle

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

示例10: getFirstItemHandle

import com.sun.jna.platform.win32.WinDef.WPARAM; //导入依赖的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

示例11: getNextSiblingHandle

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

示例12: getString

import com.sun.jna.platform.win32.WinDef.WPARAM; //导入依赖的package包/类
/**
 * Retrieves the item according to index in a ListBox or ComboBox.
 * 
 * Certain commands that work on normal Combo and ListBoxes do not work on
 * "ComboLBox" controls. When using a control name in the Control functions,
 * you need to add a number to the end of the name to indicate which
 * control. For example, if there two controls listed called "MDIClient",
 * you would refer to these as "MDIClient1" and "MDIClient2". Use
 * AU3_Spy.exe to obtain a control's number.
 * 
 * When using text instead of ClassName# in "Control" commands, be sure to
 * use the entire text of the control. Partial text will fail.
 * 
 * @param title
 *            The title of the window to access.
 * @param text
 *            The text of the window to access.
 * @param control
 *            The control to interact with.
 * @param index
 *            The zero-based index of the item to retrieve.
 * @return Returns the item according to index in a ListBox or ComboBox.
 */
public static String getString(final String title, final String text,
		final String control, final int index) {
	String item = null;
	if (index >= 0) {
		HWND hWnd = getHandle_(title, text, control);
		if (hWnd != null) {
			boolean isComboBox = Win32.isComboBox(hWnd);
			boolean isListBox = Win32.isListBox(hWnd);
			if (isComboBox || isListBox) {
				int getItemLengthMessage = LB_GETTEXTLEN;
				int getItemMessage = LB_GETTEXT;
				if (isComboBox) {
					getItemLengthMessage = CB_GETLBTEXTLEN;
					getItemMessage = CB_GETLBTEXT;
				}

				// get item length
				int itemLength = Win32.user32.SendMessage(hWnd,
						getItemLengthMessage, index, 0);
				if (itemLength == 0) {
					item = "";
				} else if (itemLength > 0) {
					// get item
					final CharBuffer buffer = CharBuffer
							.allocate(itemLength + 1);
					Win32.user32.SendMessage(hWnd, getItemMessage,
							new WPARAM(index), buffer);
					item = Native.toString(buffer.array());
				}
			}
		}
	}

	return item;
}
 
开发者ID:wangzhengbo,项目名称:JAutoItX,代码行数:59,代码来源:Control.java

示例13: setIcon

import com.sun.jna.platform.win32.WinDef.WPARAM; //导入依赖的package包/类
@Override
public void setIcon (FileHandle iconCacheFolder, FileHandle icoFile, FileHandle pngFile) {
	//WinAPI can't read icon from JAR, needs copying to some other location
	FileHandle cachedIco = iconCacheFolder.child(icoFile.name());
	if (cachedIco.exists() == false) icoFile.copyTo(cachedIco);

	try {
		HANDLE hImage = User32.INSTANCE.LoadImage(Kernel32.INSTANCE.GetModuleHandle(""), cachedIco.path(),
				WinUser.IMAGE_ICON, 0, 0, WinUser.LR_LOADFROMFILE);
		User32.INSTANCE.SendMessageW(User32.INSTANCE.GetActiveWindow(), User32.WM_SETICON, new WPARAM(User32.BIG_ICON), hImage);
	} catch (Exception e) {
		throw new IllegalStateException(e);
	}
}
 
开发者ID:kotcrab,项目名称:vis-editor,代码行数:15,代码来源:GLFWIconSetter.java

示例14: update

import com.sun.jna.platform.win32.WinDef.WPARAM; //导入依赖的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

示例15: hookTheMouse

import com.sun.jna.platform.win32.WinDef.WPARAM; //导入依赖的package包/类
public LowLevelMouseProc hookTheMouse()
{
	return new LowLevelMouseProc()
	{

		public LRESULT callback(int nCode, WPARAM wParam,
				MOUSEHOOKSTRUCT info)
		{
			LRESULT result = USER32INST.CallNextHookEx(hhk, nCode, wParam,
					new WinDef.LPARAM(Pointer.nativeValue(info.getPointer())));
			if (nCode >= 0)
			{
				int action = wParam.intValue();
				// System.out.println(action);
				switch (action)
				{
				case WM_LBUTTONDOWN:
					// do stuff
					break;
				case WM_RBUTTONDOWN:
					WindowsXPMouse.action.run();
					break;
				case WM_MBUTTONDOWN:
					// do other stuff
					break;
				case WM_LBUTTONUP:
					WindowsXPMouse.action.run();
					break;
				case WM_MOUSEMOVE:

					break;
				default:
					break;
				}
				/**************************** DO NOT CHANGE, this code unhooks mouse *********************************/
				if (threadFinish == true)
				{
					// System.out.println("post quit");
					USER32INST.PostQuitMessage(0);
				}
				/*************************** END OF UNCHANGABLE *******************************************************/
			}
			return result;
		}
	};
}
 
开发者ID:yajsw,项目名称:yajsw,代码行数:47,代码来源:WindowsXPMouse.java


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