Actual behavior
CsWin32 generates the function signature for TrackPopupMenu and TrackPopupMenuEx as bool, which is correct for using no parameters. The "Return value" section however states that the return value will be an UINT_PTR (IntPtr, int?) when TPM_RETURNCMD has been passed.
Expected behavior
Our function sig that we have written is this:
[DllImport(nameof(User32))]
internal static extern int TrackPopupMenuEx(IntPtr hmenu, uint fuFlags, int x, int y, IntPtr hwnd, IntPtr lptpm);
Repro steps
NativeMethods.txt content:
TrackPopupMenu
TrackPopupMenuEx
- Any of your own code that should be shared?
unsafe
{
// this turns into a type compiler error
int clickedItemId = PInvoke.TrackPopupMenuEx(_hMenu, (uint)TRACK_POPUP_MENU_FLAGS.TPM_RETURNCMD, x, y, hWnd);
}
Context
- CsWin32 version:
0.1.506-beta
- Target Framework:
net5.0-windows
Actual behavior
CsWin32 generates the function signature for
TrackPopupMenuandTrackPopupMenuExasbool, which is correct for using no parameters. The "Return value" section however states that the return value will be anUINT_PTR(IntPtr,int?) whenTPM_RETURNCMDhas been passed.Expected behavior
Our function sig that we have written is this:
Repro steps
NativeMethods.txtcontent:Context
0.1.506-betanet5.0-windows