public void toggleAutoHide()
{
APPBARDATA data = new APPBARDATA.ByReference();
data.hWnd = hWndGlobal;
data.cbSize.setValue(data.size());
data.lParam.setValue(Shell32.INSTANCE.SHAppBarMessage(new DWORD(ShellAPI.ABM_GETSTATE), data).longValue());
data.lParam.setValue(data.lParam.intValue() ^ 0x0000001);
UINT_PTR result = Shell32.INSTANCE.SHAppBarMessage(new DWORD(ShellAPI.ABM_SETSTATE), data);
}
I have the code above that is supposed to autohide a created appbar, but somehow instead of doing this to the actual bar I'm creating, it's actually changing the status of the main Windows taskbar. Any clue what step I'm missing?
EDIT:
I've modified the code and changed the call but I'm getting the same values all the time, regardless of what I set the values to.
public void toggleAutoHide()
{
APPBARDATA data = new APPBARDATA.ByReference();
data.hWnd = hWndGlobal;
data.cbSize.setValue(data.size());
data.uEdge.setValue(ShellAPI.ABE_TOP);
System.out.println("LParam [byte, int]: " + data.lParam.byteValue() + " -- " + data.lParam.intValue());
//lParam always shows 0
if(data.lParam.intValue() == 1)
{
data.lParam.setValue(0);
}
else
{
data.lParam.setValue(1);
}
UINT_PTR result = Shell32.INSTANCE.SHAppBarMessage(new DWORD(ShellAPI.ABM_SETAUTOHIDEBAR), data);
System.out.println("Result = " + result.intValue()); //always returns 1
}