2008年8月9日 星期六

Module Tools_for_WJAtTSINT2008 [2008-08-10]

' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '
' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '
' ' ' ' ' ' ' ' ' ' ' ' '  [2008_08_10_MM_12_13_29]  ' ' ' ' ' ' ' ' ' ' ' ' ' '
' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '
'     (友善的模組名稱) Friendly name of this module:
'           [WJAtTSINT2008].[Tools for WJAtTSINT2008]
'
'     (程式用模組名稱) Code name of this module:
'           WJAtTSINT2008.Tools_for_WJAtTSINT2008
'
'     Version: 1.00.01
'     Last Updated: (2008 04 03 PM 07 10 18)

Module Tools_for_WJAtTSINT2008
    Public Function GetStringInClipboard() As String
        ' (本段程式之目的) Purpose:
        '     Get the text content currently stored in system's clipboard.
        ' (本段程式是否已經在被使用中) In use: Yes
        ' (重要等級) Importance rating:  85%
        ' (再利用的可能性) Chances of reuse:  90%
        ' (程式撰寫的進度) Developing: 100% (Mandatory)
        ' (程式堪用的程度) Workable: 80% (Threshold at 80%)
        ' (程式的測試程度) Code tested: 80% (max 99%)
        ' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        ' (修改程式的日期) Revision Date: (2005 09 01 PM 01 50 25)
        ' (修改程式的人員) Revised by: WeiJin Tang (湯偉晉)
        '     OK
        ' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

        Dim myDataObject As System.Windows.Forms.IDataObject
        Dim T As String
        myDataObject = System.Windows.Forms.Clipboard.GetDataObject()

        ' Try to return Unicode Text first, if failed, then try to return ANSI Text
        If myDataObject.GetDataPresent(System.Windows.Forms.DataFormats.UnicodeText) Then
            T = myDataObject.GetData(System.Windows.Forms.DataFormats.UnicodeText)
        Else
            If myDataObject.GetDataPresent(System.Windows.Forms.DataFormats.Text) Then
                T = myDataObject.GetData(System.Windows.Forms.DataFormats.Text)
            Else
                T = String.Empty
            End If
        End If

        Return T

        ' Begin: Reusable code block (2005 09 01 PM 10 26 20)
        If myDataObject.GetDataPresent(System.Windows.Forms.DataFormats.Text) Then
            MsgBox("Clipboard content is compatible with data type [System.Windows.Forms.DataFormats.Text]")
        Else
            MsgBox("Clipboard content is    NOT      compatible with data type  [System.Windows.Forms.DataFormats.Text]")
        End If

        If myDataObject.GetDataPresent(System.Windows.Forms.DataFormats.UnicodeText) Then
            MsgBox("Clipboard content is compatible with data type [System.Windows.Forms.DataFormats.UnicodeText]")
        Else
            MsgBox("Clipboard content is    NOT      compatible with data type  [System.Windows.Forms.DataFormats.UnicodeText]")
        End If

        If myDataObject.GetDataPresent(System.Windows.Forms.DataFormats.WaveAudio) Then
            MsgBox("Clipboard content is compatible with data type [System.Windows.Forms.DataFormats.WaveAudio]")
        Else
            MsgBox("Clipboard content is    NOT      compatible with data type  [System.Windows.Forms.DataFormats.WaveAudio]")
        End If

        If myDataObject.GetDataPresent(System.Windows.Forms.DataFormats.Html) Then
            MsgBox("Clipboard content is compatible with data type [System.Windows.Forms.DataFormats.Html]")
        Else
            MsgBox("Clipboard content is    NOT      compatible with data type  [System.Windows.Forms.DataFormats.Html]")
        End If

        If myDataObject.GetDataPresent(System.Windows.Forms.DataFormats.Rtf) Then
            MsgBox("Clipboard content is compatible with data type [System.Windows.Forms.DataFormats.Rtf]")
        Else
            MsgBox("Clipboard content is    NOT      compatible with data type  [System.Windows.Forms.DataFormats.Rtf]")
        End If

        If myDataObject.GetDataPresent(System.Windows.Forms.DataFormats.Bitmap) Then
            MsgBox("Clipboard content is compatible with data type [System.Windows.Forms.DataFormats.Bitmap]")
        Else
            MsgBox("Clipboard content is    NOT      compatible with data type  [System.Windows.Forms.DataFormats.Bitmap]")
        End If

        If myDataObject.GetDataPresent(System.Windows.Forms.DataFormats.PenData) Then
            MsgBox("Clipboard content is compatible with data type [System.Windows.Forms.DataFormats.PenData]")
        Else
            MsgBox("Clipboard content is    NOT      compatible with data type  [System.Windows.Forms.DataFormats.PenData]")
        End If

        If myDataObject.GetDataPresent(System.Windows.Forms.DataFormats.StringFormat) Then
            MsgBox("Clipboard content is compatible with data type [System.Windows.Forms.DataFormats.StringFormat]")
        Else
            MsgBox("Clipboard content is    NOT      compatible with data type  [System.Windows.Forms.DataFormats.StringFormat]")
        End If

        If myDataObject.GetDataPresent(System.Windows.Forms.DataFormats.Serializable) Then
            MsgBox("Clipboard content is compatible with data type [System.Windows.Forms.DataFormats.Serializable]")
        Else
            MsgBox("Clipboard content is    NOT      compatible with data type  [System.Windows.Forms.DataFormats.Serializable]")
        End If

        If myDataObject.GetDataPresent(System.Windows.Forms.DataFormats.Riff) Then
            MsgBox("Clipboard content is compatible with data type [System.Windows.Forms.DataFormats.Riff]")
        Else
            MsgBox("Clipboard content is    NOT      compatible with data type  [System.Windows.Forms.DataFormats.Riff]")
        End If
        ' End:    Reusable code block (2005 09 01 PM 10 26 20)

    End Function ' GetStringInClipboard
    ' -   -   -   -   -   -   -   -   -   -   -   -   -
    ' -   -   -   -   -   -   -   -   -   -   -   -   -
    Public Sub PasteStringToClipboard(ByVal AnyString As String)
        ' (本段程式之目的) Purpose:
        '     Paste string to Clipboard.
        ' (本段程式是否已經在被使用中) In use: Yes
        ' (重要等級) Importance rating:  80%
        ' (再利用的可能性) Chances of reuse:  90%
        ' (程式撰寫的進度) Developing: 100% (Mandatory)
        ' (程式堪用的程度) Workable: 80% (Threshold at 80%)
        ' (程式的測試程度) Code tested: 80% (max 99%)
        ' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        ' (修改程式的日期) Revision Date: (2004 12 06 PM 03 17 30)
        ' (修改程式的人員) Revised by: WeiJin Tang (湯偉晉)
        '     ok
        ' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

        Clipboard.SetDataObject(AnyString, True)

    End Sub ' PasteStringToClipboard
    ' -   -   -   -   -   -   -   -   -   -   -   -   -
    ' -   -   -   -   -   -   -   -   -   -   -   -   -
    Public Function GetStandardDateStamp_used_on_PDA() As String
        ' (本段程式之目的) Purpose:
        '     Return a time stamp like
        '               "2008-04-03"
        '     which is the default date stamp used on a PDA.
        '
        ' (本段程式是否已經在被使用中) In use: Yes
        ' (程式撰寫的進度) Developing: 100% (Mandatory)
        ' (程式堪用的程度) Workable: 80% (Threshold at 80%)
        ' (程式的測試程度) Code tested: 80% (max 99%)
        ' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        ' (修改程式的日期) Revision Date: (2008 04 03 PM 04 42 35)
        ' (修改程式的人員) Revised by: WeiJin Tang (湯偉晉)
        '     OK
        ' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

        Dim ThisMoment As Date
        ThisMoment = Now.Today

        Dim Y As String
        Dim M As String
        Dim D As String
        Y = ThisMoment.Year.ToString.PadLeft(4, "0"c)
        M = ThisMoment.Month.ToString.PadLeft(2, "0"c)
        D = ThisMoment.Day.ToString.PadLeft(2, "0"c)

        Return Y & "-" & M & "-" & D

    End Function ' GetStandardDateStamp_used_on_PDA
    ' -   -   -   -   -   -   -   -   -   -   -   -   -
    ' -   -   -   -   -   -   -   -   -   -   -   -   -

End Module ' Tools_for_WJAtTSINT2008

' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '
' ' ' ' ' ' ' ' ' ' ' ' '  [2008_08_10_MM_12_13_29]  ' ' ' ' ' ' ' ' ' ' ' ' ' '
' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '
' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '

沒有留言: