Some notes on software development... RSS 2.0
# Wednesday, 26 March 2008

The excellent Paint.NET application does not support .ico files out of the box.
So, to save .ico files you need to install a plug-in from Evan's Web Site.

Extract the IcoCur.dll to the FileTypes folder in the Paint.NET directory, for a default install it is C:\Program Files\Paint.NET\FileTypes

When you do a 'save as' your will now have .ico and .cur file extensions in the type list:


Wednesday, 26 March 2008 11:45:08 (GMT Standard Time, UTC+00:00)  #    -
# Wednesday, 19 March 2008

Note:- the code for this article is directly taken from Chris Tacke's Blog, see footer link.

If there is a process that you need to kill that does not have a running window i.e. an app that sits in the CE system tray you need to use the Kill method from the ProcessEntry class when using Smart Device Framework.

First you need to get a list of running processes. Then you compare each running process name to the name of the process you want to kill.
Then simply call the Kill method.


Warning: Calling the kill method will immediately shutdown the process. You could lose any unsaved data when killing a process this way.
If the process has a graphical window it is better to close the application gracefully by sending a close window message to the application, which in turn will close down correctly and save any data if it has been coded correctly ;)
To do that look here: Kill a process with SendMessage in Compact Framework

Chris Tacke blog article

Wednesday, 19 March 2008 16:23:42 (GMT Standard Time, UTC+00:00)  #    -
# Friday, 14 March 2008

With the full .NET library you can call Application.ProductVersion to get the version number of your running application.
This method is not available for Compact Framework so we have to use reflection to help us interrogate the running assembly.

The info we need is held in the AssemblyName class and which we can populate by calling GetExecutingAssembly static method from the Assembly class in the System.Reflection namespace.
The code:

AssemblyName currentAssemblyName = Assembly.GetExecutingAssembly().GetName();
string version = currentAssemblyName.Version.ToString();
Friday, 14 March 2008 11:54:42 (GMT Standard Time, UTC+00:00)  #    -
# Monday, 10 March 2008

Using P/Invoke you can play a beep through the PC speaker.

The P/Invoke prototype:

[DllImport("kernel32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool Beep(uint dwFreq, uint dwDuration);
specifies the frequency, in hertz, of the sound. This parameter must be in the range 37 through 32,767 (0x25 through 0x7FFF).
dwDuration specifies the duration, in milliseconds, of the sound.
Example code to call the function:
Beep(500, 1000);
Warning!!! Beep is NOT asynchronous so it does not return to the caller until the beep has finished
Links: Beep (Kernel32) reference

Monday, 10 March 2008 17:25:20 (GMT Standard Time, UTC+00:00)  #    -

Sign In
Total Posts: 116
This Year: 0
This Month: 0
This Week: 0
Comments: 36
About the author/Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2019
Hadrian Phillips

All Content © 2019, Hadrian Phillips
DasBlog theme 'Business' created by Christoph De Baene (delarou)