Skip to content
Discussion options

You must be logged in to vote

The comment about seeing out object was specifically for that API, not this one.

For most cases, including this one, you need to read the API docs to learn what is required. In this case, this is an [Out] void* that receives data based on the second argument.

It looks like you're trying too hard by using IntPtr. IntPtr could be made to work, but it's the harder way:

using System.Runtime.InteropServices;
using Windows.Win32;
using Windows.Win32.Foundation;
using Windows.Win32.Graphics.Dwm;

unsafe static RECT GetExtendedFrameBounds(HWND hwnd)
{
    IntPtr pRect = Marshal.AllocHGlobal(sizeof(RECT));
    try
    {
        PInvoke.DwmGetWindowAttribute(
            hwnd,
            DWMWINDOW…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Micke3rd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #866 on February 24, 2023 18:11.