2 messages in net.java.dev.jna.users[jna-users] What happens if a native ...
FromSent OnAttachments
Steve Sobol (JDN)Jan 21, 2009 9:48 pm 
Wayne MeissnerJan 21, 2009 10:33 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:[jna-users] What happens if a native library can't be loaded?Actions...
From:Steve Sobol (JDN) (java@SteveSobol.com)
Date:Jan 21, 2009 9:48:43 pm
List:net.java.dev.jna.users

Specifically,

interface DWMLibrary extends Library { DWMLibrary INSTANCE = (DWMLibrary) Native.loadLibrary("dwmapi",DWMLibrary.class); NativeLong DwmEnableComposition(int Action); NativeLong DwmIsCompositionEnabled(IntByReference pfEnabled); }

These two functions enable or disable Vista's Desktop Window Manager's Window Composition, effectively turning the Aero visual theme on or off, and check whether Window Composition is enabled.

This works on Windows Vista, and should also work on Windows Server 2008. It will fail on any earlier Windows OS, as dwmapi.dll is missing from earlier versions of Windows. It will also (obviously) fail on non-Windows operating systems.

My question: If dwmapi.dll doesn't exist (or can't be loaded for some other reason), will DWMLibrary.INSTANCE return null? That would be very convenient.

Microsoft's new marketing slogan for Windows is "Life Without Walls." But if you have no walls, how can you have windows?