Declaring Form in Embarcadero C++ builder: - c++

Getting started with Embarcadero XE-5, the object model has me confused.
My project involves the Canvas right from the start, so my hello world
is to draw a line or two. Set up an SDI project, and added a fastcall
directly out of the C++ builder help, but can't get it to compile. Form1
is used in all the examples, but my efforts to instantiate it aren't
working. I've tried to declare Form1 in various ways, no success.
Can anyone point out my error, please?
// ----------------------------------------------------
#include <vcl.h>
#pragma hdrstop>
#include <tchar.h>
//-----------------------------------------------------
USEFORM("SDIMAIN.CPP", SDIAppForm);
USEFORM("ABOUT.CPP", AboutBox);
//-----------------------------------------------------
int WINAPI _tWinMain(HINSTANCE, HINSTANCE, LPTSTR, int)
{
Application->Initialize();
Application->CreateForm(__classid(TSDIAppForm), &SDIAppForm);
// ** Following line gives error: Form1 undefined. **
Application->CreateForm(__classid(TCanvas), &Form1);
Application->CreateForm(__classid(TAboutBox), &AboutBox);
Application->Run();
return 0;
}
//------------------------------------------------------
/* SDIMAIN - copied from the help screens */
void __fastcall TForm1::FormPaint(TObject *Sender)
{
Canvas->MoveTo(0,0);
Canvas->LineTo(ClientWidth, ClientHeight);
Canvas->MoveTo(0, ClientHeight);
Canvas->LineTo(ClientWidth, 0);
}

You don't use TApplication::CreateForm() to create TCanvas objects. Change __classid(TCanvas) to __classid(TForm1) instead:
// ----------------------------------------------------
#include <vcl.h>
#pragma hdrstop>
#include <tchar.h>
//-----------------------------------------------------
USEFORM("SDIMAIN.CPP", SDIAppForm);
USEFORM("Unit1.cpp", Form1);
USEFORM("ABOUT.CPP", AboutBox);
//-----------------------------------------------------
int WINAPI _tWinMain(HINSTANCE, HINSTANCE, LPTSTR, int)
{
Application->Initialize();
Application->CreateForm(__classid(TSDIAppForm), &SDIAppForm);
Application->CreateForm(__classid(TForm1), &Form1);
Application->CreateForm(__classid(TAboutBox), &AboutBox);
Application->Run();
return 0;
}
//------------------------------------------------------
Of course, this requires you to have a TForm1 class to begin with:
File > New > VCL Form

Related

Segmentation fault trying to execute a MinGW compiled C++ winapi test program

I have trouble executing some winapi code. I don't know if the reason is because I missed something in the compilation process or if the test program is wrong; but when I execute the program the Bitmap defintion line is giving a segfault.
here is the test program
#include <windows.h>
#include <gdiplus.h>
int WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
Gdiplus::PixelFormat* pf = new Gdiplus::PixelFormat();
Gdiplus::Bitmap* bitmap = new Gdiplus::Bitmap(100, 100, *pf);
return 0;
}
and here is the compilation instruction :
> mingw32-g++ main.cpp -lgdiplus -o main.exe
When I execute, I have this throw :
Program received signal SIGSEGV, Segmentation fault.
0x00403da3 in Gdiplus::Image::Image (this=0x0, image=0x0, status=Gdiplus::Ok) at c:/mingw/include/gdiplus/gdiplusheaders.h:142
142 nativeImage(image), lastStatus(status) {}
I did some winapi tutorial and created a window before so I think my MinGW installation has nothing wrong.
What could be the problem ?
The error is because GDI+ is not being initialized. You could simply call Gdiplus::GdiplusStartup at the top of main and Gdiplus::GdiplusShutdown at the end, but by wrapping it in a class we get to take advantage of RAII and automate the initialization and release with less muss and fuss should anything go wrong.
#include <stdexcept>
#include <windows.h>
#include <gdiplus.h>
#include <stdio.h>
// GDI+ wrapper class
class GdiplusRAII
{
ULONG_PTR gdiplusToken;
public:
GdiplusRAII()
{
Gdiplus::GdiplusStartupInput input;
Gdiplus::Status status = Gdiplus::GdiplusStartup(&gdiplusToken, &input, NULL);
if (status != Gdiplus::Ok)
{
throw std::runtime_error("Could not initialize GDI+");
}
}
~GdiplusRAII()
{
Gdiplus::GdiplusShutdown(gdiplusToken);
}
};
int WinMain(HINSTANCE ,
HINSTANCE ,
LPSTR ,
int ) // not using the parameters so I left them out.
{
GdiplusRAII raii; // initialize GDI+
// no need to new a PixelFormat. It is just an int associated with a
// collection of defined constants. I'm going to pick one that sounds
// reasonable to minimize the potential for a nasty surprise and use it
// directly in the Gdiplus::Bitmap constructor call.
// Probably no need to new the bitmap. In fact you'll find that most of
// the time it is better to not new at all.
Gdiplus::Bitmap bitmap(100, 100, PixelFormat32bppARGB);
return 0;
// GDI+ will be shutdown when raii goes out of scope and its destructor runs.
}
Documentation on PixelFormat.

