● バージョン情報のウィンドウを表示する ●

バージョン情報のウィンドウ(ダイアログボックスと言った方が正解か?)を作るのが面倒なときは、ShellAbout API関数を使えばよい。

※※※ Windows 95 のバージョン情報 ※※※

※※※ Windows XP のバージョン情報 ※※※

Private Declare Function ShellAbout Lib "shell32.dll" Alias "ShellAboutA" (ByVal hWnd As Long, ByVal szApp As String, ByVal szOtherStuff As String, ByVal hIcon As Long) As Long

'---------------------------------------------------------------
' 関数名 : ShowVersionDialog
' 機  能 : バージョン情報ダイアログボックスを表示する
' 引  数 : (in)SrcForm … 呼び出し側フォーム
'           (in)AppTitle … アプリケーションのタイトル
'           (in)AppExplain … アプリケーションの説明や著作権
' 戻り値 : 1…正常終了   0…異常終了
'---------------------------------------------------------------
Public Function ShowVersionDialog(ByVal SrcForm As Form, ByVal AppTitle As String, _
                             ByVal AppExplain As String) As Long
    ShowVersionDialog = ShellAbout(SrcForm.hWnd, AppTitle, AppExplain, _
                                   SrcForm.Icon.Handle)
End Function

↓呼び出し側。

Private Sub Command1_Click()

    Dim AppTitle As String
    Dim AppExplain As String

    AppTitle = "バージョン情報表示サンプル"
    AppExplain = "これはバージョン情報を表示するサンプルコードです。" & _
                 vbCrLf & "Copyright (C) 2006 ilgg"

    Call ShowVersionDialog(Me, AppTitle, AppExplain)

End Sub

戻る