我制作 DXGI 适配器和监视器枚举。连接到我的计算机的第二台显示器是 Dell P2715Q,分辨率为 3840*2160:
但是,程序将其报告为 2560*1440,这是第二个可用分辨率。重现的最少代码:
int main()
{
IDXGIFactory1* pFactory1;
HRESULT hr = CreateDXGIFactory1(__uuidof(IDXGIFactory1), (void**)(&pFactory1));
if (FAILED(hr))
{
wcout << L"CreateDXGIFactory1 failed. " << endl;
return 0;
}
for (UINT i = 0;; i++)
{
IDXGIAdapter1* pAdapter1 = nullptr;
hr = pFactory1->EnumAdapters1(i, &pAdapter1);
if (hr == DXGI_ERROR_NOT_FOUND)
{
// no more adapters
break;
}
if (FAILED(hr))
{
wcout << L"EnumAdapters1 failed. " << endl;
return 0;
}
DXGI_ADAPTER_DESC1 desc;
hr = pAdapter1->GetDesc1(&desc);
if (FAILED(hr))
{
wcout << L"GetDesc1 failed. " << endl;
return 0;
}
wcout << L"Adapter: " << desc.Description << endl;
for (UINT j = 0;; j++)
{
IDXGIOutput *pOutput = nullptr;
HRESULT hr = pAdapter1->EnumOutputs(j, &pOutput);
if (hr == DXGI_ERROR_NOT_FOUND)
{
// no more outputs
break;
}
if (FAILED(hr))
{
wcout << L"EnumOutputs failed. " << endl;
return 0;
}
DXGI_OUTPUT_DESC desc;
hr = pOutput->GetDesc(&desc);
if (FAILED(hr))
{
wcout << L"GetDesc1 failed. " << endl;
return 0;
}
wcout << L" Output: " << desc.DeviceName <<
L" (" << desc.DesktopCoordinates.left << L"," << desc.DesktopCoordinates.top << L")-(" <<
(desc.DesktopCoordinates.right - desc.DesktopCoordinates.left) << L"," <<
(desc.DesktopCoordinates.bottom - desc.DesktopCoordinates.top) << L")" << endl;
}
}
return 0;
}
输出:
Adapter: Intel(R) Iris(TM) Pro Graphics 6200 Output: \\.\DISPLAY1 (0,0)-(1920,1200) Output: \\.\DISPLAY2 (1920,0)-(2560,1440)
什么会导致此行为:DirectX 限制、视频内存、显示适配器、驱动程序、显示器?
环境:
Windows 10 x64 Intel(R) Iris(TM) Pro Graphics 6200 DELL P2715Q
最佳答案
您的应用程序被视为不了解 DPI 缩放。操作系统为您缩放坐标,大概是为了保持与遗留应用程序的兼容性。
让系统知道你知道High DPI Desktop Application Development你会得到你期望的坐标:
#include <ShellScalingAPI.h>
#pragma comment(lib, "shcore.lib")
int main()
{
SetProcessDpiAwareness(PROCESS_SYSTEM_DPI_AWARE);
// there goes your code
Adapter: Intel(R) HD Graphics 4600
Output: \\.\DISPLAY4 (0,0)-(3840,2160)
Output: \\.\DISPLAY5 (3840,0)-(3840,2160)
没有SetProcessDpiAwareness:
Adapter: Intel(R) HD Graphics 4600
Output: \\.\DISPLAY4 (0,0)-(2194,1234)
Output: \\.\DISPLAY5 (2194,0)-(2194,1234)
备注DXGI_OUTPUT_DESC structure MSDN 评论:
DesktopCoordinates
Type: RECT
A RECT structure containing the bounds of the output in desktop coordinates. Desktop coordinates depend on the dots per inch (DPI) of the desktop. For info about writing DPI-aware Win32 apps, see High DPI.
关于c++ - DXGI 显示器枚举未提供 Dell P2715Q 显示器的完整尺寸,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48172751/
我得到了一个包含嵌套链接的表单。编辑时链接字段为空的问题。这是我的表格:Editingkategori{:action=>'update',:id=>@konkurrancer.id})do|f|%>'Trackingurl',:style=>'width:500;'%>'Editkonkurrence'%>|我的konkurrencer模型:has_one:link我的链接模型:classLink我的konkurrancer编辑操作:defedit@konkurrancer=Konkurrancer.find(params[:id])@konkurrancer.link_attrib
我主要使用Ruby来执行此操作,但到目前为止我的攻击计划如下:使用gemsrdf、rdf-rdfa和rdf-microdata或mida来解析给定任何URI的数据。我认为最好映射到像schema.org这样的统一模式,例如使用这个yaml文件,它试图描述数据词汇表和opengraph到schema.org之间的转换:#SchemaXtoschema.orgconversion#data-vocabularyDV:name:namestreet-address:streetAddressregion:addressRegionlocality:addressLocalityphoto:i
我的瘦服务器配置了nginx,我的ROR应用程序正在它们上运行。在我发布代码更新时运行thinrestart会给我的应用程序带来一些停机时间。我试图弄清楚如何优雅地重启正在运行的Thin实例,但找不到好的解决方案。有没有人能做到这一点? 最佳答案 #Restartjustthethinserverdescribedbythatconfigsudothin-C/etc/thin/mysite.ymlrestartNginx将继续运行并代理请求。如果您将Nginx设置为使用多个上游服务器,例如server{listen80;server
所以我在关注Railscast,我注意到在html.erb文件中,ruby代码有一个微弱的背景高亮效果,以区别于其他代码HTML文档。我知道Ryan使用TextMate。我正在使用SublimeText3。我怎样才能达到同样的效果?谢谢! 最佳答案 为SublimeText安装ERB包。假设您安装了SublimeText包管理器*,只需点击cmd+shift+P即可获得命令菜单,然后键入installpackage并选择PackageControl:InstallPackage获取包管理器菜单。在该菜单中,键入ERB并在看到包时选择
我试图在索引页中创建一个超链接,但它没有显示,也没有给出任何错误。这是我的index.html.erb代码。ListingarticlesTitleTextssss我检查了我的路线,我认为它们也没有问题。PrefixVerbURIPatternController#Actionwelcome_indexGET/welcome/index(.:format)welcome#indexarticlesGET/articles(.:format)articles#indexPOST/articles(.:format)articles#createnew_articleGET/article
我是rails的新手,想在form字段上应用验证。myviewsnew.html.erb.....模拟.rbclassSimulation{:in=>1..25,:message=>'Therowmustbebetween1and25'}end模拟Controller.rbclassSimulationsController我想检查模型类中row字段的整数范围,如果不在范围内则返回错误信息。我可以检查上面代码的范围,但无法返回错误消息提前致谢 最佳答案 关键是您使用的是模型表单,一种显示ActiveRecord模型实例属性的表单。c
我在Rails应用程序中使用CarrierWave/Fog将视频上传到AmazonS3。有没有办法判断上传的进度,让我可以显示上传进度如何? 最佳答案 CarrierWave和Fog本身没有这种功能;你需要一个前端uploader来显示进度。当我不得不解决这个问题时,我使用了jQueryfileupload因为我的堆栈中已经有jQuery。甚至还有apostonCarrierWaveintegration因此您只需按照那里的说明操作即可获得适用于您的应用的进度条。 关于ruby-on-r
目前,Itembelongs_toCompany和has_manyItemVariants。我正在尝试使用嵌套的fields_for通过Item表单添加ItemVariant字段,但是使用:item_variants不显示该表单。只有当我使用单数时才会显示。我检查了我的关联,它们似乎是正确的,这可能与嵌套在公司下的项目有关,还是我遗漏了其他东西?提前致谢。注意:下面的代码片段中省略了不相关的代码。编辑:不知道这是否相关,但我正在使用CanCan进行身份验证。routes.rbresources:companiesdoresources:itemsenditem.rbclassItemi
如何将send与+=一起使用?a=20;a.send"+=",10undefinedmethod`+='for20:Fixnuma=20;a+=10=>30 最佳答案 恐怕你不能。+=不是方法,而是语法糖。参见http://www.ruby-doc.org/docs/ProgrammingRuby/html/tut_expressions.html它说Incommonwithmanyotherlanguages,Rubyhasasyntacticshortcut:a=a+2maybewrittenasa+=2.你能做的最好的事情是:
如果我在模型中设置验证消息validates:name,:presence=>{:message=>'Thenamecantbeblank.'}我如何让该消息显示在闪光警报中,这是我迄今为止尝试过的方法defcreate@message=Message.new(params[:message])if@message.valid?ContactMailer.send_mail(@message).deliverredirect_to(root_path,:notice=>"Thanksforyourmessage,Iwillbeintouchsoon")elseflash[:error]