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.
You 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
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.
New Windows Azure Code Samples
Retry Azure Cache Operations
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
New Windows SDK Code Samples
Adding/Removing Catalog Files using CAPI in C++ and C#
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
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
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
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:
How to Enable NetBIOS Over TCP/IP C++
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
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.
New Windows Forms Code Samples
Crop the image from Windows Forms PictureBox control
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.
Print Windows Forms DataGridView
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.
If you have any feedback, please fill out this quick survey or email us: firstname.lastname@example.org