//load default text document to get an active frame
xComp = oMessageBox.createDefaultTextDocument();
XWindowPeer xWindowPeer = oMessageBox.getWindowPeerOfFrame(xComp);
if (xWindowPeer != null) {
XVclWindowPeer xVclWindowPeer = (XVclWindowPeer) UnoRuntime.queryInterface(XVclWindowPeer.class, xWindowPeer);
boolean bisHighContrast = oMessageBox.isHighContrastModeActivated(xVclWindowPeer);
oMessageBox.showErrorMessageBox(xWindowPeer, "My Sampletitle", "HighContrastMode is enabled: " + bisHighContrast);
} else{
System.out.println("Could not retrieve current frame");
}