-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement DwmExtendFrameIntoClientArea #1430
Comments
From the FAQ
In your case, put @FieldOrder({ "cxLeftWidth", "cxRidghtWidth", "cyTopHeight", "cyBottomHeight" })
class MARGINS extends Structure {
public int cxLeftWidth;
public int cxRightWidth;
public int cyTopHeight;
public int cyBottomHeight;
} JNA is a user-supported library. Functionality like the above is only added when users who need it contribute. Please submit a PR with these changes and we'll include it in the next version. |
Wow thankyou! |
I did end up getting an error while calling and read through the FAQ
But I didn't find much. package net.skylix.elixor.elixorFX;
import com.sun.jna.Native;
import com.sun.jna.Structure;
import com.sun.jna.platform.win32.User32;
import com.sun.jna.platform.win32.WinNT;
import com.sun.jna.win32.W32APIOptions;
import net.skylix.elixor.elixorFX.jna.MARGINS;
import javax.swing.*;
import static com.sun.jna.platform.win32.WinUser.*;
interface EUser32 extends User32 {
EUser32 INSTANCE = Native.load("user32", EUser32.class, W32APIOptions.DEFAULT_OPTIONS);
HRESULT DwmExtendFrameIntoClientArea(HWND hwnd, MARGINS pMarInset);
}
public class ElixorFX {
/**
* Extended client area example
*/
public static void init() {
ModJFrame frame = new ModJFrame();
frame.setVisible(true);
HWND hwin = frame.getHWND();
// if (message == WM_ACTIVATE)
// {
// // Extend the frame into the client area.
// MARGINS margins;
//
// margins.cxLeftWidth = LEFTEXTENDWIDTH; // 8
// margins.cxRightWidth = RIGHTEXTENDWIDTH; // 8
// margins.cyBottomHeight = BOTTOMEXTENDWIDTH; // 20
// margins.cyTopHeight = TOPEXTENDWIDTH; // 27
//
// hr = DwmExtendFrameIntoClientArea(hWnd, &margins);
//
// if (!SUCCEEDED(hr))
// {
// // Handle the error.
// }
//
// fCallDWP = true;
// lRet = 0;
// }
// we will implement the code above
// Listen for messages
MSG msg = new MSG();
int WM_ACTIVATE = 0x0006;
System.out.println("WM_ACTIVATE");
// Extend the frame into the client area.
MARGINS margins = new MARGINS() {{
cxLeftWidth = 8;
cxRightWidth = 8;
cyBottomHeight = 20;
cyTopHeight = 27;
}};
WinNT.HRESULT hr = EUser32.INSTANCE.DwmExtendFrameIntoClientArea(hwin, margins);
while (User32.INSTANCE.GetMessage(msg, hwin, 0, 0) != 0) {
User32.INSTANCE.TranslateMessage(msg);
User32.INSTANCE.DispatchMessage(msg);
if (msg.message == WM_QUIT) {
break;
} else if (msg.message == WM_ACTIVATE) {}
}
}
public static class ModJFrame extends JFrame {
public ModJFrame() {
super();
}
public HWND getHWND() {
HWND hwnd = new HWND();
hwnd.setPointer(Native.getComponentPointer(this));
return hwnd;
}
}
} I think I did everything right |
The |
sorry, im a newbie with native stuff, any docs here that could guide me on how to implement new methods for Library and how to point it to the DLL |
This extended discussion really belongs on the mailing list. But just change your |
STOP! Read this before creating an issue.
This is not a Question and Answer forum. For general questions and support, use
the JNA users' group. Please search
message history there and on existing issues for duplicates. You may also find answers on
the Using the Library section of the project
home page or in the FAQ.
Do NOT file an issue if you:
All of these questions belong on the mailing list.
If you are certain you are reporting a bug, or you have a feature request that is
not of the form "please map this API function", then you may open an issue.
Provide complete information about the problem
Java HotSpot(TM) 64-Bit Server VM (build 17.0.2+8-LTS-86, mixed mode, sharing)
User32.INSTANCE.DwmExtendFrameIntoClientArea
The text was updated successfully, but these errors were encountered: