Some notes on software development... RSS 2.0
# Wednesday, 22 April 2009

Because I keep forgetting the syntax…

DBCC CHECKIDENT('TableName', RESEED, 0)

Wednesday, 22 April 2009 22:59:53 (GMT Standard Time, UTC+00:00)  #    -
SQL Server
# Thursday, 05 March 2009

This is old news but something I had to use recently....
Add a .cs file to your project, any filename is fine but I called mine ExtensionAttribute.cs.
Add the following code...

image

Wherever you declare your extension methods you need to include 'using System.Runtime.CompilerServices' to the top.

Note:- You must be using Visual Studio 2008 for this to work.

Links
The Moth - Using Extension Methods in Fx 2.0 Projects
CodeThinked - Using Extension Methods in .net 2.0

Thursday, 05 March 2009 10:12:41 (GMT Standard Time, UTC+00:00)  #    -
C#
# Wednesday, 18 February 2009

I had an issue with a compact framework project where I needed to add a shortcut on the desktop that pointed to my application whose location was \Program Files\MyApplication\.
You need to create a .lnk text file and place it on the device's desktop. However, .lnk files are a bit tricky to use with Visual Studio 2008 because it thinks it is an actual shortcut to a file on your actual desktop machine.

Mike Hall has a blog article that further covers Windows CE shortcuts.

Here are my steps on how to overcome the .lnk issue when using a Smart Device CAB project from within Visual Studio 2008.

My application is called MyApplication.exe and it's full path, once installed on Windows CE, is \Program Files\MyApplication\MyApplication.exe
All my application does is show 'Hello World' in a label on the form.
My Windows CE installer project is called MyWindowsCEInstaller.

First I create the application and installer projects and added the project output of MyApplication to the MyWindowsCEInstaller project. Here is what my solution looks like so far:

image

Next step is to create the shortcut file that will eventually be placed on the device desktop. To do this I created a new text file within the MyApplication project called MyApplication.lnkx
It's 'Build Action' property should be set to None and 'Copy to Output Directory' property set to Do Not Copy.
It is a lot easier to work with the file having the extension as .lnkx so that Windows doesn't think it is an actual shortcut file.

The MyApplication.lnkx file will contain the command line text and the command line character count separated by a hash (#).
So my Windows CE application full path is \Program Files\MyApplication\MyApplication.exe making the character count 48, below is my MyApplication.lnkx file:

image

Note:- If the path contains a space it must be enclosed in quotes and they get included in the command character count!!!

Next step is to add our MyApplication.lnkx file to the correct folder in the MyWindowsCEInstaller project.

From the root of the Primary Output File System view of the MyWindowsCEInstaller project add the Windows Special Folder.
Under the Windows folder create a new folder called Desktop

Add the MyApplication.lnkx file to the newly created Desktop folder.

image

Next, select the MyApplication.lnkx file from the MyWindowsCEInstaller project and change the TargetName to be MyApplication.lnk
This will change the extension off the shortcut file on the target device to be .lnk while on the development machine it will stay as .lnkx

The final files should look like this:

image image


Build the solution, copy the CAB file to the device, install it and now there should be desktop shortcut that points to the MyApplication application ;-)

image image

Note that the shortcut will also use the application icon as it's image once this has been set in the application properties, here it is the default image.


Links
Mike Hall Windows CE Shortcuts Blog Article

Wednesday, 18 February 2009 17:31:35 (GMT Standard Time, UTC+00:00)  #    -
CF | CE Devices
# Tuesday, 03 February 2009

Simply set the CSS style attributes of the collapsible panel to be Height = 0px; overflow: hidden;


image

Tuesday, 03 February 2009 12:48:18 (GMT Standard Time, UTC+00:00)  #    -
ASP.NET
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 2017
Hadrian Phillips

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