コントロールパネル内のメニューを開く          <TOP>


コントロールパネル内の各アイテムはCPLファイル形式でWindowsのシステムフォルダに保存されています。

それらを直接呼び出してみます。

CPlApplet_Desk 画面のプロパティ
CPlApplet_Intl 地域と言語のオプション
CPlApplet_MMSys サウンドとオーディオデバイスのプロパティ
CPlApplet_Access ユーザー補助のプロパティ
CPlApplet_AppWiz プログラムの追加と削除
CPlApplet_InetCpl インターネットのプロパティ
CPlApplet_Telephon 電話とモデムのオプション
CPlApplet_TimeDate 日付と時刻のプロパティ
CPlApplet_Main マウスのプロパティ・キーボードのプロパティ
 

 
'================================================================
'= コントロールパネル内のメニューを開く
'=    (CPlApplet.bas)
'================================================================
#include "Windows.bi"

Type CPLINFO
    idIcon As Long
    idName As Long
    idInfo As Long
    lData As Long
End Type

' 画面のプロパティ
Declare Function CPlApplet_Desk& Lib "desk.cpl" Alias "CPlApplet" (ByVal GethWndCPl&, ByVal uMsg&, ByVal lParam1&, ByVal lParam2&)

' 地域と言語のオプション
Declare Function CPlApplet_Intl& Lib "intl.cpl" Alias "CPlApplet" (ByVal GethWndCPl&, ByVal uMsg&, ByVal lParam1&, ByVal lParam2&)

' サウンドとオーディオデバイスのプロパティ
Declare Function CPlApplet_MMSys& Lib "mmsys.cpl" Alias "CPlApplet" (ByVal GethWndCPl&, ByVal uMsg&, ByVal lParam1&, ByVal lParam2&)

' ユーザー補助のプロパティ
Declare Function CPlApplet_Access& Lib "access.cpl" Alias "CPlApplet" (ByVal GethWndCPl&, ByVal uMsg&, ByVal lParam1&, ByVal lParam2&)

' プログラムの追加と削除
Declare Function CPlApplet_AppWiz& Lib "appwiz.cpl" Alias "CPlApplet" (ByVal GethWndCPl&, ByVal uMsg&, ByVal lParam1&, ByVal lParam2&)

' インターネットのプロパティ
Declare Function CPlApplet_InetCpl& Lib "inetcpl.cpl" Alias "CPlApplet" (ByVal GethWndCPl&, ByVal uMsg&, ByVal lParam1&, ByVal lParam2&)

' 電話とモデムのオプション
Declare Function CPlApplet_Telephon& Lib "telephon.cpl" Alias "CPlApplet" (ByVal GethWndCPl&, ByVal uMsg&, ByVal lParam1&, ByVal lParam2&)

' 日付と時刻のプロパティ
Declare Function CPlApplet_TimeDate& Lib "timedate.cpl" Alias "CPlApplet" (ByVal GethWndCPl&, ByVal uMsg&, ByVal lParam1&, ByVal lParam2&)

' マウスのプロパティ・キーボードのプロパティ
Declare Function CPlApplet_Main& Lib "main.cpl" Alias "CPlApplet" (ByVal GethWndCPl&, ByVal uMsg&, ByVal lParam1&, ByVal lParam2&)

#define CPL_INIT 1
#define CPL_GETCOUNT 2
#define CPL_INQUIRE 3
#define CPL_SELECT 4
#define CPL_DBLCLK 5
#define CPL_STOP 6
#define CPL_EXIT 7
#define CPL_NEWINQUIRE 8

Var Shared ci As CPLINFO

Var Shared Button(9) As Object

For i = 0 To 9
    Button(i).Attach GetDlgItem("Button" & Trim$(Str$(i + 1)))
    Button(i).SetFontSize 12
Next

'================================================================
'=
'================================================================
Declare Sub MainCplApplet(lParam1 As Long)
Sub MainCplApplet(lParam1 As Long)
    Var Ret As Long

    If CPlApplet_Main(GethWnd, CPL_INIT, 0, 0) <> 0 Then
        Ret = CPlApplet_Main(GethWnd, CPL_INQUIRE, lParam1, VarAdr(ci))
        Ret = CPlApplet_Main(GethWnd, CPL_DBLCLK, lParam1, ci.lData)
        Ret = CPlApplet_Main(GethWnd, CPL_STOP, 0, ci.lData)
        Ret = CPlApplet_Main(GethWnd, CPL_EXIT, 0, 0)
    End If
End Sub

'================================================================
'= 画面のプロパティ
'================================================================
Declare Sub Button1_on edecl ()
Sub Button1_on()
    Var Ret As Long

    If CPlApplet_Desk(GethWnd, CPL_INIT, 0, 0) <> 0 Then
        Ret = CPlApplet_Desk(GethWnd, CPL_INQUIRE, 0, VarAdr(ci))
        Ret = CPlApplet_Desk(GethWnd, CPL_DBLCLK, 0, ci.lData)
        Ret = CPlApplet_Desk(GethWnd, CPL_STOP, 0, ci.lData)
        Ret = CPlApplet_Desk(GethWnd, CPL_EXIT, 0, 0)
    End If
End Sub

