[Windows Mobile Development and Hacking General] lyriquidperfection:
Here are a few useful tricks using p/invoke that some developers may find usefull and some were hard to find on the net so I created my own Wrappers with a little research.

The following code is a Helper Class to apply the WM6.5 visual styles to some controls using .net framework. This Wrapper lets you apply the visual style to the Tab Control, Apply Background Image to ListView, Enable Double Buffering for ListView, Show Grid Lines in ListView and Enable Visual Style for ListView. To call these functions you just simply put the control in the brackets you wish to apply the visual style to. For Example: EnableListViewStyle(lvMyListview)

Public Class VisualStyleHelper

Public Const GWL_STYLE As Integer = -16
Public Const GW_CHILD As Int32 = 5
Public Const LVS_EX_THEME As Integer = &H2000000
Public Const LVM_SETEXTENDEDLISTVIEWSTYLE As Integer = &H1000 + 54
Public Const LVM_GETEXTENDEDLISTVIEWSTYLE As Integer = &H1000 + 55
Public Const LVS_EX_GRIDLINES As Integer = &H1
Public Const LVS_EX_DOUBLEBUFFER As Integer = &H10000
Public Const LVBKIF_SOURCE_HBITMAP As Integer = &H1
Public Const LVM_SETBKIMAGE As Integer = (&H1000 + 138)

Private Declare Function SendMessage Lib "coredll" (ByVal hWnd As IntPtr, ByVal Msg As UInt32, ByVal wParam As UInt32, ByVal lParam As Integer) As IntPtr
Private Declare Function SendMessage Lib "coredll" (ByVal hWnd As IntPtr, ByVal Msg As UInt32, ByVal wParam As UInt32, ByRef img As LVBKIMAGE) As IntPtr

Public Structure LVBKIMAGE
Public ulFlags As Integer
Public hbm As IntPtr
Public pszImage As IntPtr
Public cchImageMax As Integer
Public xOffsetPercent As Integer
Public yOffsetPercent As Integer
End Structure

'Tab Control Helper
Public Shared Sub EnableTabStyle(ByVal tabControl As TabControl)
Dim hNativeTab As IntPtr = WindowHelper.GetWindow(tabControl.Handle, GW_CHILD)
Dim Style As Integer = WindowHelper.GetWindowLong(hNativeTab, GWL_STYLE)

Style = WindowHelper.SetWindowLong(hNativeTab, GWL_STYLE, Style Or &H4000)
End Sub

'ListView Control Helper
Public Shared Sub EnableListViewStyle(ByVal listView As ListView)
Dim currentStyle As Integer = SendMessage(listView.Handle, CUInt(LVM_GETEXTENDEDLISTVIEWSTYLE), 0, 0)

SendMessage(listView.Handle, CUInt(LVM_SETEXTENDEDLISTVIEWSTYLE), 0, currentStyle Or LVS_EX_THEME)
End Sub

'Set Background Image to ListView
Public Shared Sub SetBackgroundImage(ByVal listView As ListView, ByVal path As String)
Dim bitmap As New Bitmap(path)
Dim hBitmap As IntPtr = bitmap.GetHbitmap()

bitmap.Dispose()

Dim lvImage As New LVBKIMAGE()
lvImage.hbm = hBitmap
lvImage.ulFlags = LVBKIF_SOURCE_HBITMAP

SendMessage(listView.Handle, LVM_SETBKIMAGE, 0, lvImage)
End Sub

'Display GridLines in ListView
Public Shared Sub ShowGridLines(ByVal listView As ListView)
Dim currentStyle As Integer = SendMessage(listView.Handle, CUInt(LVM_GETEXTENDEDLISTVIEWSTYLE), 0, 0)

SendMessage(listView.Handle, CUInt(LVM_SETEXTENDEDLISTVIEWSTYLE), 0, currentStyle Or LVS_EX_GRIDLINES)
End Sub

'Reduces Flicker in ListView
Public Shared Sub EnableDoubleBuffering(ByVal listView As ListView)
Dim currentStyle As Integer = SendMessage(listView.Handle, CUInt(LVM_GETEXTENDEDLISTVIEWSTYLE), 0, 0)

SendMessage(listView.Handle, CUInt(LVM_SETEXTENDEDLISTVIEWSTYLE), 0, currentStyle Or LVS_EX_DOUBLEBUFFER)
End Sub
End Class

Here is a simple function to return the given bytes in Megabytes as a string:

Public Shared Function CBytesToMBytes(ByVal Bytes As Double) As String
Dim dblAns As Double
dblAns = (Bytes / 1024) / 1024
Return Format(dblAns, "###,###,##0.00 MB")
End Function

Here is a Class Wrapper I created which lets you use various methods to Soft Reset and even use HTCUtil.dll to Hard Reset your device:

Public Class DeviceBootHelperClass

Const EWX_REBOOT = 2

<DllImport("HtcUtil")> _
Public Shared Sub HTCUtilTurnOnFlightMode()
End Sub

<DllImport("HtcUtil")> _
Public Shared Sub HTCUtilSetClearStorageFlag()
End Sub

<DllImport("HtcUtil")> _
Public Shared Sub HTCUtilPowerOffReset()
End Sub

<DllImport("HtcUtil")> _
Public Shared Sub HTCUtilDeviceOff()
End Sub

<DllImport("HtcUtil")> _
Public Shared Sub HTCUtilEnterBootloaderMode()
End Sub

<DllImport("aygshell")> _
Private Shared Function ExitWindowsEx(ByVal dwFlags As Integer, ByVal dwReserved As Integer) As Boolean
End Function

<DllImport("coredll")> _
Private Shared Function KernelIoControl(ByVal dwIoControlCode As Integer, _
ByVal lpInBuf As IntPtr, ByVal nInBufSize As Integer, ByVal lpOutBuf As IntPtr, _
ByVal nOutBufSize As Integer, ByRef lpBytesReturned As Integer) As Integer
End Function

Public Shared Sub KernelIOControlSoftResetMethod()
Const IOCTL_HAL_REBOOT As Integer = &H101003C
Dim bytesReturned As Integer = 0
KernelIoControl(IOCTL_HAL_REBOOT, IntPtr.Zero, 0, IntPtr.Zero, 0, bytesReturned)
End Sub

Public Shared Sub HTCUtilSoftResetMethod()
Try
HTCUtilPowerOffReset()
Catch ex As Exception

End Try
End Sub

Public Shared Sub HTCUtilPowerOffMethod()
Try
HTCUtilDeviceOff()

Catch ex As Exception

End Try
End Sub

Public Shared Sub HTCUtilHardResetMethod()
Try
HTCUtilTurnOnFlightMode()
HTCUtilSetClearStorageFlag()
HTCUtilPowerOffReset()
End If

Catch ex As Exception

End Try
End Sub

Public Shared Sub ExitWindowsExSoftResetMethod()
Try
ExitWindowsEx(EWX_REBOOT, 0)
Catch ex As Exception

End Try
End Sub

Public Shared Sub EnterBootloaderMode()
Try
HTCUtilEnterBootloaderMode()
Catch ex As Exception

End Try
End Sub
End Class

If you like my work, then please feel free to buy me a beer! :)