Friday, June 30, 2017

windowsapps/Creating a Form Shown Tacky

Download

Before begin, I would like to apologize profusely. Because the English language I use is the translation from the translator. If there is something wrong from results of translation, or even offensive. Once again, I would like to say apologize profusely, deeply from my bottom heart.

Introduction

Have you ever thought, that you can make your form look more tacky. For example, look at the picture below:

To can do like above. You only need the GDI + and its VisualStyles.

Building the Sample

VisualStyles to fame in the era of Visual Studio 2005. You can find it on System.Windows.Forms.VisualStyles. VisualStyles usability is taking a picture control on windows theme that is being used at that time. For more information, you can click on this link, http://msdn.microsoft.com/en-us/library/system.windows.forms.visualstyles.aspx.

So, if you have lots of windows theme, then you can try VisualStyles you're using. For example, when I replace the existing windows theme on my pc to macintosh, it will look like this:

And when I change my windows theme to android, then it will look like this:

Take a look at, funny is'nt it.

Description

At the sample I've included time this. I only use form theme alone. Sample so that I include quite simple. What you should know, I allow you here to change the size of each border, such as when you run, normally like this:

After that I drag my mouse down the caption, will be a red line appears like this:

On the red line, drag & drop your mouse, the size of the caption will be changed. For example when I drag my mouse until the maximum, later like this:

Take a look at, turned into a large caption from the normal. You can also move border the other, the left border, right border and bottom border. For example, I drag to another border until maximum, will be like this:

Take a look at, funny is'nt it. And as always, I hope you can make something better, more efficient of course.

windowsapps/Creating a game leaderboard

Download

This sample shows how Windows Azure Mobile Services enables you to add, update, and view a game leaderboard for your Windows Store app.

This Windows Store app demonstrates a simple trivia quiz app. It asks for your user name and shows a random set of predetermined trivia questions. After you answer all of the questions, the app updates your result in a Mobile Services table and then displays a leaderboard with your relative position among all of the quiz app players.

To obtain an evaluation copy of Windows 8.1, go to Windows 8.1.

To obtain an evaluation copy of Microsoft Visual Studio 2013, go to Visual Studio 2013.

Note  For Windows 8 app samples, download the Windows 8 app samples pack. The samples in the Windows 8 app samples pack will build and run only on Microsoft Visual Studio 2012.

Related topics

free Windows Azure trial
Windows Azure management portal
Windows app samples

Operating system requirements

Client
Windows 8.1
Server
Windows Server 2012 R2

Build the sample

  1. If you do not have a Windows Azure subscription, sign up for a free Windows Azure trial.
  2. Install the Windows Azure command line tools.
  3. Open a command prompt to download the required credentials to communicate with Windows Azure as follows. This is a one-time setup for running all subsequent commands to manage Mobile Services:
    1. Download Windows Azure management credentials with this command: azure account download.                   This will display a web page for you to sign in to the Windows Azure management portal. After you sign in, Windows Azure will prompt you to download a publish settings file for your Windows Azure subscription. Save this file to your local computer.
    2. Import the publish settings file from this location with this command: azure account import [SavedLocation]. This will configure your command prompt to manage all of your Windows Azure services from the command line.
  4. Create a Windows Azure Mobile Service with this command: azure mobile create [AzureMobileServiceName] [sqlAdminUsername] [sqlAdminPassword]
  5. Create a Leaderboard table and a Results table to store to store the positions of all players and the results of each round, with these commands:
    • azure mobile table create [AzureMobileServiceName] Leaderboard
    • azure mobile table create [AzureMobileServiceName] Result
    • azure mobile table create [AzureMobileServiceName] Feedback
  6. Upload a script to your Windows Azure Mobile Service that which will update the score and the position of the player in the leaderboard as the results are entered. From a command line, change to the sample's Scripts directory, and then run this command: azure mobile script upload [AzureMobileServiceName] table/result.insert.js.
  7. Get the ApplicationUrl and ApplicationKey for your Windows Azure Mobile Service with this command: azure mobile show [AzureMobileServiceName]
  8. Install the Windows Azure Mobile Services NuGet package.
  9. Open the App.xaml.cs file and replace "mobile-service-url" and "mobile-service-key" with the ApplicationUrl and ApplicationKey. Your Windows Store app is now configured to communicate with your created Windows Azure Mobile Service.
  10. Click Build > Build Solution.