'================================================================
'= サウンドとオーディオデバイスのプロパティ
'================================================================
Declare Sub Button2_on edecl ()
Sub Button2_on()
    Var Ret As Long

    If CPlApplet_MMSys(GethWnd, CPL_INIT, 0, 0) <> 0 Then
        Ret = CPlApplet_MMSys(GethWnd, CPL_INQUIRE, 0, VarAdr(ci))
        Ret = CPlApplet_MMSys(GethWnd, CPL_DBLCLK, 0, ci.lData)
        Ret = CPlApplet_MMSys(GethWnd, CPL_STOP, 0, ci.lData)
        Ret = CPlApplet_MMSys(GethWnd, CPL_EXIT, 0, 0)
    End If
End Sub

'================================================================
'= プログラムの追加と削除
'================================================================
Declare Sub Button3_on edecl ()
Sub Button3_on()
    Var Ret As Long

    If CPlApplet_AppWiz(GethWnd, CPL_INIT, 0, 0) <> 0 Then
        Ret = CPlApplet_AppWiz(GethWnd, CPL_INQUIRE, 0, VarAdr(ci))
        Ret = CPlApplet_AppWiz(GethWnd, CPL_DBLCLK, 0, ci.lData)
        Ret = CPlApplet_AppWiz(GethWnd, CPL_STOP, 0, ci.lData)
        Ret = CPlApplet_AppWiz(GethWnd, CPL_EXIT, 0, 0)
    End If
End Sub

'================================================================
'= 日付と時刻のプロパティ
'================================================================
Declare Sub Button4_on edecl ()
Sub Button4_on()
    Var Ret As Long

    If CPlApplet_TimeDate(GethWnd, CPL_INIT, 0, 0) <> 0 Then
        Ret = CPlApplet_TimeDate(GethWnd, CPL_INQUIRE, 0, VarAdr(ci))
        Ret = CPlApplet_TimeDate(GethWnd, CPL_DBLCLK, 0, ci.lData)
        Ret = CPlApplet_TimeDate(GethWnd, CPL_STOP, 0, ci.lData)
        Ret = CPlApplet_TimeDate(GethWnd, CPL_EXIT, 0, 0)
    End If
End Sub

'================================================================
'= マウスのプロパティ
'================================================================
Declare Sub Button5_on edecl ()
Sub Button5_on()

    MainCplApplet(0)
End Sub

'================================================================
'= 地域と言語のオプション
'================================================================
Declare Sub Button6_on edecl ()
Sub Button6_on()
    Var Ret As Long

    If CPlApplet_Intl(GethWnd, CPL_INIT, 0, 0) <> 0 Then
        Ret = CPlApplet_Intl(GethWnd, CPL_INQUIRE, 0, VarAdr(ci))
        Ret = CPlApplet_Intl(GethWnd, CPL_DBLCLK, 0, ci.lData)
        Ret = CPlApplet_Intl(GethWnd, CPL_STOP, 0, ci.lData)
        Ret = CPlApplet_Intl(GethWnd, CPL_EXIT, 0, 0)
    End If
End Sub

'================================================================
'= ユーザー補助のプロパティ
'================================================================
Declare Sub Button7_on edecl ()
Sub Button7_on()
    Var Ret As Long

    If CPlApplet_Access(GethWnd, CPL_INIT, 0, 0) <> 0 Then
        Ret = CPlApplet_Access(GethWnd, CPL_INQUIRE, 0, VarAdr(ci))
        Ret = CPlApplet_Access(GethWnd, CPL_DBLCLK, 0, ci.lData)
        Ret = CPlApplet_Access(GethWnd, CPL_STOP, 0, ci.lData)
        Ret = CPlApplet_Access(GethWnd, CPL_EXIT, 0, 0)
    End If
End Sub

'================================================================
'= インターネットのプロパティ
'================================================================
Declare Sub Button8_on edecl ()
Sub Button8_on()
    Var Ret As Long

    If CPlApplet_InetCpl(GethWnd, CPL_INIT, 0, 0) <> 0 Then
        Ret = CPlApplet_InetCpl(GethWnd, CPL_INQUIRE, 0, VarAdr(ci))
        Ret = CPlApplet_InetCpl(GethWnd, CPL_DBLCLK, 0, ci.lData)
        Ret = CPlApplet_InetCpl(GethWnd, CPL_STOP, 0, ci.lData)
        Ret = CPlApplet_InetCpl(GethWnd, CPL_EXIT, 0, 0)
    End If
End Sub

'================================================================
'= 電話とモデムのオプション
'================================================================
Declare Sub Button9_on edecl ()
Sub Button9_on()
    Var Ret As Long

    If CPlApplet_Telephon(GethWnd, CPL_INIT, 0, 0) <> 0 Then
        Ret = CPlApplet_Telephon(GethWnd, CPL_INQUIRE, 0, VarAdr(ci))
        Ret = CPlApplet_Telephon(GethWnd, CPL_DBLCLK, 0, ci.lData)
        Ret = CPlApplet_Telephon(GethWnd, CPL_STOP, 0, ci.lData)
        Ret = CPlApplet_Telephon(GethWnd, CPL_EXIT, 0, 0)
    End If
End Sub

'================================================================
'= キーボードのプロパティ
'================================================================
Declare Sub Button10_on edecl ()
Sub Button10_on()

    MainCplApplet(1)
End Sub

'================================================================
'=
'================================================================
While 1
    WaitEvent
Wend
Stop
End