Where to initialize child controls on TCustomControl

I'm trying to create a simple custom control using Borland C++ Builder 6. In this case, I am trying to create a TPageControl with a single TTabSheet on it. I am having trouble figuring out the proper place to initialize these child controls. At the moment I am initializing everything in the constructor. Everything compiles fine, but when I attempt to place the control onto a form, the Borland IDE gives me an error "Control '' has no parent window" or something very similar. I've found out that the line that is causing this specifically is the setting of the TTabSheet's PageControl property.
The code for my control is below:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "TestControl.h"
#pragma package(smart_init)
//---------------------------------------------------------------------------
// ValidCtrCheck is used to assure that the components created do not have
// any pure virtual functions.
//
static inline void ValidCtrCheck(TTestControl *)
{
new TTestControl(NULL);
}
//---------------------------------------------------------------------------
__fastcall TTestControl::TTestControl(TComponent* Owner)
: TCustomControl(Owner)
{
pageControl = new TPageControl(this);
pageControl->Parent = this;
tabSheet = new TTabSheet(pageControl);
tabSheet->Parent = pageControl;
tabSheet->Caption = "Page 1";
tabSheet->PageControl = pageControl;
}
//---------------------------------------------------------------------------
__fastcall TTestControl::~TTestControl()
{
pageControl->Free();
}
//---------------------------------------------------------------------------
namespace Testcontrol
{
void __fastcall PACKAGE Register()
{
TComponentClass classes[1] = {__classid(TTestControl)};
RegisterComponents("Test", classes, 0);
}
}
//---------------------------------------------------------------------------
Any assistance would be much appreciated--I'm finding that due to the age of this particular technology I'm not having much luck finding resources on this.

Issue debugging an MFC applicaiton, building but not running

