Skip to content

Instantly share code, notes, and snippets.

View ElemarJR's full-sized avatar
🏠
Working from home

Elemar Rodrigues Severo Junior ElemarJR

🏠
Working from home
View GitHub Profile
namespace WinRTComponentCpp
{
__declspec ( no_refcount ) inline long __stdcall
:: WinRTComponentCpp :: __CalculatorActivationFactory ::
__abi_Platform_Details_IActivationFactory____abi_ActivateInstance ( class Platform::Object ^* __abi_returnValue )
{
long __hr = 0 ;
* __abi_returnValue = nullptr ;
try
document.getElementById('CppResult').textContent =
WinRTComponentCpp.Calculator().add(5, 7);
protected override void OnNavigatedTo(NavigationEventArgs e)
{
var calculator = new WinRTComponentCpp.Calculator();
this.AddResultTextBox.Text =
calculator.Add(4, 45).ToString();
}
void MainPage::OnNavigatedTo(NavigationEventArgs^ e)
{
(void) e; // Unused parameter
WinRTComponentCS::Calculator^ calculator = ref new WinRTComponentCS::Calculator();
this->AddResultTextBox->Text = calculator->Add(7,3).ToString();
}
#include "pch.h"
#include "Calculator.h"
using namespace WinRTComponentCpp;
Calculator::Calculator()
{
}
int Calculator::Add(int a, int b)
#pragma once
namespace WinRTComponentCpp
{
public ref class Calculator sealed
{
public:
Calculator();
int Add(int a, int b);
};
//
// Generic test for success on any status value (non-negative numbers
// indicate success).
//
#define SUCCEEDED(hr) (((HRESULT)(hr)) >= 0)
//
// and the inverse
//
#include <windows.h>
#include <shobjidl.h>
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, PWSTR pCmdLine, int nCmdShow)
{
HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED |
COINIT_DISABLE_OLE1DDE);
if (SUCCEEDED(hr))
{
IFileOpenDialog *pFileOpen;
#include <iostream>
#include <functional>
using namespace std;
int main() {
function<int(int, int)> add =
[] (int a, int b) { return a + b; };
function<int(void)> magic =
[] { return 42; };
#include <iostream>
using namespace std;
int main() {
int var = 5;
cout << "(before) var = " << var << endl;
auto byvalue = [=]