Run the sample

  1. To debug the app and then run it in Microsoft Visual Studio, press F5 or use Debug > Start Debugging. To run the app without debugging, press Ctrl+F5 or use Debug > Start Without Debugging.
  2. After the app starts, answer the three questions in the app. After you finish the game, your results are then sent to be inserted into your Windows Azure Mobile Service Results table. As the row is being inserted, the uploaded script runs to update the Leaderboard table with the new total score and positions. Finally, the app will update to display the leaderboard data from the Leaderboard table.
  3. You can also go to the Windows Azure management portal, sign in, and view your Windows Azure Mobile Service and the saved data.

windowsapps/Creating an app that reads

Download

Introduction

This application is a sample for creating a Windows Presentation Foundation application that reads out our text messages, that we pass to it. The source code contains the functions and a complete application example that can be used to get audio speech in either live or offline format; in a Waveform format file. 

Building the Sample

You can build the sample using Visual Studio 2013 and .NET framework 4.5. 

Description

The above program explains how you can use System.Speech namespace to generate the speech results for your application, that can in turn provide you with a functionality to store the audio sample for sharing across network or to listen to your favorite paragraph. 

I have personally written this application to read out my boring long books. You would be able to get the same results from this application. The application state management requires three objects. 

  1. A boolean flag to tell whether application is speaking or not. 
  2. SpeechSynthesizer object to speak the text
  3. Handle to the Prompt object to stop the processes to speak. 

Remember Windows Presentation foundation is most likely to get frozen if you take too much to execute the function. That is why the source code contains the asynchronous approach, and also contains the functions to cancel them. 

C#
Edit|Remove
using System;   using System.Collections.Generic;   using System.Linq;   using System.Text;   using System.Speech;   using System.Speech.Synthesis;   using System.Threading.Tasks;   using System.Windows;   using System.Windows.Controls;   using System.Windows.Data;   using System.Windows.Documents;   using System.Windows.Input;   using System.Windows.Media;   using System.Windows.Media.Imaging;   using System.Windows.Navigation;   using System.Windows.Shapes;      namespace ApplicationToRead   {       /// <summary>       /// Interaction logic for MainWindow.xaml       /// </summary>       public partial class MainWindow : Window       {           private bool reading { get; set; }           private Prompt activePrompt { get; set; }           private SpeechSynthesizer reader { get; set; }              public MainWindow()           {               InitializeComponent();                  // Initialize the object               reader = new SpeechSynthesizer();                  // Binding the Combobox to the names               List<string> names = new List<string>();                  // For every voice installed               foreach (var voice in reader.GetInstalledVoices())               {                   // Only add Enabled voices, otherwise it is of no use                   if (voice.Enabled)                   {                       names.Add(voice.VoiceInfo.Name);                   }               }                  comboBox.DataContext = names; // Set the DataContext for binding purposes               comboBox.SelectedIndex = 0;                  // Dispose the object manually when the app is closing.               this.Closing += (sender, e) =>               {                   reader.Dispose();               };           }              private void read_Click(object sender, RoutedEventArgs e)           {               // Call the speak function               string message = text.Text;               string voiceName = "";                  // Voice must be selected               if (comboBox.SelectedIndex != -1)               {                   voiceName = (comboBox.SelectedItem).ToString();               }                  // Rate for the rendering               int rate = (int)slider.Value;               reader.Rate = rate;                  // Name must be full-qualified string               reader.SelectVoice(voiceName);                  // Reads one paragraph or passage at a time. Why read two?               if (!reading)               {                   reader.SetOutputToDefaultAudioDevice();               }               else               {                   MessageBox.Show("Previous reader is currently reading. Press 'Stop' to try stopping it and try again.");               }                  reading = true;               // Get the prompt that is being read out right now; for stopping it later.               activePrompt = reader.SpeakAsync(message);                  // Attach the handler               reader.SpeakCompleted += (sander, ev) =>               {                   reading = false;               };           }              private void stop_Click(object sender, RoutedEventArgs e)           {               // Stop the reading process               if (reading)               {                   reader.SpeakAsyncCancel(activePrompt);               }           }              private void save_Click(object sender, RoutedEventArgs e)           {               string message = text.Text;                  // Store the audio               if (!reading)               {                   reader.SetOutputToWaveFile("E:\\MyAudioFile.wav");                   reader.SpeakAsync(message);               }               else               {                   MessageBox.Show("Previous reader is currently reading. Press 'Stop' to try stopping it and try again.");               }           }       }   }   
 

 Download the project, build and test it to see how it works. :) 