I build the code successfully but it does not debug and comes up with this warning in a wizard miscellaneous code.
"Warning: Destroying non-NULL m_pMainWnd\n"
and
"Warning: Temp map lock count non-zero (%ld).\n",
The aim of this is to create a dialog box that allows a user to input car specifications and a track so a lap time can be calculated.
Source File of Main Dialogue box:
#define _WIN32_WINNT 0x0601
// LapTimeSim.cpp : implementation file
//
#include <iostream>
#include "stdafx.h"
#include "LapTimeSim.h"
#include "afxdialogex.h"
#include "SecondDlg.h"
#include "resource.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
using namespace std;
// LapTimeSim dialog
IMPLEMENT_DYNAMIC(LapTimeSim, CDialogEx);
LapTimeSim::LapTimeSim(CWnd* pParent /*=NULL*/)
: CDialogEx(IDD_DIALOG1, pParent)
{
}
LapTimeSim::~LapTimeSim()
{
}
void LapTimeSim::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(LapTimeSim, CDialogEx)
ON_BN_CLICKED(IDC_CAR, &LapTimeSim::OnBnClickedCar)
ON_BN_CLICKED(IDGO, &LapTimeSim::OnBnClickedGo)
ON_BN_CLICKED(IDC_TRACK, &LapTimeSim::OnBnClickedTrack)
END_MESSAGE_MAP()
// LapTimeSim message handlers
void LapTimeSim::OnBnClickedCar()
{
// TODO: Add your control notification handler code here
CSecondDlg Dlg;
Dlg.DoModal();
}
void LapTimeSim::OnBnClickedGo()
{
// TODO: Add your control notification handler code here
}
void LapTimeSim::OnBnClickedTrack()
{
// TODO: Add your control notification handler code here
}
A Large Header; Header file of main dialog box
==============
#pragma once
// LapTimeSim dialog
class LapTimeSim : public CDialogEx
{
DECLARE_DYNAMIC(LapTimeSim)
public:
LapTimeSim(CWnd* pParent = NULL); // standard constructor
virtual ~LapTimeSim();
// Dialog Data
#ifdef AFX_DESIGN_TIME
enum { IDD = IDD_DIALOG1 };
#endif
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
DECLARE_MESSAGE_MAP()
public:
afx_msg void OnBnClickedCar();
afx_msg void OnBnClickedGo();
afx_msg void OnBnClickedTrack();
};
Source File of Main Dialogue box:
// SecondDlg.cpp : implementation file
//
#define _WIN32_WINNT 0x0601
#include <iostream>
#include "stdafx.h"
#include "LapTimeSim.h"
#include "afxdialogex.h"
#include "SecondDlg.h"
#include "resource.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CSecondDlg dialog
IMPLEMENT_DYNAMIC(CSecondDlg, CDialog)
CSecondDlg::CSecondDlg(CWnd* pParent /*=NULL*/)
: CDialog(IDD_DIALOG2, pParent)
{
}
CSecondDlg::~CSecondDlg()
{
}
void CSecondDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CSecondDlg, CDialog)
END_MESSAGE_MAP()
// CSecondDlg message handlers
A Large Header; Header file of second dialog box
==============
#pragma once
// CSecondDlg dialog
class CSecondDlg : public CDialog
{
DECLARE_DYNAMIC(CSecondDlg)
public:
CSecondDlg(CWnd* pParent = NULL); // standard constructor
virtual ~CSecondDlg();
// Dialog Data
#ifdef AFX_DESIGN_TIME
enum { IDD = IDD_DIALOG2 };
#endif
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
DECLARE_MESSAGE_MAP()
};
Source File : appmodule.cpp writeen by the wizard
// This is a part of the Microsoft Foundation Classes C++ library.
// Copyright (C) Microsoft Corporation
// All rights reserved.
//
// This source code is only intended as a supplement to the
// Microsoft Foundation Classes Reference and related
// electronic documentation provided with the library.
// See these sources for detailed information regarding the
// Microsoft Foundation Classes product.
#include "stdafx.h"
#include "sal.h"
/////////////////////////////////////////////////////////////////////////////
// export WinMain to force linkage to this module
extern int AFXAPI AfxWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
_In_ LPTSTR lpCmdLine, int nCmdShow);
extern "C" int WINAPI
_tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
_In_ LPTSTR lpCmdLine, int nCmdShow)
#pragma warning(suppress: 4985)
{
// call shared/exported WinMain
return AfxWinMain(hInstance, hPrevInstance, lpCmdLine, nCmdShow);
}
/////////////////////////////////////////////////////////////////////////////
// initialize app state such that it points to this module's core state
BOOL AFXAPI AfxInitialize(BOOL bDLL, DWORD dwVersion)
{
AFX_MODULE_STATE* pModuleState = AfxGetModuleState();
pModuleState->m_bDLL = (BYTE)bDLL;
ASSERT(dwVersion <= _MFC_VER);
UNUSED(dwVersion); // not used in release build
#ifdef _AFXDLL
pModuleState->m_dwVersion = dwVersion;
#endif
#ifdef _MBCS
// set correct multi-byte code-page for Win32 apps
if (!bDLL)
_setmbcp(_MB_CP_ANSI);
#endif //_MBCS
return TRUE;
}
// force initialization early
#pragma warning(disable: 4074)
#pragma init_seg(lib)
#ifndef _AFXDLL
void AFX_CDECL _AfxTermAppState()
{
// terminate local data and critical sections
AfxTermLocalData(NULL, TRUE);
AfxCriticalTerm();
// release the reference to thread local storage data
AfxTlsRelease();
}
#endif
#ifndef _AFXDLL
char _afxInitAppState = (char)(AfxInitialize(FALSE, _MFC_VER), atexit(&_AfxTermAppState));
#else
char _afxInitAppState = (char)(AfxInitialize(FALSE, _MFC_VER));
#endif
/////////////////////////////////////////////////////////////////////////////
Source File - Wizard code coming up with warning:
// This is a part of the Microsoft Foundation Classes C++ library.
// Copyright (C) Microsoft Corporation
// All rights reserved.
//
// This source code is only intended as a supplement to the
// Microsoft Foundation Classes Reference and related
// electronic documentation provided with the library.
// See these sources for detailed information regarding the
// Microsoft Foundation Classes product.
#include "stdafx.h"
#include "sal.h"
/////////////////////////////////////////////////////////////////////////////
// Standard WinMain implementation
// Can be replaced as long as 'AfxWinInit' is called first
int AFXAPI AfxWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
_In_ LPTSTR lpCmdLine, int nCmdShow)
{
ASSERT(hPrevInstance == NULL);
int nReturnCode = -1;
CWinThread* pThread = AfxGetThread();
CWinApp* pApp = AfxGetApp();
// AFX internal initialization
if (!AfxWinInit(hInstance, hPrevInstance, lpCmdLine, nCmdShow))
goto InitFailure;
// App global initializations (rare)
if (pApp != NULL && !pApp->InitApplication())
goto InitFailure;
// Perform specific initializations
if (!pThread->InitInstance())
{
if (pThread->m_pMainWnd != NULL)
{
TRACE(traceAppMsg, 0, "Warning: Destroying non-NULL m_pMainWnd\n");
pThread->m_pMainWnd->DestroyWindow();
}
nReturnCode = pThread->ExitInstance();
goto InitFailure;
}
nReturnCode = pThread->Run();
InitFailure:
#ifdef _DEBUG
// Check for missing AfxLockTempMap calls
if (AfxGetModuleThreadState()->m_nTempMapLock != 0)
{
TRACE(traceAppMsg, 0, "Warning: Temp map lock count non-zero (%ld).\n",
AfxGetModuleThreadState()->m_nTempMapLock);
}
AfxLockTempMaps();
AfxUnlockTempMaps(-1);
#endif
AfxWinTerm();
return nReturnCode;
}
/////////////////////////////////////////////////////////////////////////////
(See my answer to this SO: Cannot create main window?, it looks very similar to your issue)
If you have created this project with wizard then you should also have source files for CWinApp implementation. If its some other kind of wizard generated application then you still should somewhere have an InitInstance like method. with following lines of code:
LapTimeSim dlg;
m_pMainWnd = &dlg;
INT_PTR nResponse = dlg.DoModal();
(I assume here that LapTimeSim is your main entry dialog). If you remove above lines, you will get the exact same trace and behaviour as in your description (I checked this locally).
So you should check if you have by mistake removed them, or recreate project from MFC template wizard.

