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


Java Pointer.createConstant方法代码示例

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


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

示例1: init

import com.sun.jna.Pointer; //导入方法依赖的package包/类
@Override
public void init() {
	super.init();
	WindowManager.createWindow(handle, window, true);

	long hwndGLFW = glfwGetWin32Window(window.getID());
	HWND hwnd = new HWND(Pointer.createConstant(hwndGLFW));

	WindowProc proc = new WindowProc() {

		@Override
		public long invoke(long hw, int uMsg, long wParam, long lParam) {
			if (hw == hwndGLFW)
				switch (uMsg) {
				case WM_WINDOWPOSCHANGING:
					WINDOWPOS pos = new WINDOWPOS(new Pointer(lParam));
					pos.flags |= SWP_NOZORDER | SWP_NOACTIVATE;
					pos.write();
					break;
				}
			return org.lwjgl.system.windows.User32.DefWindowProc(hw, uMsg, wParam, lParam);
		}
	};
	User32.INSTANCE.SetWindowLongPtr(hwnd, GWL_WNDPROC, Pointer.createConstant(proc.address()));
	User32Ext.INSTANCE.SetWindowLongPtr(hwnd, GWL_EXSTYLE, WS_EX_TOOLWINDOW);
	User32Ext.INSTANCE.SetWindowLongPtr(hwnd, GWL_STYLE, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN);

	User32.INSTANCE.SetWindowPos(hwnd, new HWND(Pointer.createConstant(HWND_BOTTOM)), 0, 0, 0, 0,
			SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
	wallpaper = window.getResourceLoader().loadNVGTexture(getCurrentDesktopWallpaper(), true);
	TaskManager.addTask(() -> window.setVisible(true));
}
 
开发者ID:Guerra24,项目名称:NanoUI,代码行数:33,代码来源:Background.java

示例2: init

import com.sun.jna.Pointer; //导入方法依赖的package包/类
@Override
public void init() {
	super.init();
	WindowManager.createWindow(handle, window, true);

	ResourceLoader loader = window.getResourceLoader();
	segoeui = loader.loadNVGFont("C:\\Windows\\Fonts\\segoeui", "Segoe UI", true);
	segoemdl2 = loader.loadNVGFont("C:\\Windows\\Fonts\\segmdl2", "Segoe MDL2", true);

	compWin = new ComponentWindow(window);
	compWin.init(window);
	compWin.setBackgroundColor(0, 0, 0, 0);
	compWin.setLayout(new FlowLayout(Direction.UP, 0, 0));
	compWin.getTitlebar().setEnabled(false);

	long hwndGLFW = glfwGetWin32Window(window.getID());
	local = new HWND(Pointer.createConstant(hwndGLFW));

	AccentPolicy accent = new AccentPolicy();
	accent.AccentState = Accent.ACCENT_ENABLE_ACRYLIC;
	accent.GradientColor = 0x7F000000;
	accent.AccentFlags = 2;
	int accentStructSize = accent.size();
	accent.write();
	Pointer accentPtr = accent.getPointer();

	WindowCompositionAttributeData data = new WindowCompositionAttributeData();
	data.Attribute = WindowCompositionAttribute.WCA_ACCENT_POLICY;
	data.SizeOfData = accentStructSize;
	data.Data = accentPtr;

	User32Ext.INSTANCE.SetWindowCompositionAttribute(local, data);
	long dwp = User32Ext.INSTANCE.GetWindowLongPtr(local, GWL_WNDPROC);
	WindowProc proc = new WindowProc() {

		@Override
		public long invoke(long hw, int uMsg, long wParam, long lParam) {
			if (hw == hwndGLFW)
				switch (uMsg) {
				case WM_KILLFOCUS:
					TaskManager.addTask(() -> window.setVisible(false));
					break;
				}
			return JNI.callPPPP(dwp, hw, uMsg, wParam, lParam);
		}
	};
	User32.INSTANCE.SetWindowLongPtr(local, GWL_WNDPROC, Pointer.createConstant(proc.address()));
	User32Ext.INSTANCE.SetWindowLongPtr(local, GWL_EXSTYLE, WS_EX_TOOLWINDOW);

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

示例3: init

import com.sun.jna.Pointer; //导入方法依赖的package包/类
@Override
public void init() {
	super.init();

	WindowManager.createWindow(handle, window, true);

	ResourceLoader loader = window.getResourceLoader();
	segoeui = loader.loadNVGFont("C:\\Windows\\Fonts\\segoeui", "Segoe UI", true);
	segoemdl2 = loader.loadNVGFont("C:\\Windows\\Fonts\\segmdl2", "Segoe MDL2", true);

	compWin = new ComponentWindow(window);
	compWin.setBackgroundColor(0, 0, 0, 0);
	compWin.getTitlebar().setEnabled(false);

	long hwndGLFW = glfwGetWin32Window(window.getID());
	local = new HWND(Pointer.createConstant(hwndGLFW));

	AccentPolicy accent = new AccentPolicy();
	accent.AccentState = Accent.ACCENT_ENABLE_ACRYLIC;
	accent.GradientColor = 0x7F000000;
	accent.AccentFlags = 2;
	int accentStructSize = accent.size();
	accent.write();
	Pointer accentPtr = accent.getPointer();

	WindowCompositionAttributeData data = new WindowCompositionAttributeData();
	data.Attribute = WindowCompositionAttribute.WCA_ACCENT_POLICY;
	data.SizeOfData = accentStructSize;
	data.Data = accentPtr;

	User32Ext.INSTANCE.SetWindowCompositionAttribute(local, data);
	long dwp = User32Ext.INSTANCE.GetWindowLongPtr(local, GWL_WNDPROC);
	WindowProc proc = new WindowProc() {

		@Override
		public long invoke(long hw, int uMsg, long wParam, long lParam) {
			if (hw == hwndGLFW)
				switch (uMsg) {
				case WM_KILLFOCUS:
					//DWMapiExt.INSTANCE.InvokeAeroPeek(false, hwndWin, local, 3, new INT_PTR(32), 0x3244);
					//DWMapiExt.INSTANCE.DwmpActivateLivePreview(0, hwndWin, local, 1);
					TaskManager.addTask(() -> window.setVisible(false));
					break;
				}
			return JNI.callPPPP(dwp, hw, uMsg, wParam, lParam);
		}
	};
	User32.INSTANCE.SetWindowLongPtr(local, GWL_WNDPROC, Pointer.createConstant(proc.address()));
	User32Ext.INSTANCE.SetWindowLongPtr(local, GWL_EXSTYLE, WS_EX_TOOLWINDOW);
	thumbnail = new IntByReference();
}
 
开发者ID:Guerra24,项目名称:NanoUI,代码行数:52,代码来源:WindowPreview.java

示例4: init

import com.sun.jna.Pointer; //导入方法依赖的package包/类
@Override
public void init() {
	super.init();
	WindowManager.createWindow(handle, window, true);

	ResourceLoader loader = window.getResourceLoader();
	segoeui = loader.loadNVGFont("C:\\Windows\\Fonts\\segoeui", "Segoe UI", true);
	segoemdl2 = loader.loadNVGFont("C:\\Windows\\Fonts\\segmdl2", "Segoe MDL2", true);

	compWin = new ComponentWindow(window);
	compWin.init(window);
	compWin.setBackgroundColor(0, 0, 0, 0);
	compWin.getTitlebar().setEnabled(false);
	icons = new Container(0, 0, 200, 200);
	icons.setLayout(new FlowLayout(Direction.RIGHT, 0, 0));
	compWin.addComponent(icons);

	long hwndGLFW = glfwGetWin32Window(window.getID());
	local = new HWND(Pointer.createConstant(hwndGLFW));

	AccentPolicy accent = new AccentPolicy();
	accent.AccentState = Accent.ACCENT_ENABLE_BLURBEHIND;
	accent.GradientColor = 0xBE282828;
	accent.AccentFlags = 2;
	int accentStructSize = accent.size();
	accent.write();
	Pointer accentPtr = accent.getPointer();

	WindowCompositionAttributeData data = new WindowCompositionAttributeData();
	data.Attribute = WindowCompositionAttribute.WCA_ACCENT_POLICY;
	data.SizeOfData = accentStructSize;
	data.Data = accentPtr;

	User32Ext.INSTANCE.SetWindowCompositionAttribute(local, data);
	long dwp = User32Ext.INSTANCE.GetWindowLongPtr(local, GWL_WNDPROC);
	WindowProc proc = new WindowProc() {

		@Override
		public long invoke(long hw, int uMsg, long wParam, long lParam) {
			if (hw == hwndGLFW)
				switch (uMsg) {
				case WM_KILLFOCUS:
					TaskManager.addTask(() -> window.setVisible(false));
					break;
				}
			return JNI.callPPPP(dwp, hw, uMsg, wParam, lParam);
		}
	};
	User32.INSTANCE.SetWindowLongPtr(local, GWL_WNDPROC, Pointer.createConstant(proc.address()));
	User32Ext.INSTANCE.SetWindowLongPtr(local, GWL_EXSTYLE, WS_EX_TOOLWINDOW);

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


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