Source Code Files

  • MainWindow.xaml -- XAML markup based file, contains the Controls for rendering the user-interface.
  • MainWindow.xaml.cs -- Back-end code in C# to handle events and perform other tasks on the framework. 

More Information

For more, please contact me or wait for more updates. 

windowsapps/Creating and Handling

Download

Introduction

Demonstrates how to implement an application that supports multiple windows that appear separately in the taskbar.

Building the Sample

  1. Press F5.

  2. Create multiple document windows using the New command on the File menu and verify that all the documents appear in the taskbar.

  3. Use the Task Manager to verify that only one process is running for the application.

Description

Many document-based applications support multiple windows, one per open document, which are displayed in the taskbar. The ALT+TAB key combination can be used to switch between the documents, but without the overhead incurred by loading each document in a separate process. This sample implements this behavior.

The startup object for the application is the Sub Main method inside a class named FormsManager. The Main method creates a new form instance by calling the NewForm method of the FormsManager class and then adds the new form to a list object. Once the first form is created, the code calls Application..::.Run to start the main application thread so that closing the first form does not shut down the process. Each document form exposes a New menu item. Clicking this menu item calls NewForm method again, which opens a new document form just as the Sub Main did as the application loaded.

Each form also provides Close and Exit menu items. Choosing Close starts the closing process. Each form has a Closing event which allows the form's code to check whether the document contents have been modified and, if so, to ask the user whether to save or not.

If you try to close a changed document by closing the form or exiting the application, you will see a dialog box asking you to save the form's contents. If you click Yes, the code calls the form's Save method and closes the form. If you click No, the form simply closes. If you click Cancel, the form does not close and a custom event is raised telling the application to stop shutting down. This application does not actually perform any file I/O to save the file.

Screenshot

Sample Code

Visual Basic
Edit|Remove
    Public Shared Sub NewForm()           Try               Forms.m_FormsCreated += 1               Dim frm As New MainForm()               frm.Text = "Document" & Forms.m_FormsCreated.ToString()               m_Forms.Add(frm, frm.GetHashCode.ToString())               ' Hook the new form's Closed event so that we know when               ' the they close the document window               AddHandler frm.Closed, AddressOf Forms.frmMain_Closed               ' Hook the custom SaveWhileClosingCancelled so that we know if the               ' use clicks the Cancel button when prompted to save a dirty document.               AddHandler frm.SaveWhileClosingCancelled, AddressOf Forms.frmMain_SaveWhileClosingCancelled               ' Hook the custom ExitApplicaiton so that we know if a user wants to                ' shut down the application by selecting the Exit menu item from a document form.               AddHandler frm.ExitApplication, AddressOf Forms.frmMain_ExitApplication                  ' Make the form visible               frm.Show()              Catch exp As Exception               MessageBox.Show(exp.Message, exp.Source, MessageBoxButtons.OK, MessageBoxIcon.Error)               If Forms.Count = 0 Then                   ' Rethrow the error to Main so                   ' we can shut down the process                   Throw exp               End If           End Try       End Sub

Source Code Files

More Information

For more information on the System.Windows.Forms Namespace: http://msdn.microsoft.com/en-us/library/system.windows.forms.aspx

windowsapps/Creating and Reading Event

Download

Introduction

Demonstrates how to create and delete event logs and how to read from and write to system event logs and custom event logs by using the EventLog component and the My.Application.Log object.

Building the Sample

Press F5

Not all operating systems support event logs. For more information, see EventLog.

Note:

For this sample to run successfully on some operating systems (Vista or later) , it is required to execute as Administrator. For debugging application ensure you are running Visual Studio as administrator. 

Description

The main form, Form1, contains three Button controls to read, write, and create or delete event logs. Each opens a new form that collects information specific to the operation.

The form WriteForm collects the text, ID, and type for an event-log entry and writes the entry to the Application event log using the WriteEntry method.

The form ReadForm fills a ListBox control with the names of the event logs on the computer. The list is obtained by calling the GetEventLogs method, and then displaying the value of the LogDisplayName property for each log. The last ten entries of the selected log are retrieved with Entries property and then displayed in a RichTextBox control.

The form CreateDeleteForm calls the CreateEventSource and Delete methods. The SourceExists method is used to verify that the event log and source do not already exist before creating them. The Exists method is used to verify that the event log exists before deleting it.

Screenshot

Sample Code

Visual Basic
Edit|Remove
    Private Sub cmdViewLogEntries_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnViewLogEntries.Click           Try               Const EntriesToDisplay As Integer = 10                  ' In this case the EventLog constructor is passed a string variable for the log name.               ' This is because the user of the application can choose which log they wish to view                ' from the listbox on the form.               Dim ev As New EventLog(logType, System.Environment.MachineName, _                   "Event Log Sample")                  rchEventLogOutput.Text = "Event log entries (maximum of 10), newest to oldest." & vbCrLf & vbCrLf                  Dim lastLogToShow As Integer = ev.Entries.Count - EntriesToDisplay               If lastLogToShow < 0 Then                   lastLogToShow = 0               End If                  ' Display the last 10 records in the chosen log.               For index As Integer = ev.Entries.Count - 1 To lastLogToShow Step -1                   Dim CurrentEntry As EventLogEntry = ev.Entries(index)                   rchEventLogOutput.Text &= "Event ID : " & CurrentEntry.InstanceId & vbCrLf                   rchEventLogOutput.Text &= "Entry Type : " & _                       CurrentEntry.EntryType.ToString() & vbCrLf                   rchEventLogOutput.Text &= "Message : " & _                       CurrentEntry.Message & vbCrLf & vbCrLf               Next           Catch secEx As System.Security.SecurityException               MsgBox("Security exception in reading the event log.", MsgBoxStyle.OKOnly, Me.Text & " Error")           Catch ex As Exception               MsgBox("Error accessing logs on the local machine.", MsgBoxStyle.OKOnly, Me.Text & " Error")           End Try       End Sub

Source Code Files

More Information

For more information on the EventLog class: http://msdn.microsoft.com/en-us/library/system.diagnostics.eventlog.aspx

windowsapps/Creating an Explorer like

Download

Introduction

Contains two forms that have split-pane windows, similar to Windows Explorer.

Building the Sample

Press F5

Description

This sample contains two forms with an Explorer-like interface: a directory scanner and an Explorer-style viewer. The files that support the two forms are contained in separate folders of the project.

  • DirectoryScanner   This is a simple application that scans all directories and sub-directories in either all logical drives or a user-selected starting directory. The list of drives is obtained by using the Directory..::.GetLogicalDrives method. A tree view control displays the directory structure reflecting the latest scan. Directories are colored green, yellow, or red based on their total size inclusive of all sub-directories and files. The Directory..::.GetFiles method is used to retrieve the list of files, and the FileInfo class is used to receive the file size.

  • ExplorerStyleViewer   This is a simpler version of the Windows Explorer application. The ExplorerStyleViewer displays more file information than DirectoryScanner by using the FileSystemInfo..::.Attributes property. It demonstrates how to associate icons with file types by using the TreeView..::.ImageList property. It enables the user to run an application associated with the file type (if an association exists) by double-clicking the file (just like in Windows Explorer). Applications are started by using the Process..::.Start method.

Screenshot

Sample Code

Visual Basic
Edit|Remove
    ''' <summary>       ''' This subroutine adds the strSubDirectory that the user selects on the TreeView        ''' to the ListView, and sets the text, size, and color.       ''' </summary>       Private Sub AddToListView(ByVal strSize As StringByVal strFolderName As String)           Dim listViewItem As New ListViewItem()           Dim listViewSubItem As ListViewItem.ListViewSubItem              listViewItem.Text = strSize           listViewItem.ForeColor = GetSizeColor(strSize)              listViewSubItem = New ListViewItem.ListViewSubItem()           listViewSubItem.Text = strFolderName              listViewItem.SubItems.Add(listViewSubItem)           ListView1.Items.Add(listViewItem)       End Sub

Source Code Files

More Information

For more information, see:

windowsapps/Creating Arrays and

Download

Introduction

Shows how you can use collection initializer syntax to create arrays and collections.

Building the Sample

Press F5

Description

This sample shows how you can use collection initializer syntax to create arrays and collections. The Customer and Order classes create a parent-child relationship to demonstrate nested collection initializer syntax. The GenericAdd module contains extension methods that enable you to use nested collection initializer syntax to add Customer and Order objects to collections.

The buttons and radio button options perform the following tasks:

  • Create an Array - Creates an array of integers, strings, or customers using collection initializer syntax to load an initial set of values. Once the array is loaded, the results are displayed in the results ListBox.
  • Create a Collection - Creates a collection of integers, strings, or customers using collection initializer syntax to load an initial set of values. Once the collection is loaded, the results are displayed in the results ListBox.
  • Create Customers with Orders - Creates a collection of customers and orders using nested collection initializer syntax to load an initial set of values. Once the collection is loaded, the customers are displayed in the results ListBox. You can click on a customer to see the related orders displayed in the details ListBox.
  • Create a Dictionary  - Creates a dictionary using nested collection initializer syntax to load an initial set of values. Once the collection is loaded, the keys are displayed in the results ListBox. You can click on a key to see the related value displayed in the details ListBox.
  • Query a Collection - Creates a collection of integers and a collection of customers and uses LINQ to join the two collections based on the Id of the customer. The results of the query are displayed in the results ListBox.

Screenshot

Sample Code

Visual Basic
Edit|Remove
' Create a collection of Customers with Orders using collection initializer syntax. The nested        ' collection initializer syntax relies on extension methods defined in GenericAdd.vb.       Private Sub CreateCustomersWithOrdersButton_Click() Handles CreateCustomersWithOrdersButton.Click           ResultsListBox.DataSource = _             New List(Of Customer) From _             {               {1"John Rodman"New OrderCollection From {{91, #6/12/2008#},                                                            {81, #6/11/2008#},                                                            {51, #5/1/2008#}}},               {2"Ariane Berthier"New OrderCollection From {{22, #1/18/2008#},                                                                {42, #3/8/2008#},                                                                {62, #3/18/2008#},                                                                {72, #5/14/2008#},                                                                {52, #4/4/2008#}}},                {3"Brian Perry"New OrderCollection From {{13, #1/15/2008#},                                                             {33, #3/8/2008#}}}             }       End Sub

Source Code Files

More Information

For more information on Collection Initalizers in VB: http://msdn.microsoft.com/en-us/library/dd293617.aspx

windowsapps/Creating a simple

Download

Have you ever wondered how the games and animations are made for apps or want to learn it to do by yourself? Then you are at the right place!
I will make a basic animation of an airplane firing missiles on a button click. This article will give you a head start.

  • Create a UWP application in Visual Studio

 

  

  • Now right click on the mainpage.xaml page and click "Design in blend".



 

  • Your app will open in blend for visual studio. Select pen tool and design a plane (Don't worry to make a perfect design). Just click where you want the corners to be and make a plane like this.





  • Now select rectangle tool and make two lines to represent the missiles.

 



  • Here comes the main part to add the animation. Create a new storyboard to record the animation of the missiles. Click on the '+' button in the right panel.



 

  • Now we will record an animation. At start your keyframe will be at 0 and your missiles should be in initial position. Move the keyframe to 1 sec and drag your missiles to the end side of the grid (canvas). To check the animation click on green play icon.

 

 

  • Now we need a button so we can make this animation work by clicking it

 



  • In this step we will assign the storyboard trigger event to our button. Its a simple drag and drop. In "assets", select "Behaviors" and then Drag "ControlStoryBoardAction" toward our button. Then select the storyboard "Firing" so it should run on the button click.

 



  • Now run the project and click the button to see the animation in action.

 


And yeah its working great! What you can do now is add some more animation or do some coding logic to make a game. Make some object to come randomly and use button to shoot them and record score for the player. After some score increase the objects as a level upgrade.

This is just a basic intro, now its up to you to explore further as much as you can.

windowsapps/Creating a ThreadPool work

Download

 

This sample demonstrates how to use a ThreadPool work item.

Specifically, this sample shows how to create the work item, manage cancellation, and handle work item completion. For a step-by-step walkthrough of this code, see the Quickstart: Submitting a work item to the thread pool.

--

For more information about the programming models, platforms, languages, and APIs demonstrated in this sample, please refer to the guidance, tutorials, and reference topics provided in the Windows 8.1 documentation available in the Windows Developer Center. This sample is provided as-is in order to indicate or demonstrate the functionality of the programming models and feature APIs for Windows 8.1 and/or Windows Server 2012 R2.

Related topics

Quickstart: Submitting a work item to the thread pool

Operating system requirements

Client

Windows 8

Server

Windows Server 2012

Build the sample

  1. Start Visual Studio 2012 (or higher) and select File > Open > Project/Solution.
  2. Go to the directory in which you unzipped the sample. Go to the directory named for the sample, and double-click the Visual Studio 2012 solution (.sln) file.
  3. Press F7 or use Build > Build Solution to build the sample.

Run the sample

To debug the app and then run it, press F5 or use Debug > Start Debugging. To run the app without debugging, press Ctrl+F5 or use Debug > Start Without Debugging

windowsapps/Creating a Windows Runtime

Download

Windows Runtime in-process component authoring with proxy\stub generation sample

Create proxies and stubs for a Windows Runtime in-process component that is consumed in C++, JS, and C#.

To obtain an evaluation copy of Windows 8.1, go to Windows 8.1.

To obtain an evaluation copy of Microsoft Visual Studio 2013, go to Visual Studio 2013.

Note  For Windows 8 app samples, download the Windows 8 app samples pack. The samples in the Windows 8 app samples pack will build and run only on Microsoft Visual Studio 2012.

Related topics

Windows app samples

Operating system requirements

Client
Windows 8.1
Server
Windows Server 2012 R2

Build the sample

  1. Start Visual Studio 2013 and select File > Open > Project/Solution.
  2. Go to the directory in which you unzipped the sample. Go to the directory named for the sample, and double-click the Visual Studio 2013 Solution (.sln) file.
  3. Press F7 or use Build > Build Solution to build the sample.

Run the sample

To debug the app and then run it, press F5 or use Debug > Start Debugging. To run the app without debugging, press Ctrl+F5 or use Debug > Start Without Debugging.

windowsapps/Creating a Windows Runtime

Download

This sample shows how to create a component in C++/CX that's used in C++/CX, JavaScript, and C# client code.

The OvenServer project contains a runtime class named Oven, which implements an IOven interface and an IAppliance interface and shows how to declare properties, methods, and events.

Also, the sample shows how to use the RoOriginateError function to report an error and an informative string to an attached debugger.

The ProxyStubsForWinRTComponents_server project produces a DLL named Microsoft.SDKSamples.Kitchen.dll. The ProxyStubsForWinRTComponents_server project is built into the Visual C++ component extensions (C++/CX) project by including the generated header file, Microsoft.SDKSamples.Kitchen.h. The ProxyStubsForWinRTComponents_server project and its corresponding proxy/stub project are referenced directly in the provided JavaScript and C# projects.

You can implement an in-process server by using C#. For more info, see Creating a Windows Runtime in-process component sample (C#).

To obtain an evaluation copy of Windows 8.1, go to Windows 8.1.

To obtain an evaluation copy of Microsoft Visual Studio 2013, go to Visual Studio 2013.

Note  For Windows 8 app samples, download the Windows 8 app samples pack. The samples in the Windows 8 app samples pack will build and run only on Microsoft Visual Studio 2012.

Related topics

Creating a Windows Runtime in-process component sample (C#)

Operating system requirements

Client
Windows 8.1
Server
Windows Server 2012 R2

Build the sample

  1. Start Visual Studio 2013 and select File > Open > Project/Solution.
  2. Go to the directory in which you unzipped the sample. Go to the directory named for the sample, and double-click the Visual Studio 2013 Solution (.sln) file.
  3. Press F7 or use Build > Build Solution to build the sample.

Run the sample

To debug the app and then run it, press F5 or use Debug > Start Debugging. To run the app without debugging, press Ctrl+F5 or use Debug > Start Without Debugging.

windowsapps/Creating a Windows Runtime

Download

This sample shows how to create an in-process DLL component in Microsoft Visual C++ that's used in C++/CX, JavaScript, and C# client code.

The OvenServer project contains a runtime class named Oven, which implements an IOven interface and an IAppliance interface and shows how to declare properties, methods, and events by using the Microsoft::WRL namespace. For more info, see Windows Runtime C++ reference.

The WRLInProcessWinRTComponent_server project produces a DLL named Microsoft.SDKSamples.Kitchen.dll. The WRLInProcessWinRTComponent_server project is built into the Visual C++ component extensions (C++/CX) project by including the generated header file, Microsoft.SDKSamples.Kitchen.h. The WRLInProcessWinRTComponent_server project and its corresponding proxy/stub project are referenced directly in the provided JavaScript and C# projects.

Also, the sample shows how to use the RoOriginateError function to report an error and an informative string to an attached debugger.

You can implement an out-of-process server by using the Microsoft::WRL namespace. For more info, see Creating a Windows Runtime EXE component sample (C++). Also, you can implement a component by using C++/CX. For more info, see Creating a Windows Runtime in-process component sample (C++/CX).

To obtain an evaluation copy of Windows 8.1, go to Windows 8.1.

To obtain an evaluation copy of Microsoft Visual Studio 2013, go to Visual Studio 2013.

Note  For Windows 8 app samples, download the Windows 8 app samples pack. The samples in the Windows 8 app samples pack will build and run only on Microsoft Visual Studio 2012.

Related topics

Creating a Windows Runtime EXE component sample (C++)
Creating a Windows Runtime in-process component sample (C++/CX)
Windows Runtime C++ reference
RoOriginateError

Related technologies

Windows Runtime C++ reference

Operating system requirements

Client
Windows 8.1
Server
Windows Server 2012 R2

Build the sample

  1. Start Visual Studio 2013 and select File > Open > Project/Solution.
  2. Go to the directory in which you unzipped the sample. Go to the directory named for the sample, and double-click the Visual Studio 2013 Solution (.sln) file.
  3. Press F7 or use Build > Build Solution to build the sample.

Run the sample

To debug the app and then run it, press F5 or use Debug > Start Debugging. To run the app without debugging, press Ctrl+F5 or use Debug > Start Without Debugging.

windowsapps/Creating a Windows Runtime

Download

This sample shows how to create an out-of-process EXE component in Microsoft Visual C++ that's used in C++/CX, JavaScript, and C# client code.

The OvenServer project contains a runtime class named Oven, which implements an IOven interface and an IAppliance interface and shows how to declare properties, methods, and events by using the Microsoft::WRL namespace. For more info, see Windows Runtime C++ reference.

The WRLOutOfProcessWinRTComponent_server project produces an EXE file named Microsoft.SDKSamples.Kitchen.exe. The WRLOutOfProcessWinRTComponent_server project is built into the Visual C++ component extensions (C++/CX) project by including the generated header file, Microsoft.SDKSamples.Kitchen.h. The WRLOutOfProcessWinRTComponent_server project and its corresponding proxy/stub project are referenced directly in the provided JavaScript and C# projects.

Also, the sample shows how to use the RoOriginateError function to report an error and an informative string to an attached debugger.

You can implement an in-process server by using the Microsoft::WRL namespace. For more info, see Creating a Windows Runtime DLL component sample (C++). Also, you can implement a component by using C++/CX. For more info, see Creating a Windows Runtime in-process component sample (C++/CX).

To obtain an evaluation copy of Windows 8.1, go to Windows 8.1.

To obtain an evaluation copy of Microsoft Visual Studio 2013, go to Visual Studio 2013.

Note  For Windows 8 app samples, download the Windows 8 app samples pack. The samples in the Windows 8 app samples pack will build and run only on Microsoft Visual Studio 2012.

Related topics

Creating a Windows Runtime DLL component sample (C++)
Creating a Windows Runtime in-process component sample (C++/CX)
Windows Runtime C++ reference
RoOriginateError

Related technologies

Windows Runtime C++ reference

Operating system requirements

Client
Windows 8.1
Server
Windows Server 2012 R2

Build the sample

  1. Start Visual Studio 2013 and select File > Open > Project/Solution.
  2. Go to the directory in which you unzipped the sample. Go to the directory named for the sample, and double-click the Visual Studio 2013 Solution (.sln) file.
  3. Press F7 or use Build > Build Solution to build the sample.

Run the sample

To debug the app and then run it, press F5 or use Debug > Start Debugging. To run the app without debugging, press Ctrl+F5 or use Debug > Start Without Debugging.

Newer Posts Older Posts Home