我正在尝试链接一个目标文件,该文件使用winuser.h中声明的两个方法并在User32.dll中定义:GetMonitorInfo和WindowFromMonitor.源编译到一个目标文件就好了,但是当我尝试链接时,我得到以下错误输出:
D3dCtx.obj : error LNK2001: unresolved external symbol xGetMonitorInfo
D3dCtx.obj : error LNK2001: unresolved external symbol xMonitorFromWindow
Run Code Online (Sandbox Code Playgroud)
问题是,我不称之为"xGetMonitorInfo"或"xMonitorFromWindow".在所有源文件上运行grep表明只调用了"GetMonitorInfo"和"WindowFromMonitor".我正确地包括windows.h,其中包括winuser.h.我也正在链接器选项中正确设置我的LIBPATH,这由详细的链接输出确认.
我的详细链接输出中也出现以下内容:
Found __imp_GetMonitorInfoA
Referenced in nafxcw.lib(afxribboncategory.obj)
Referenced in nafxcw.lib(afxtooltipctrl.obj)
Referenced in nafxcw.lib(afxribbonkeytip.obj)
Referenced in nafxcw.lib(afxfullscreenimpl.obj)
Referenced in nafxcw.lib(afxframeimpl.obj)
Referenced in nafxcw.lib(afxglobalutils.obj)
Referenced in nafxcw.lib(afxdropdowntoolbar.obj)
Referenced in nafxcw.lib(wincore.obj)
Referenced in nafxcw.lib(afxglobals.obj)
Referenced in nafxcw.lib(afxpopupmenu.obj)
Referenced in nafxcw.lib(afxpropertygridtooltipctrl.obj)
Loaded User32.lib(USER32.dll)
Found __imp_MonitorFromWindow
Referenced in nafxcw.lib(wincore.obj)
Loaded User32.lib(USER32.dll)
Run Code Online (Sandbox Code Playgroud)
此外,GetMonitorInfo在winuser.h中定义为:
WINUSERAPI
BOOL
WINAPI
GetMonitorInfoA(
__in HMONITOR hMonitor,
__inout LPMONITORINFO lpmi);
WINUSERAPI
BOOL
WINAPI
GetMonitorInfoW(
__in HMONITOR …Run Code Online (Sandbox Code Playgroud) 我有一个Java应用程序,它使用Java3D和JPopupMenus填充JMenuItems.当它作为常规应用程序运行时,一切正常--JPopupMenus和其他一切都按预期运行.但是,当我从应用程序中创建一个applet时,完全弹出Canvas3D的JPopupMenu没有按预期运行.JPopupMenu的行为如下:
更多信息:
所以我的问题是:导致应用程序和applet之间的行为不同的原因是什么,以及如何在applet函数中创建JPopupMenu,就像在应用程序中一样?