Posts tagged ‘Compact Framework’

Mobile development: Netstat, know your device’s open ports

On desktop PCs you have the nice tool netstat to see which ports are open on the PC. A customer wanted to know, why his devices do not release there internet connection. The only tool I know, that will show open network connections, is called netstat. Unfortunately I did not find such tool for Windows Mobile and so I wrote one myself:

netstat for windows mobile

netstatCF2

Continue reading ‘Mobile development: Netstat, know your device’s open ports’ »

Mobile development: pocketHosts-Edit Windows Mobile hosts entries

PocketPC and Windows Mobile does not support a hosts file as desktop windows. As I recently had to add an entry for a virtual machine running Mini SAP (Netweaver 7.01 Trial) I stumbled about how to add a host entry to a windows mobile device.

pocketHosts

The platform builder help gives the details about how host entries are organized:

Host Name

The host name can be configured through the HKEY_LOCAL_MACHINE\Comm\Tcpip\Hosts subkey. When an application calls gethostbyname or getaddrinfo, the registry is queried first, before a DNS or WINS request is sent. If the host name is found in the registry, the registry values are returned.

The following table shows the values for the HKEY_LOCAL_MACHINE\Comm\Tcpip\Hosts\<Host Name> subkey.

Value : type Description
Aliases : REG_MULTI_SZ This value stores the aliases by which this host is known.
ExpireTime : REG_BINARY If the current time, obtained by calling GetCurrentFT, exceeds the value in ExpireTime, the entire Host Name subkey is deleted the next time that gethostbyname is called. The length of this value is 8 bytes.
ipaddr : REG_BINARY This value stores the IPv4 addresses associated with this host name. The length of this value is 4 bytes per address.
ipaddr6 : REG_BINARY This value stores the IPv6 addresses associated with this host name. The length of this value is 20 bytes per address (16 bytes for address and 4 bytes for Scope ID).

So, there is no simple hosts file.

Continue reading ‘Mobile development: pocketHosts-Edit Windows Mobile hosts entries’ »

Mobile Development: manage the event db, what wakes up your device

The event db (it is my naming) holds all events and actions that can be invoked to launch an app or fire some events.

NotificationList

The tool shows all known notifications on a WM device. You can browse the event db and examine the defined events. Additionally the tool shows power change notifications.

noti_01   noti_02   noti_03

In the mid window above you can see there is a timed event that will occur at 0:00 and start \windows\calupd.exe. This will wake your device all night and update the calendar entries for re-occurring schedules etc.

The right window shows the power notifications on a suspend/resume cycle.

Using the options menu you can save a list of the defined notification events.

Continue reading ‘Mobile Development: manage the event db, what wakes up your device’ »

Windows Mobile 6.5: Changed Screen Geometry

Screen layout changes from Windows Mobile 6.1 to Windows Mobile Embedded Handheld 6.5

The Windows Mobile screen geometry changed from Windows Mobile 6.1 and before to the actual Windows Mobile 6.5 (also called Windows Embedded Handheld). Not only the geometry changed, the layout also changed. The Start icon is now moved to the bottom whereas before WM65 the start icon was on the left in the taskbar.

wm61screen   wm65screen

The taskbar and the menubar was about 26 pixels in height. With WM65 the taskbar is about 18 pixels in height and the menu bar occupies 34 pixels in height.

QVGA screen geometry

Windows Mobile 6.1

Windows Mobile 6.5

taskbar

26

18

menubar

26

34

client size

240;268

240;268

client size height no taskbar

240;294

240;302

client size height no menubar

240;294

240;286

You can see that assuming a fixed client size will give problems with the layout of the application, especially if menubar and taskbar height are assumed as being 26 pixels all the time.

Applications that only use the client size with the taskbar and menubar visible, will show normally, as the resulting client size does not differ between WM61 and WM65.

Continue reading ‘Windows Mobile 6.5: Changed Screen Geometry’ »