将CoreWindow作为函数参数传递时出错

时间:2020-10-28 12:24:33

标签: c++ windows uwp windows-runtime directx

我是UWP和WinRT的新手,我已经了解DirectX11和Win32,并且对学习UWP和WinRT非常感兴趣。

DXMainResources是使用Diret3D和Direct2D的类,创建资源时最重要的是窗口(CoreWindow),但是,当将窗口作为函数参数传递时,会出现许多错误,例如:

C2065错误'bEnableDepthStencilBuffer':未声明的标识符 错误C2065“窗口”:未声明的标识符 错误C2065'window_':未声明的标识符

面对这些错误,删除CoreWindow窗口参数并编译程序,但是将窗口作为参数是必需的,因为我需要它的高度和宽度来为深度模具视图创建交换链和纹理。

是否可以通过窗口作为参数?

我正在使用DirectX 11.3界面,而我使用的WinRT版本是2.0.201026.4

var compXPath = "//div[@title='Test']"
var compLocator = by.xpath(compXPath);

this.clickOnComp=async function(){
  var elementsCount = await getElementCount(compLocator); 
  console.info("No. of elements : "+elementsCount);

  if(elementsCount > 1){
    var currentEle = elementsCount+1;
    var currentCompXPath = compXPath + "/["+ currentEle +"]" // line no.9
    console.info("current Comp xpath :" +currentCompXPath);

    var currentCompLocator = by.xpath(currentCompXPath)
    await clickElement(currentCompLocator);
    console.info("Clicked : "+currentCompLocator);
  }
  else{
    await clickElement(compLocator);
  } 
}

1 个答案:

答案 0 :(得分:0)

请参阅document中的重要,请添加以下#include语句和using语句,然后尝试编译您的项目。

#include <winrt/Windows.UI.Core.h>
using namespace winrt::Windows::UI::Core;