Some notes on software development... RSS 2.0
# Tuesday, 08 April 2008

To put a new line inside an Microsoft Excel cell you can use ALT+ENTER.
Handy for keeping text neat :)

Tuesday, 08 April 2008 11:37:05 (GMT Standard Time, UTC+00:00)  #    -
Office
# Wednesday, 02 April 2008

If you have a char array that contains the string you want but is padded out with null terminators e.g. '\0' you can use the String.TrimEnd method to get the exact string you need.

Example:
A 12 element char array contains the following chars: M y S t r i n g \0 \0 \0 \0

To convert to a string you can use the String constructor to pass in a Char[] type. Unfortunately a .NET string can happily contain null characters so your resulting string would be MyString\0\0\0\0
Using the TrimEnd('\0') will return the correctly terminated string.

image

Note: Outputting a string containing null characters to other classes like form controls may automatically terminate the strings correctly at the first null character but behind the scenes the string still contains the null characters.

Links:
MSDN String.TrimEnd Method
Strings In .NET and C# (Jon Skeet)

Wednesday, 02 April 2008 09:46:35 (GMT Standard Time, UTC+00:00)  #    -
C#
# 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:

image

Wednesday, 26 March 2008 11:45:08 (GMT Standard Time, UTC+00:00)  #    -
Tools
# 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.

image

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

Links
Chris Tacke blog article

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

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

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

© Copyright 2018
Hadrian Phillips

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