⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 msg.java

📁 一个开源的组件
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
package org.xvolks.jnative.misc;
import org.xvolks.jnative.exceptions.*;
import org.xvolks.jnative.misc.basicStructures.*;
import org.xvolks.jnative.pointers.*;
import org.xvolks.jnative.pointers.memory.*;

/**
 * $Id: MSG.java,v 1.8 2007/03/16 21:06:14 thubby Exp $
 *
 * TODO : Create each value : createPointer should copy values in memory and back
 * TODO : this should be a BasicData<MSG>
 * <pre>
 * The C structure
 * typedef struct {
 * &nbsp;	HWND hwnd;
 * &nbsp;	 UINT message;
 * &nbsp;	WPARAM wParam;
 * &nbsp;	LPARAM lParam;
 * &nbsp;	DWORD time;
 * &nbsp;	POINT pt;
 * } MSG, *PMSG;</pre>
 * This software is released under the LGPL.
 * @author Created by Marc DENTY - (c) 2006 JNative project
 */
public class MSG implements BasicData<Pointer> {
	
	/**
	 * Method getPointer
	 *
	 * @return   a Pointer
	 *
	 */
	public Pointer getPointer() {
		return mPointer;
	}
	
	
	private Pointer mPointer;
	
	public MSG() throws NativeException {
		createPointer();
	}
	
	/**
	 * Method createPointer
	 *
	 * @return   a MemoryBlock
	 *
	 */
	public Pointer createPointer() throws NativeException {
		mPointer = new Pointer(MemoryBlockFactory.createMemoryBlock(sizeOf()));
		return mPointer;
	}
	
	/**
	 * Method getValueFromPointer
	 *
	 * @return   a T
	 *
	 */
	public Pointer getValueFromPointer() {
		return mPointer;
	}
	
	
	/**
	 * Method getValue
	 *
	 * @return   a T
	 *
	 */
	public Pointer getValue() {
		return mPointer;
	}
	
	/**
	 * Method getSizeOf
	 * @return   the size of this data
	 */
	public int getSizeOf() {
		return sizeOf();
	}
	
	public static int sizeOf() {
		return HWND.sizeOf() + UINT.sizeOf() + WPARAM.sizeOf() + LPARAM.sizeOf() + 4 + Point.sizeOf();
	}
	
	
	/**
	 * Method getMessage()
	 * @return returns the message identifier
	 * @throws NativeException
	 */
	public UINT getMessage() throws NativeException {
		return new UINT(mPointer.getAsShort(4));
	}

	
	public class WindowsConstants {
		/*
		 * ShowWindow() Commands
		 */

		public static final int SW_HIDE             = 0;
		public static final int SW_SHOWNORMAL       = 1;
		public static final int SW_NORMAL           = 1;
		public static final int SW_SHOWMINIMIZED    = 2;
		public static final int SW_SHOWMAXIMIZED    = 3;
		public static final int SW_MAXIMIZE         = 3;
		public static final int SW_SHOWNOACTIVATE   = 4;
		public static final int SW_SHOW             = 5;
		public static final int SW_MINIMIZE         = 6;
		public static final int SW_SHOWMINNOACTIVE  = 7;
		public static final int SW_SHOWNA           = 8;
		public static final int SW_RESTORE          = 9;
		public static final int SW_SHOWDEFAULT      = 10;
		public static final int SW_FORCEMINIMIZE    = 11;
		public static final int SW_MAX              = 11;

		/*
		 * Window Styles
		 */
		public static final int WS_OVERLAPPED       = 0x00000000;
		public static final int WS_POPUP            = 0x80000000;
		public static final int WS_CHILD            = 0x40000000;
		public static final int WS_MINIMIZE         = 0x20000000;
		public static final int WS_VISIBLE          = 0x10000000;
		public static final int WS_DISABLED         = 0x08000000;
		public static final int WS_CLIPSIBLINGS     = 0x04000000;
		public static final int WS_CLIPCHILDREN     = 0x02000000;
		public static final int WS_MAXIMIZE         = 0x01000000;
		public static final int WS_CAPTION          = 0x00C00000;     /* WS_BORDER | WS_DLGFRAME  */
		public static final int WS_BORDER           = 0x00800000;
		public static final int WS_DLGFRAME         = 0x00400000;
		public static final int WS_VSCROLL          = 0x00200000;
		public static final int WS_HSCROLL          = 0x00100000;
		public static final int WS_SYSMENU          = 0x00080000;
		public static final int WS_THICKFRAME       = 0x00040000;
		public static final int WS_GROUP            = 0x00020000;
		public static final int WS_TABSTOP          = 0x00010000;
		
		public static final int WS_MINIMIZEBOX      = 0x00020000;
		public static final int WS_MAXIMIZEBOX      = 0x00010000;
		
		
		public static final int WS_TILED            = WS_OVERLAPPED;
		public static final int WS_ICONIC           = WS_MINIMIZE;
		public static final int WS_SIZEBOX          = WS_THICKFRAME;
		
//		public final static int WM_CHAR = 258;
//		public final static int WM_CHARTOITEM = 47;
//		public final static int WM_CHILDACTIVATE = 34;
//		public final static int WM_CLEAR = 771;
//		public final static int WM_CLOSE = 16;
//		public final static int WM_COMMAND = 273;
//		public final static int WM_COMMNOTIFY = 68;                /* obsolete */
//		public final static int WM_COMPACTING = 65;
//		public final static int WM_COMPAREITEM = 57;
//		public final static int WM_CONTEXTMENU = 123;
//		public final static int WM_COPY = 769;
//		public final static int WM_COPYDATA = 74;
//		public final static int WM_CREATE = 1;
//		public final static int WM_CTLCOLORBTN = 309;
//		public final static int WM_CTLCOLORDLG = 310;
//		public final static int WM_CTLCOLOREDIT = 307;
//		public final static int WM_CTLCOLORLISTBOX = 308;
//		public final static int WM_CTLCOLORMSGBOX = 306;
//		public final static int WM_CTLCOLORSCROLLBAR = 311;
//		public final static int WM_CTLCOLORSTATIC = 312;
//		public final static int WM_CUT = 768;
//		public final static int WM_DEADCHAR = 259;
//		public final static int WM_DELETEITEM = 45;
//		public final static int WM_DESTROY = 2;
//		public final static int WM_DESTROYCLIPBOARD = 775;
//		public final static int WM_DEVICECHANGE = 537;
//		public final static int WM_DEVMODECHANGE = 27;
//		public final static int WM_DISPLAYCHANGE = 126;
//		public final static int WM_DRAWCLIPBOARD = 776;
//		public final static int WM_DRAWITEM = 43;
//		public final static int WM_DROPFILES = 563;
//		public final static int WM_ENABLE = 10;
//		public final static int WM_ENDSESSION = 22;
//		public final static int WM_ENTERIDLE = 289;
//		public final static int WM_ENTERMENULOOP = 529;
//		public final static int WM_ENTERSIZEMOVE = 561;
//		public final static int WM_ERASEBKGND = 20;
//		public final static int WM_EXITMENULOOP = 530;
//		public final static int WM_EXITSIZEMOVE = 562;
//		public final static int WM_FONTCHANGE = 29;
//		public final static int WM_GETDLGCODE = 135;
//		public final static int WM_GETFONT = 49;
//		public final static int WM_GETHOTKEY = 51;
//		public final static int WM_GETICON = 127;
//		public final static int WM_GETMINMAXINFO = 36;
//		public final static int WM_GETTEXT = 13;
//		public final static int WM_GETTEXTLENGTH = 14;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -