I am attempting to use the WIN API function GetMenuItemRect and, after looking at the INTERFACE for the function TrackPopUpMenu in DFWIN.F90, have added the following to my calling program:
interface logical(4) function GetMenuItemRect(hWnd, hMenu , hItem, menrect) cDEC$ ATTRIBUTES STDCALL, ALIAS : '_GetMenuItemRect@16' :: GetMenuItemRect cDEC$ ATTRIBUTES REFERENCE :: menrect use dfwinty integer hWnd integer hMenu integer hitem type (T_RECT) menrect end function GetMenuItemRect end interface
and used the following call
RETLOG=GetMenuItemRect(ghWnd,hMenu,2, dropdrect )
The routine compiles ok (with dropdrect defined as TYPE (T_RECT) ), but I keep getting the link error
OPENFILE.OBJ : error LNK2001: unresolved external symbol _GETMENUITEMRECT@16 Release/generic.exe : fatal error LNK1120: 1 unresolved externals
With the above interface block, the alias '_GetMenuItemRect@16' should ensure that the required routine is recognised. I know that TrackPopUpMenu has exactly similar interface(but with 7 arguments, hence @28 is appended to the alias '_TrackPopUpMenu' ) and it is found and linked ok and I know that both routines are
in USER32.DLL. It is frustrating that the linker is still refusing to find GetMenuItemRect !!
Please can you advise?