Yesup
 
HMAC Project
Filter Driver
Yamabay's PocketPC Projects in C#
Text to MP3 Project
MultiHoming Router
Your Ad Here

Project I: Get Date Time Information from GPS data packet.

GPS data packet contains not just location information, it also has the time information in certain data packets. We can use the time information to adjust the Pocket PC clock, based on the Time Zone information it stored.

Download Sample Source Code in C#.

Project II: Calculate the Sun Rise and Sun Set time based on GPS information.

Provide Get_Dawn() and Get_Dusk() function calls based on the Sun Rise and Sun Set time:

Dawn = 45 minutes after Sun Rise.

Dusk = 45 minutes before Sun Set.

The Sun Rise and Sun Set algorithm referenced:

Sun's position: http://www.stjarnhimlen.se/comp/riset.html

Sun's Approximate position: http://aa.usno.navy.mil/faq/docs/SunApprox.html

Download Sample Source Code in C#.

Project III: Lights Up, Blinks and Turns Off the middle LED on PocketPC

Download Sample Source Code in C#. 

Project IV: Heartbeat Program to Test if the COM port of PocketPC is still alive

1 Pick a com port then click a button "GO" to activate. The GO button can become "STOP" to stop the program later.
2. It keeps on listening to the com port, say COM8.
3. If the data is lost for 2 seconds and more, it alarms by blinking the LED or BEEP. It also record the time when it starts to lose data.
4. If the data eventually comes back from the COM port, it stop the alarm and record the comeback time.
 
Your Ad Here

Project V: To find the right COM port of the Bluetooth Driver in PocketPC.

Project VI: To make file Read-Only and/or Hidden in PocketPC.

Download Sample Source Code in C#.

Project VII: Com Port finder for PocketPC.

Download Sample Source Code in C#.

Project VIII: Retrieve Device ID of the PocketPC

[DllImport("coredll.dll", SetLastError=true)]
		private static extern bool KernelIoControl(Int32 IoControlCode, IntPtr
			InputBuffer, Int32 InputBufferSize, byte[] OutputBuffer, Int32
			OutputBufferSize, ref Int32 BytesReturned);
		
		private static Int32 FILE_DEVICE_HAL = 0x00000101;
		private static Int32 FILE_ANY_ACCESS = 0x0;
		private static Int32 METHOD_BUFFERED = 0x0;
		private const Int32 ERROR_NOT_SUPPORTED = 0x32;
		private const Int32 ERROR_INSUFFICIENT_BUFFER = 0x7A;

		private static Int32 IOCTL_HAL_GET_DEVICEID = 
			((FILE_DEVICE_HAL) << 16) | ((FILE_ANY_ACCESS) << 14) 
			| ((21) << 2) | (METHOD_BUFFERED);

		private static string GetDeviceID()
		{
			byte[] OutputBuffer = new byte[256];
			Int32 OutputBufferSize, BytesReturned;
			OutputBufferSize = OutputBuffer.Length;
			BytesReturned = 0;

			// Call KernelIoControl passing the previously defined
			// IOCTL_HAL_GET_DEVICEID parameter
			// We don’t need to pass any input buffers to this call
			// so InputBuffer and InputBufferSize are set to their null
			// values
			bool retVal = KernelIoControl(IOCTL_HAL_GET_DEVICEID, IntPtr.Zero, 0,
					OutputBuffer, OutputBufferSize, ref BytesReturned);

			// If the request failed, exit the method now
			if (retVal == false)
			{
			    int error = Marshal.GetLastWin32Error();
				switch (error)
				{
					case ERROR_NOT_SUPPORTED:
						return ("ID not supported");
					case ERROR_INSUFFICIENT_BUFFER:
						return("Insufficient buffer");
					default:
						return ("Unknown Error!");
				}
				//return null;
			}
    
			// Examine the OutputBuffer byte array to find the start of the 
			// Preset ID and Platform ID, as well as the size of the
			// PlatformID.
			// PresetIDOffset – The number of bytes	the preset ID is offset 
			// from the beginning of the structure
			// PlatformIDOffset  -	The number of bytes  the platform ID is
			// offset from the beginning of  the structure 
			// PlatformIDSize -  The number of bytes used  to  store the 
			// platform ID 
			// Use BitConverter.ToInt32() to convert from byte[] to	int
			
			Int32 PresetIDOffset =  
			  BitConverter.ToInt32(OutputBuffer,
			4);
			Int32 PlatformIDOffset = 

			BitConverter.ToInt32(OutputBuffer, 0xc);
			Int32 PlatformIDSize =   BitConverter.ToInt32(OutputBuffer,
					0x10); 
			// Convert the Preset ID segments into a string so they can	be 
			// displayed easily.
			    StringBuilder sb = 
			         new StringBuilder();
			sb.Append(String.Format("{0:X8}-{1:X4}-{2:X4}-{3:X4}-",
			    BitConverter.ToInt32(OutputBuffer, PresetIDOffset),
				BitConverter.ToInt16(OutputBuffer, PresetIDOffset +4),
				 BitConverter.ToInt16(OutputBuffer, PresetIDOffset +6),
				 BitConverter.ToInt16(OutputBuffer, PresetIDOffset +8)));
			// Break  the Platform ID down  into 2-digit hexadecimal numbers
			// and	append them to the Preset ID. This will result in a 
			// string-formatted Device ID
			for (int i =  PlatformIDOffset; i <  PlatformIDOffset +   PlatformIDSize; 
				i ++ )  
			{
				sb.Append( String.Format("{0:X2}", OutputBuffer[i]));
			}
    
			// return the Device ID string
			return sb.ToString();
		}

Your Ad Here

Project IX: Capture Hotkeys in PocketPC

Windows CE Virtual Keys Defintion:

Public Const VK_ADD = &H6B
Public Const VK_ATTN = &HF6
Public Const VK_BACK = &H8
Public Const VK_CANCEL = &H3
Public Const VK_CAPITAL = &H14
Public Const VK_CLEAR = &HC
Public Const VK_CONTROL = &H11
Public Const VK_CRSEL = &HF7
Public Const VK_DECIMAL = &H6E
Public Const VK_DELETE = &H2E
Public Const VK_DIVIDE = &H6F
Public Const VK_DOWN = &H28
Public Const VK_END = &H23
Public Const VK_EREOF = &HF9
Public Const VK_ESCAPE = &H1B
Public Const VK_EXECUTE = &H2B
Public Const VK_EXSEL = &HF8
Public Const VK_F1 = &H70
Public Const VK_F10 = &H79
Public Const VK_F11 = &H7A
Public Const VK_F12 = &H7B
Public Const VK_F13 = &H7C
Public Const VK_F14 = &H7D
Public Const VK_F15 = &H7E
Public Const VK_F16 = &H7F
Public Const VK_F17 = &H80
Public Const VK_F18 = &H81
Public Const VK_F19 = &H82
Public Const VK_F2 = &H71
Public Const VK_F20 = &H83
Public Const VK_F21 = &H84
Public Const VK_F22 = &H85
Public Const VK_F23 = &H86
Public Const VK_F24 = &H87
Public Const VK_F3 = &H72
Public Const VK_F4 = &H73
Public Const VK_F5 = &H74
Public Const VK_F6 = &H75
Public Const VK_F7 = &H76
Public Const VK_F8 = &H77
Public Const VK_F9 = &H78
Public Const VK_HELP = &H2F
Public Const VK_HOME = &H24
Public Const VK_INSERT = &H2D
Public Const VK_LBUTTON = &H1
Public Const VK_LCONTROL = &HA2
Public Const VK_LEFT = &H25
Public Const VK_LMENU = &HA4
Public Const VK_LSHIFT = &HA0
Public Const VK_MBUTTON = &H4             '  EMERGENCY contiguous with L RBUTTON
Public Const VK_MENU = &H12
Public Const VK_MULTIPLY = &H6A
Public Const VK_NEXT = &H22
Public Const VK_NONAME = &HFC
Public Const VK_NUMLOCK = &H90
Public Const VK_NUMPAD0 = &H60
Public Const VK_NUMPAD1 = &H61
Public Const VK_NUMPAD2 = &H62
Public Const VK_NUMPAD3 = &H63
Public Const VK_NUMPAD4 = &H64
Public Const VK_NUMPAD5 = &H65
Public Const VK_NUMPAD6 = &H66
Public Const VK_NUMPAD7 = &H67
Public Const VK_NUMPAD8 = &H68
Public Const VK_NUMPAD9 = &H69
Public Const VK_OEM_CLEAR = &HFE
Public Const VK_PA1 = &HFD
Public Const VK_PAUSE = &H13
Public Const VK_PLAY = &HFA
Public Const VK_PRINT = &H2A
Public Const VK_PRIOR = &H21
Public Const VK_PROCESSKEY = &HE5
Public Const VK_RBUTTON = &H2
Public Const VK_RCONTROL = &HA3
Public Const VK_RETURN = &HD
Public Const VK_RIGHT = &H27
Public Const VK_RMENU = &HA5
Public Const VK_RSHIFT = &HA1
Public Const VK_SCROLL = &H91
Public Const VK_SELECT = &H29
Public Const VK_SEPARATOR = &H6C
Public Const VK_SHIFT = &H10
Public Const VK_SNAPSHOT = &H2C
Public Const VK_SPACE = &H20
Public Const VK_SUBTRACT = &H6D
Public Const VK_TAB = &H9
Public Const VK_UP = &H26
Public Const VK_ZOOM = &HFB

Download Sample Source Code in eMbedded VC++

To capture Hardware Button codes:

Download Sample Source Code in C#

 

Anti Spam WinASP Web2Image Skype Gateway Dashboard Chart OE6 COM/ActiveX
Copyright © 2000-2006 YamaBay. All rights reserved.  Privacy Policy