Friday, November 21, 2003
More .NET Compact Framework Sample Code
Posted by Andy Sjostrom in "DEVELOPER" @ 02:40 AM
Microsoft has recently published a number of additional code sample downloads built using .NET Compact Framework. Download and store away to your own "tool box" of good-to-have utilities!
Performance Counter - This sample demonstrates how to P/Invoke the QueryPerformanceFrequency and QueryPerformanceCounter functions to create a high resolution timing solution.
Splash Screen - This sample demonstrates how to create a splash screen form on a separate thread from the main form. The splash screen will periodically update a "busy" animation and shut down when either the form has finished loading or a specified amount of time has elapsed, whichever comes last.
Stopping Threads - The code in this sample resides in a single Form and demonstrates how to safely shut down a Form with multiple threads running. The Form contains a single button which launches a new thread. Each thread subsequently sits in an infinite loop invoking a counter updating function and waiting for a close request. When the application is closed, the main form waits until all threads are removed before shutting down.
Save Bitmap - This example demonstrates how to load a bitmap from a file, draw it to a surface, allow the user to modify it, and then save it to a file. In the .NET Compact Framework, there is no simple method for saving Bitmap objects or getting a bitmap handle from a Bitmap object so it is necessary to use a bit of trickery to access a bitmap's pixel data. This example will access a bitmap's pixel data through a device context created from an editor control.
Performance Measurement - Learn how to measure and tune the performance of your Microsoft® .NET Compact Framework-based applications.
Bitmap Copy - This sample demonstrates two Copy functions for copying Bitmap objects. The first function returns a Bitmap object containing a specified region of a source Bitmap object. The second returns a Bitmap object which is a copy of the original source Bitmap object.
Power Status - This sample demonstrates how to P/Invoke the GetSystemPowerStatusEx and GetSystemPowerStatusEx2 functions, each of which fill a SYSTEM_POWER_STATUS_EX and SYSTEM_POWER_STATUS_EX2 class respectively. These classes contain information about the batteries and power status of the device.
MSI that Detects Framework Version - This sample describes how one might create an MSI package which can detect the presence of the Microsoft .NET Compact Framework on a device, determine if the device needs to be upgraded with a newer version, and install or upgrade the Framework along with an application.
Performance Counter - This sample demonstrates how to P/Invoke the QueryPerformanceFrequency and QueryPerformanceCounter functions to create a high resolution timing solution.
Splash Screen - This sample demonstrates how to create a splash screen form on a separate thread from the main form. The splash screen will periodically update a "busy" animation and shut down when either the form has finished loading or a specified amount of time has elapsed, whichever comes last.
Stopping Threads - The code in this sample resides in a single Form and demonstrates how to safely shut down a Form with multiple threads running. The Form contains a single button which launches a new thread. Each thread subsequently sits in an infinite loop invoking a counter updating function and waiting for a close request. When the application is closed, the main form waits until all threads are removed before shutting down.
Save Bitmap - This example demonstrates how to load a bitmap from a file, draw it to a surface, allow the user to modify it, and then save it to a file. In the .NET Compact Framework, there is no simple method for saving Bitmap objects or getting a bitmap handle from a Bitmap object so it is necessary to use a bit of trickery to access a bitmap's pixel data. This example will access a bitmap's pixel data through a device context created from an editor control.
Performance Measurement - Learn how to measure and tune the performance of your Microsoft® .NET Compact Framework-based applications.
Bitmap Copy - This sample demonstrates two Copy functions for copying Bitmap objects. The first function returns a Bitmap object containing a specified region of a source Bitmap object. The second returns a Bitmap object which is a copy of the original source Bitmap object.
Power Status - This sample demonstrates how to P/Invoke the GetSystemPowerStatusEx and GetSystemPowerStatusEx2 functions, each of which fill a SYSTEM_POWER_STATUS_EX and SYSTEM_POWER_STATUS_EX2 class respectively. These classes contain information about the batteries and power status of the device.
MSI that Detects Framework Version - This sample describes how one might create an MSI package which can detect the presence of the Microsoft .NET Compact Framework on a device, determine if the device needs to be upgraded with a newer version, and install or upgrade the Framework along with an application.