This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| document.getElementById('CppResult').textContent = | |
| WinRTComponentCpp.Calculator().add(5, 7); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| protected override void OnNavigatedTo(NavigationEventArgs e) | |
| { | |
| var calculator = new WinRTComponentCpp.Calculator(); | |
| this.AddResultTextBox.Text = | |
| calculator.Add(4, 45).ToString(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void MainPage::OnNavigatedTo(NavigationEventArgs^ e) | |
| { | |
| (void) e; // Unused parameter | |
| WinRTComponentCS::Calculator^ calculator = ref new WinRTComponentCS::Calculator(); | |
| this->AddResultTextBox->Text = calculator->Add(7,3).ToString(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "pch.h" | |
| #include "Calculator.h" | |
| using namespace WinRTComponentCpp; | |
| Calculator::Calculator() | |
| { | |
| } | |
| int Calculator::Add(int a, int b) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #pragma once | |
| namespace WinRTComponentCpp | |
| { | |
| public ref class Calculator sealed | |
| { | |
| public: | |
| Calculator(); | |
| int Add(int a, int b); | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // Generic test for success on any status value (non-negative numbers | |
| // indicate success). | |
| // | |
| #define SUCCEEDED(hr) (((HRESULT)(hr)) >= 0) | |
| // | |
| // and the inverse | |
| // |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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; }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| using namespace std; | |
| int main() { | |
| int var = 5; | |
| cout << "(before) var = " << var << endl; | |
| auto byvalue = [=] |