/// <summary> /// Creates an instance of the <typeparamref name="RadRibbonFormBehavior"/> class. /// </summary> /// <param name="treeHandler">The associated <typeparamref name="IComponentTreeHandler"/> implementation.</param> /// <param name="shouldHandleCreateChildItems">Determines whether the behavior /// handles the CreateChildItems call.</param> public RadRibbonFormBehavior(IComponentTreeHandler treeHandler, bool shouldHandleCreateChildItems) : base(treeHandler, shouldHandleCreateChildItems) { DllWrapper dwmapi = new DllWrapper("dwmapi.dll"); DwmExtendFrameIntoClientArea = (DwmExtendFrameIntoClientAreaDelegate)dwmapi.GetFunctionAsDelegate("DwmExtendFrameIntoClientArea", typeof(DwmExtendFrameIntoClientAreaDelegate)); DwmDefWindowProc = (DwmDefWindowProcDelegate)dwmapi.GetFunctionAsDelegate("DwmDefWindowProc", typeof(DwmDefWindowProcDelegate)); }
/// <summary> /// Creates an instance of the <typeparamref name="RadRibbonFormBehavior"/> class. /// This instance is not associated with an <typeparamref name="IComponentTreeHandler"/> implementation. /// </summary> public RadRibbonFormBehavior() : base() { DllWrapper dwmapi = new DllWrapper("dwmapi.dll"); DwmExtendFrameIntoClientArea = (DwmExtendFrameIntoClientAreaDelegate)dwmapi.GetFunctionAsDelegate("DwmExtendFrameIntoClientArea", typeof(DwmExtendFrameIntoClientAreaDelegate)); DwmDefWindowProc = (DwmDefWindowProcDelegate)dwmapi.GetFunctionAsDelegate("DwmDefWindowProc", typeof(DwmDefWindowProcDelegate)); }
public static int DwmExtendFrameIntoClientArea(IntPtr hwnd, ref MARGINS margins) { IntPtr hModule = LoadLibrary("dwmapi"); if (hModule == IntPtr.Zero) { return(0); } IntPtr procAddress = GetProcAddress(hModule, "DwmExtendFrameIntoClientArea"); if (procAddress == IntPtr.Zero) { return(0); } DwmExtendFrameIntoClientAreaDelegate delegateForFunctionPointer = (DwmExtendFrameIntoClientAreaDelegate)Marshal.GetDelegateForFunctionPointer(procAddress, typeof(DwmExtendFrameIntoClientAreaDelegate)); return(delegateForFunctionPointer(hwnd, ref margins)); }
static DwmApi() { IntPtr library = DynamicImport.ImportLibrary("dwmapi.dll"); DwmExtendFrameIntoClientArea = DynamicImport.Import <DwmExtendFrameIntoClientAreaDelegate>(library, "DwmExtendFrameIntoClientArea"); }