Note that there are some explanatory texts on larger screens.

plurals
  1. POExtending Aero Glass in F# (PInvoke)
    primarykey
    data
    text
    <p>I'm working on a F# console application. In the properties I set the output type of application to <em>Windows Application</em> to hide the console. I also created a form to run in its place. Currently I only have a simple form with no controls. To make the form I added referances to <code>System.Windows.Forms</code> and <code>System.Drawing</code> and opened them along with <code>System.Runtime.InteropServices</code>.</p> <p>The part that I don't know how to do is extending the aero-glass. There are loads of exaples on how to do it in C#. For example, here is the API call and MARGINS structure:</p> <pre><code>[StructLayout(LayoutKind.Sequential)] public struct MARGINS { public int cxLeftWidth; public int cxRightWidth; public int cyTopHeight; public int cyBottomHeight; } [DllImport("dwmapi.dll")] pubic static extend int DwmExtendFrameIntoClientArea(IntPtr hWnd, ref MARGINS pMarInset); </code></pre> <p>The API call from Form_Load event:</p> <pre><code>MARGINS margins = new MARGINS(); margins.cxLeftWidth = 0; margins.cxRightWidth = 100; margins.cyTopHeight = 0; margins.cyBottomHeight = 0; int result = DwmExtendFrameIntoClientArea(this.Handle, ref margins); </code></pre> <p>This is what I've got so far in F#:</p> <p>The API call and MARGINS structure:</p> <pre><code>[&lt;StructLayout(LayoutKind.Sequential)&gt;] type MARGINS = struct val cxLeftWidth : int val cxRightWidth : int val cyTopHeight : int val cyBottomHeigh t: int new(left, right, top, bottom) = { cxLeftWidth = left; cxRightWidth = right; cyTopHeight = top; cyBottomHeigh = bottom } (*Is there any other way to do this?*) end [&lt;DllImport("dwmapi.dll")&gt;] extend int DwmExtendFrameIntoClientArea(IntPtr hWnd, (*I need help here*)) </code></pre> <p>The API call from Form_Load event:</p> <pre><code>let margins = new MARGINS(0, 100, 0, 0); (*Is there any other way to do this?*) let result : int = DwmExtendFrameIntoClientArea(this.Handle, (*I need help here*)) </code></pre> <p>I have been searching around but I can't find anything about using <code>ref</code> parameters like this in F#. I know this would be a lot easier to write in C# but the code behind the form will be easier to write int F# because it's a functional programing language and the whole program I'm writing is orientated around functions. I know this is purely decorative but please help.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload