Microsoft All-In-One Code Framework Sample Updates in March, 2012 - Microsoft All-In-One Code Framework - Site Home - MSDN Blogs
Microsoft All-In-One Code Framework - Developers' Pain Killer

Microsoft All-In-One Code Framework Sample Updates in March, 2012

Rate This
  • Comments 1

A new release of Microsoft All-In-One Code Framework is available on March 19th.  We expect that its 11 new code samples covering typical programming scenarios in Windows Azure, Silverlight, ASP.NET, Windows Forms and Windows SDK would ease your development work.

imageYou can download the code samples using Sample Browser or Sample Browser Visual Studio extension. They give you the flexibility to search samples, download samples on demand, manage the downloaded samples in a centralized place, and automatically be notified about sample updates.

If it is the first time that you hear about Microsoft All-In-One Code Framework, please watch the introduction video on Microsoft Showcase, or read the introduction on our homepage http://1code.codeplex.com/.

 

--------------------------------------------------------

New Silverlight Code Samples

 

Save a DIB on the Clipboard to a File using Silverlight

Download: http://code.msdn.microsoft.com/CSSL5DIBFromClipboard-667fcc20/view/Reviews

Written by Microsoft Senior Support Escalation Engineer Trevor Fellman, the code sample demonstrates accessing the Windows Clipboard and retrieving a Device Independent Bitmap (DIB) and saving the DIB to a file.

image

 

--------------------------------------------------------

New Windows Azure Code Samples

 

Retry Azure Cache Operations

Download: http://code.msdn.microsoft.com/CSAzureRetryCache-c26c894b

Written by Microsoft Escalation Engineer Narahari Dogiparthi, the code sample implements retry logic to protect the application from crashing in the event of transient errors in Windows Azure. This sample uses Transient Fault Handling Application Block to implement retry mechanism

When using cloud based services, it is very common to receive exceptions similar to below while performing cache operations such as get, put. These are called transient errors.
 
Developer is required to implement retry logic to successfully complete their cache operations.
 
ErrorCode<ERRCA0017>:SubStatus<ES0006>:There is a temporary failure. Please retry later. (One or more specified cache servers are unavailable, which could be caused by busy network or servers. For on-premises cache clusters, also verify the following conditions. Ensure that security permission has been granted for this client account, and check that the AppFabric Caching Service is allowed through the firewall on all cache hosts. Also the MaxBufferSize on the server must be greater than or equal to the serialized object size sent from the client.)

--------------------------------------------------------

New ASP.NET Code Samples

 

Load JavaScript Resources on-demand

Download: http://code.msdn.microsoft.com/CSASPNETLoadAndExecuteDynam-25a1f05a

Written by Microsoft engineer Sagar Bhanudas Joshi, the sample demonstrates how JavaScript resources can be loaded on-demand. The JavaScript file is linked to the page via an Asynchronous web service call which returns the relative location of the JS on the server file and links it to the current page through JavaScript.

image

 

--------------------------------------------------------

New Windows SDK Code Samples

 

Adding/Removing Catalog Files using CAPI in C++ and C#

Download
C++ version: http://code.msdn.microsoft.com/CppCATAdmin-6a7f5941
C# version: http://code.msdn.microsoft.com/CSCATAdmin-0ebe1e36

Written by Microsoft Escalation Engineer Daniel Whitaker, this program demonstrates how to add/remove catalog files from a Windows system (XP and higher) programmatically.  This can come in handy when installing third party filter drivers via your own installation program.  Catalog files, which include their digital signatures, can’t just be copied to the CATROOT directory in System32.  They need to be added to the Catalog Database (CATDB) in the proper store.  Cpp/CSCATAdmin demonstrates how this is accomplished so that the filter will appear properly signed during installation. 

Cpp/CSCATAdmin is a basic console application that takes as arguments a command and a file path:
Usage:  Cpp/CSCATAdmin [-a<add> | -r<remove>] [catalog file]
Example: Cpp/CSCATAdmin -a C:\\MYWORK\\MYCAT.CAT

 

Set DNS SRV Record entry in Domain Naming Server

Download: http://code.msdn.microsoft.com/CppCreateDNSRecord-9edac3c1

Written by Microsoft Support Escalation Engineer Shaleen Thapa, the code sample demonstrates how to set the DNS SRV Record entry in the Domain Naming Server via C++. We are using here WMI’s class MicrosoftDNS_SRVType under ROOT\MicrosoftDNS namespace.  This namespace is provided by Microsoft to manage DNS.  This application takes the advantages of WMI classes and executes the method CreateInstanceFromPropertydata.

 

Interactive Windows Service

Download: http://code.msdn.microsoft.com/CSCreateProcessAsUserFromSe-b682134e

Written by Microsoft engineer Ashish Thakur, the sample demonstrates how to create/launch a process interactively in the session of the logged-on user from a service application written in C#.Net.

Just for the demonstration purpose, the path/name of the child process (Notepad.exe in this sample) has been hardcoded in the parent service application, but this sample can be referenced for launching any other interactive child applications. Main implementation of the sample is in the class named, “CSCreateProcessAsUserFromService” which P/Invokes to some native Windows APIs to launch the process.

 

Check whether a file is in use or not

Download: http://code.msdn.microsoft.com/CSCheckFileInUse-1974c9a1

Written by the Microsoft engineer Ajay Pathak, the sample illustrates how to check whether a file is in use or not. Lots of developers ask about this in the MSDN forums, so we created the code sample to address the frequently asked programming scenario:

http://social.msdn.microsoft.com/Forums/en-US/netfxbcl/thread/76d63016-3864-4020-849a-01a82276493d/
http://social.msdn.microsoft.com/forums/en-us/netfxbcl/thread/a539cbdc-5f42-4f09-9e04-860845aa049d/
http://social.msdn.microsoft.com/Forums/en-US/netfxbcl/thread/4e3a6014-4cd7-4d38-ba87-ccf9ce28b3c5/
http://social.msdn.microsoft.com/Forums/en-US/netfxbcl/thread/f225e48c-0321-49a3-9134-53f409dee5d9/
http://social.msdn.microsoft.com/Forums/en/netfxbcl/thread/e99a7cea-43d3-49b1-82bc-5669e0b9d052

How to Enable NetBIOS Over TCP/IP C++

Download: http://code.msdn.microsoft.com/CppEnableNetBiosOverTCPIP-ed32d818

Written by Microsoft Support Escalation Engineer Shaleen Thapa, this sample application demonstrates how to set the NetBIOS Over TCP/IP on the server. We are using here WMI’s class Win32_NetworkAdapterConfiguration under ROOT\CimV2 namespace. 

This namespace is provided by Microsoft to manage most of the WMI Classes.  This application takes the advantages of WMI classes and executes the method SetTCPIPNetBIOS.

To know more about Net BIOS Over TCP IP, please visit http://technet.microsoft.com/en-us/library/bb727013.aspx

 

Track the system CPU usage

Download: http://code.msdn.microsoft.com/Track-the-system-CPU-usage-defc62b6

Written by Microsoft SDE Amit Dey, this code sample demonstrates how to use the PerformanceCounter to track the CPU usage of the system or a certain process.  It lets the user visualize a Plot of one or more Performance Counter Value against time.

image

 

---------------------------------------------

New Windows Forms Code Samples

 

Crop the image from Windows Forms PictureBox control

Download: http://code.msdn.microsoft.com/CSWinFormCropImage-d4beb1fa

Written by Microsoft engineer Sagar Bhanudas Joshi, the sample demonstrates how to crop the image from specific Windows Forms PictureBox control into destination PictureBox control using mouse selection or specified coordinates.

image

 

Print Windows Forms DataGridView

Download: http://code.msdn.microsoft.com/CSWinFormPrintDataGridView-75864c45

Written by Microsoft engineer Nandeesh Suhas Swami, the code sample demonstrates how to print a DataGridView. The sample shows you the granularity as to print a single cell too.

image

 

If you have any feedback, please fill out this quick survey or email us: onecode@microsoft.com

Leave a Comment
  • Please add 3 and 5 and type the answer here:
  • Post
  • What about VB.NET examples? :(

    I really don't understand!

Page 1 of 1 (1 items)