Expected "}" at end of input when including d3dx11.h

I know what the error "Expected '}' before end of input" means, the issue I'm having is that the error appears to be in one of the files included with d3dx11.h, as when I don't include this file and comment out the DirectX calls in my code I don't get the error.
When I search for this error, I get results, but all results I find are errors in the users code (additional or missing braces), the error for me seems to be occurring inside the included files so after 6 hours I haven't found any help.
I'm relatively new to C++, and at this time I'm just trying to experiment and understand how things work, so I don't really care too much about naming conventions or what I may be putting in the header files that should go into the corresponding cpp file according to standard practice. My code may not be the cleanest and may have some inefficiencies, feel free to additionally point out places I could improve upon, but for this question I'm mostly asking what's causing the error:
C:/Program Files/CodeLite/.../main.cpp:33:1: error: expected '}' at end of input
As I said earlier, this error doesn't occur until I include DirectX.
main.cpp
#ifndef INCL_WINDOWS_H
#include <windows.h>
#include <windowsx.h>
#define INCL_WINDOWS_H
#endif
#include <iostream>
#ifdef _MSC_VER
# pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup")
#endif
#define OS_WINDOWS
#include "WindowUtils.h"
#include "RenderUtils_Creation.h"
using namespace std;
int main()
{
Window window("Test Window",100,100,900,900);
while(window.getAlive())
{
window.process();
}
return window.getExitCode();
} // <-- Line 33, error occurs here, only when DX is included in RenderUtils_Creation.h
WindowUtils.h
#ifndef INCL_WINDOW_UTILS
#define INCL_WINDOW_UTILS
enum DisplayMode // Currently Unused (TBI)
{
WINDOWED,
FULLSCREEN,
WINDOWED_NOBORDER
};
// DEFINE TEMPLATE FOR IMPLEMENTATION FEATURES
class ImplementationFeatures;
// DEFINE PLATFORM SPECIFIC IMPLEMENTATION OF IMPLEMENTATION FEATURES
#ifdef OS_WINDOWS
class ImplementationFeatures
{
public:
static LRESULT CALLBACK WinProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
switch(msg)
{
case WM_CLOSE:
DestroyWindow(hwnd);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, msg, wParam, lParam);
}
return 0;
}
HINSTANCE procInst;
WNDCLASSEX wndStruct;
HWND windowHandle;
MSG msg;
};
#endif
// DEFINE TEMPLATE FOR WINDOW
class Window
{
public:
ImplementationFeatures features;
Window(char*, int, int, int, int);
bool getAlive();
void setDisplayMode(DisplayMode);
void process();
void update();
int getExitCode();
};
// DEFINE PLATFORM-SPECIFIC IMPLEMENTATIONS OF WINDOW
#ifdef OS_WINDOWS
Window::Window(char* title, int xPos, int yPos, int width, int height)
{
ImplementationFeatures feature;
LPCTSTR strTitle = title;
feature.procInst = GetModuleHandle(NULL);
feature.wndStruct.cbSize = sizeof(WNDCLASSEX);
feature.wndStruct.style = CS_HREDRAW | CS_VREDRAW;
feature.wndStruct.lpfnWndProc = feature.WinProc;
feature.wndStruct.cbClsExtra = 0;
feature.wndStruct.cbWndExtra = 0;
feature.wndStruct.hInstance = GetModuleHandle(NULL);
feature.wndStruct.hIcon = NULL;
feature.wndStruct.hCursor = NULL;
feature.wndStruct.hbrBackground = GetSysColorBrush(COLOR_BTNFACE);
feature.wndStruct.lpszMenuName = NULL;
feature.wndStruct.lpszClassName = "WindowClassName";
feature.wndStruct.hIconSm = LoadIcon(NULL,IDI_APPLICATION);
RegisterClassEx(&(feature.wndStruct));
feature.windowHandle = CreateWindowEx(WS_EX_CONTROLPARENT, "WindowClassName", strTitle, WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_VISIBLE, xPos, yPos, width, height, NULL, NULL, GetModuleHandle(NULL), NULL);
ShowWindow(feature.windowHandle, 1);
UpdateWindow(feature.windowHandle);
features = feature;
}
bool Window::getAlive()
{
return GetMessage(&features.msg, NULL, 0, 0) > 0;
}
void Window::process()
{
TranslateMessage(&(features.msg));
DispatchMessage(&(features.msg));
}
void Window::update()
{
UpdateWindow(features.windowHandle);
}
void Window::setDisplayMode(DisplayMode mode)
{
switch(mode)
{
case WINDOWED:
ShowWindow(features.windowHandle,1);
break;
case WINDOWED_NOBORDER:
ShowWindow(features.windowHandle,1);
break;
case FULLSCREEN:
ShowWindow(features.windowHandle,1);
break;
}
}
int Window::getExitCode()
{
return features.msg.wParam;
}
#endif // End OS_WINDOWS
#endif // End INCL_WINDOW_UTILS
RenderUtils_Creation.h
#ifndef INCL_RENDER_UTILS_CRTN
#define INCL_RENDER_UTILS_CRTN
//This won't be included on the main.cpp because of the header guard
//Bug is included in case of use on other files
#include "WindowUtils.h"
#ifdef OS_WINDOWS
// Use Direct3D
//#define SKIP_DIRX // To quickly go back and forth testing if error is DX related
// When commented out d3d11.h and d3dx11.h are included with their libs
// When not commented none are included
// The error only occurs when this is commented.
#ifndef SKIP_DIRX
// Import Headers
#include <d3d11.h>
#include <d3dx11.h>
// include the Direct3D Library files
#pragma comment (lib, "d3d11.lib")
#pragma comment (lib, "d3dx11.lib")
#endif
#endif // End of OS_WINDOWS
#endif // End of INCL_RENDER_UTILS_CRTN
main.cpp is the only .cpp file and has no header. I'm attempting to create a cross-platform library for interfacing with different OS and graphics APIs. By defining OS_WINDOWS DirectX will be the API compiled against, for Mac I would then add code to interface to Metal, etc. I'm use to this abstraction, I've done similar with Java in the past, but this error is confusing me.
Edit - Additional info that may be important:
Compiler: MinGW GCC Compiler (TDM-GCC-32)
IDE: CodeLite
Version: 8.2.0
Does library search paths include DirectX SDK 'Lib' folder: Yes
Does include search paths include DirectX SDK 'includes' folder: Yes
Microsoft DirectX SDK (June 2010)
Standard installation
From further research it would appear that at least part of my problem could be because of Microsoft developing their own standards for their C++ compiler. The VisualC++ compiler adds in custom operators, intrinsic functions, macros and alternate versions of other standard functions that don't exist in other compilers because they are not C++ standards, they are custom Microsoft-specific additions. The DirectX header files apparently are reliant on the presence of these features and thus Microsoft essentially is forcing anyone who uses DirectX to use their compiler, at least for certain parts of their program.

