Nov 24

If you do a quick search in google, you can find several links which explain how to hide the taskbar under Windows CE. Unfortunately, almost everything that you can find either is directed to unmanaged languages like C++ and VB6 or is based on C# language.

Here goes a quick snippet that do the same thing using VB.Net:

    Public Const SW_HIDE As Integer = &H0
    Public Const SW_HIDEWINDOW As Integer = &H0
    Public Const SW_SHOWNORMAL As Integer = &H1
 
     _
    Public Function FindWindow(ByVal className As String, ByVal windowName As String) As IntPtr
    End Function
 
     _
    Public Function ShowWindow(ByVal hWnd As IntPtr, ByVal cmdShow As Integer) As Boolean
    End Function
 
    Public Sub HideMyTaskBar()
        Dim taskBarHWnd As IntPtr = FindWindow("HHTaskBar", String.Empty)
        ShowWindow(taskBarHWnd, SW_HIDE)
    End Sub

Now just call the HideMyTaskBar() sub and that’s it! :)

Tagged with:
Oct 09

The following code is a .Net class that can be used to update a dyndns host alias. It is pretty simple to use. All you have to do is instantiate the class passing the username/password/host to the constructor.

This is the class:

' .Net DynDNS client class by David Gouveia - me[_@_]davidgouveia.net
' Feel free to use it as long as you don't remove the credits :o)

Imports System.Net
Imports System.IO
Public Class DynDnsUpdater
    Private _username, _password, _host, _ip As String
 
    Public Enum UpdateStatus
        SUCESS
        FAIL
        NOCHANGE
    End Enum
 
    Private Function checkip() As String
        Dim ipRegex As New System.Text.RegularExpressions.Regex("[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}", System.Text.RegularExpressions.RegexOptions.Singleline)
 
        Try
            Dim UpdateClient As System.Net.HttpWebRequest = WebRequest.Create( _
            New Uri("http://checkip.dyndns.org"))
            UpdateClient.Timeout = 15000
            Dim response As WebResponse = UpdateClient.GetResponse()
            Dim content As Stream = response.GetResponseStream()
            Dim readstream As New StreamReader(content, System.Text.Encoding.Default)
            Dim IpAddress As String = readstream.ReadToEnd
            readstream.Close()
            content.Close()
            If ipRegex.IsMatch(IpAddress) Then
                Return ipRegex.Match(IpAddress).Groups(0).Value
            Else
                Return Nothing
            End If
        Catch
            Return Nothing
        End Try
    End Function
 
    Public Sub New(ByVal username As String, ByVal password As String, ByVal host As String)
        _username = username
        _password = password
        _host = host
    End Sub
 
    Public Function update() As UpdateStatus
        _ip = checkip()
 
        Dim UpdateClient As System.Net.HttpWebRequest = WebRequest.Create( _
        New Uri("http://members.dyndns.org/nic/update?hostname=" + _host + "&myip=" + _ip))
        UpdateClient.Credentials = New NetworkCredential(_username, _password)
        UpdateClient.PreAuthenticate = True
        UpdateClient.UserAgent = ".Net DynDNS Updater Client"
        UpdateClient.Timeout = 15000
 
        Dim response As WebResponse = UpdateClient.GetResponse()
        Dim content As Stream = response.GetResponseStream()
        Dim readstream As New StreamReader(content, System.Text.Encoding.Default)
        Dim DynDnsResponse As String = readstream.ReadToEnd
        readstream.Close()
        content.Close()
 
        If DynDnsResponse.Contains("good " + _ip) Then
            Return UpdateStatus.SUCESS
        ElseIf DynDnsResponse.Contains("nochg " + _ip) Then
            Return UpdateStatus.NOCHANGE
        Else
            Return UpdateStatus.FAIL
        End If
 
    End Function
End Class

And this is how you can use it:

Dim updater As New DynDnsUpdater("dyndns username", "dyndns password", "hostalias")
        If updatert.update() <> DynDnsUpdater.UpdateStatus.FAIL Then
            MsgBox("SUCCESS!")
        Else
            MsgBox("ERROR!")
        End If

have fun :-)

Tagged with:
Aug 07

Descobri por acaso um artigo que continha informação que era útil para um projecto meu.
Como o meu projecto utiliza a tecnologia .Net, aproveitei para rescrever a função que aqui disponibilizo para o caso de ser útil para alguém.

Public Class dlink
    Private mac_ As String
    Public Sub New(ByVal mac As String)
        mac_ = mac
    End Sub
 
    Public Function generate() As String
        Dim password(20) As String
        For i = 0 To mac_.Length - 1
            Select Case i
                Case 0
                    password(1) = dictionary(mac_.Substring(i, 1))
                    Exit Select
                Case 1
                    password(3) = dictionary(mac_.Substring(i, 1))
                    password(12) = dictionary(mac_.Substring(i, 1))
                    Exit Select
                Case 2
                    password(5) = dictionary(mac_.Substring(i, 1))
                    password(17) = dictionary(mac_.Substring(i, 1))
                    Exit Select
                Case 3
                    password(7) = dictionary(mac_.Substring(i, 1))
                    Exit Select
                Case 4
                    password(9) = dictionary(mac_.Substring(i, 1))
                    password(18) = dictionary(mac_.Substring(i, 1))
                    Exit Select
                Case 5
                    password(11) = dictionary(mac_.Substring(i, 1))
                    Exit Select
                Case 6
                    password(10) = dictionary(mac_.Substring(i, 1))
                    password(13) = dictionary(mac_.Substring(i, 1))
                    Exit Select
                Case 7
                    password(8) = dictionary(mac_.Substring(i, 1))
                    Exit Select
                Case 8
                    password(6) = dictionary(mac_.Substring(i, 1))
                    password(14) = dictionary(mac_.Substring(i, 1))
                    Exit Select
                Case 9
                    password(15) = dictionary(mac_.Substring(i, 1))
                    password(4) = dictionary(mac_.Substring(i, 1))
                    Exit Select
                Case 10
                    password(2) = dictionary(mac_.Substring(i, 1))
                    password(19) = dictionary(mac_.Substring(i, 1))
                    Exit Select
                Case 11
                    password(0) = dictionary(mac_.Substring(i, 1))
                    password(16) = dictionary(mac_.Substring(i, 1))
                    Exit Select
            End Select
        Next
        Return Join(password, "")
    End Function
 
    Private Function dictionary(ByVal letter As Char) As Char
        Select Case letter.ToString.ToUpper
            Case "1"
                Return "r"
                Exit Select
            Case "2"
                Return "q"
                Exit Select
            Case "3"
                Return "a"
                Exit Select
            Case "4"
                Return "H"
                Exit Select
            Case "5"
                Return "N"
                Exit Select
            Case "6"
                Return "p"
                Exit Select
            Case "7"
                Return "d"
                Exit Select
            Case "8"
                Return "S"
                Exit Select
            Case "9"
                Return "Y"
                Exit Select
            Case "0"
                Return "X"
                Exit Select
            Case "A"
                Return "w"
                Exit Select
            Case "B"
                Return "8"
                Exit Select
            Case "C"
                Return "6"
                Exit Select
            Case "D"
                Return "2"
                Exit Select
            Case "E"
                Return "1"
                Exit Select
            Case "F"
                Return "5"
                Exit Select
            Case Else
                Return " "
        End Select
 
    End Function
End Class

A classe é muito simples de usar:

dim myDlink as new dlink("aabbccddee")
myDlink.generate()

Não se esqueçam que aceder a redes sem a devida permissão é crime punível por lei!

Tagged with:
preload preload preload