c++-cx

How to free memory of c++ WinRT value structs

我怕爱的太早我们不能终老 提交于 2019-12-12 13:17:19
问题 Do I have to, and how do I, free memory from a value struct created in a Windows Runtime Component that has been returned to a managed C# project? I declared the struct // Custom struct public value struct PlayerData { Platform::String^ Name; int Number; double ScoringAverage; }; like auto playerdata = PlayerData(); playerdata.Name = ref new String("Bla"); return playerdata; I'm new with freeing memory and haven't got a clue how and when to free this. Anyone? 回答1: When a value struct is

Debug Media Foundation

ぐ巨炮叔叔 提交于 2019-12-12 06:04:27
问题 I'm currently trying to write a ByteStreamHandler and an audio decoder to add support for an unsupported codec in a windows store app. I followed this MPEG1 sample and adjusted it for my needs. However I'm not sure if it is loaded correctly since I always get the error MF_MEDIA_ENGINE_ERR_SRC_NOT_SUPPORTED with the HRESULT E_FAIL . I've added values to all E_FAIL results I use in my code to figure out where it happens unfortunately it doesnt seem to happen in my code. Now I'd like to know if

Can a C++/CX interface inherit from IClosable?

六月ゝ 毕业季﹏ 提交于 2019-12-12 05:25:07
问题 How does one declare a runtime interface that inherits from Windows.Foundation.IClosable in C++/CX? Both of these attempts produce compiler errors: public interface class MyInterface : Windows::Foundation::IClosable { /* bla bla */ }; ==> error C2039: 'IClosable' : is not a member of 'Windows::Foundation' and public interface class MyInterface { /* bla bla */ ~MyInterface(); }; ==> error C2849: 'MyInterface' : an interface cannot have a destructor Yet it cannot be that such inheritance is

Mix DirectX 12 and XAML controls in UWP

扶醉桌前 提交于 2019-12-12 04:26:00
问题 I would like to create a UWP app (XAML) with C++/CX and DirectX 12 so that I can mix both XAML controls (things like Grid, buttons...) and DirectX, something like a Level Editor, but I'm struggling to find a way how to initialize DirectX to render inside a specific control (like a Grid). The basic template and all the other tutorials only show how to do it within the full area of the application. When creating a device resource we set the window where to draw with SetWindow(CoreWindow:

UWP Unable to register app for Windows Store release

隐身守侯 提交于 2019-12-12 03:49:56
问题 I have a C# app targeting UWP Desktop & Mobile platforms. I want to run WACK tests prior to submitting app to store. I am trying to create app package by following the steps mentioned in this MSDN page When ever I try to reserve a name for my app, I am getting the following error: An unexpected error occurred when attempting to reserve the app name Since the error info is not very useful, I am clueless as to what is going wrong. I tried with several different name but every time I get the

Force redraw on ListView in windows store app

六月ゝ 毕业季﹏ 提交于 2019-12-11 22:06:05
问题 I am using @Romasz 's answer from Alternating Colors of rows in ListView in Windows Phone 8.1 to give alternate background to ListView items. I change it in order to highlight the selected item, like this: <local:AlternateConverter CurrentList="{Binding ElementName=myList, Path=ItemsSource}" HighlightIndex="{Binding ElementName=myList, Path=SelectedIndex}" x:Key="AlternateConverter"/> Note: I removed the AlternateBrushes property as I only need static colors and add in HighlightItem property

C++/CX - Check the type of an object?

大憨熊 提交于 2019-12-11 18:23:38
问题 Is it possible to check the type of an object in C++/CX ? I have a Vector of objects which derive from ICustomObject and as I enumerate the objects from the Vector, i'd like to know what the actual object type is. This is so that I know what properties of that object should be accessible to me. 回答1: You can use dynamic_cast - if the object is an object of MyObjectType, the result will be non null, if it's another type, the result will be nullptr. 回答2: I found that this works just fine! Type^

Generation of IDL and WinMD files for Runtime Components on WP8

£可爱£侵袭症+ 提交于 2019-12-11 11:22:39
问题 I'd like to get some clarification on something that I've been confused on for awhile. I've tried to read as much documentation (both 1st and 3rd party) on the generation of IDL and MetaData files for Runtime Components as I could, and perhaps it lies in my ability to comprehend the material, but I'm still a little (very) lost. If I understand correctly, once a Runtime Component is compiled into a DLL, that is used to generate an IDL file which is then used in the creation of windows meta

Why CurrentApp::AppId take so long in Windows Phone 10?

雨燕双飞 提交于 2019-12-11 09:43:28
问题 I have a windows 8 universal project and have a function to get APP ID, The following function works well in Windows Phone 8.1 Platform::Guid appId = Windows::ApplicationModel::Store::CurrentApp::AppId; however, it spent around 40s in Windows Phone 10. From MSDN, only the Metadata is different, May I know is it caused by the metadata? And how to solve it? 回答1: To instead of using AppID , you might use the following code, Windows::ApplicationModel::Package^ package = Windows::ApplicationModel:

xaml Invalid Markup but still compiles/runs

非 Y 不嫁゛ 提交于 2019-12-11 09:19:15
问题 I am trying to add a custom converter (Boolean to Visibility). The code for the converter is just fine. It seems to map ok. However, when I try and add it as a resource for a User Control I get an Invalid Markup which says "BooleanToVisibilityConverter was not found. Verify you are not missing an assembly and that all referenced assemblies have been built". Even with this Invalid Markup showing the project compiles and runs with no errors or crashes. I am using Visual Studio 2013 on Windows 8