WinRT - how to display Metro dialog box on a desktop app?

I believe this could be possible somehow because Windows PE loader already does it:
I tried directly creating an Windows.UI.Popups.MessageDialog class and instancing 'ShowAsync' but it fails with 'Element not found. (Exception from HRESULT: 0x80070490)'. I read this but I'm failing to create an Windows.UI.Core.CoreDispatcher like this:
#include <Roapi.h>
#include <Winstring.h>
#include <Windows.h>
#include <windows.ui.popups.h>
#include <windows.ui.core.h>
#include <windows.foundation.h>
#include <Unknwn.h>
inline void CheckHresult(HRESULT hr)
{
if (FAILED(hr))
{
DebugBreak();
}
}
struct WinRTString
{
WinRTString() {}
WinRTString(const WinRTString &) = delete;
template<size_t tSizeCharArr>
WinRTString(const wchar_t(&chArr)[tSizeCharArr])
{
*this = chArr;
}
template<size_t tSizeCharArr>
WinRTString & operator= (const wchar_t(&chArr)[tSizeCharArr])
{
this->~WinRTString();
CheckHresult(WindowsCreateString(chArr, sizeof(chArr) / sizeof(chArr[0]) - 1, &hStr));
return *this;
}
operator HSTRING() { return hStr; }
~WinRTString()
{
if (hStr)
WindowsDeleteString(hStr);
hStr = nullptr;
}
HSTRING hStr = nullptr;
};
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine, int nCmdShow)
{
ABI::Windows::UI::Core::ICoreDispatcher *pUIDispatcher;
CheckHresult(RoActivateInstance(WinRTString(L"Windows.UI.Core.CoreDispatcher"), (IInspectable**) &pUIDispatcher)); //fails
}
With 'RoActivateInstance' HINSTANCE of '0x80040154 : Class not registered'.
Any ideas how can I show equvilent message. I know that on msdn documentation it says that this API is only supported by Metro applications but then how is this message displayed on Desktop when 'This app can't run on your PC'?
Desktop apps Windows Runtime classes lists the classes publicly available. The message box example cited must be using WRL to consume WinRT API as traditional COM with implementation details for internal use only.