' Executing Control Panel applets from Visual Basic. ' Copyright (c) 2002 Nir Sofer ' ' Перевод на язык LangMF в 2011 'Обявляем все аплеты для Панели управления: Declare Function CPlApplet_Desk Lib "desk.cpl" Alias "CPlApplet" _ (ByVal hwndCPl As Long, ByVal uMsg As Long, ByVal lParam1 As Long, ByVal lParam2 As Long) As Long Declare Function CPlApplet_Intl Lib "intl.cpl" Alias "CPlApplet" _ (ByVal hwndCPl As Long, ByVal uMsg As Long, ByVal lParam1 As Long, ByVal lParam2 As Long) As Long Declare Function CPlApplet_MMSys Lib "mmsys.cpl" Alias "CPlApplet" _ (ByVal hwndCPl As Long, ByVal uMsg As Long, ByVal lParam1 As Long, ByVal lParam2 As Long) As Long Declare Function CPlApplet_Bth Lib "bthprops.cpl" Alias "CPlApplet" _ (ByVal hwndCPl As Long, ByVal uMsg As Long, ByVal lParam1 As Long, ByVal lParam2 As Long) As Long Declare Function CPlApplet_AppWiz Lib "appwiz.cpl" Alias "CPlApplet" _ (ByVal hwndCPl As Long, ByVal uMsg As Long, ByVal lParam1 As Long, ByVal lParam2 As Long) As Long Declare Function CPlApplet_InetCpl Lib "inetcpl.cpl" Alias "CPlApplet" _ (ByVal hwndCPl As Long, ByVal uMsg As Long, ByVal lParam1 As Long, ByVal lParam2 As Long) As Long Declare Function CPlApplet_Telephon Lib "telephon.cpl" Alias "CPlApplet" _ (ByVal hwndCPl As Long, ByVal uMsg As Long, ByVal lParam1 As Long, ByVal lParam2 As Long) As Long Declare Function CPlApplet_TimeDate Lib "timedate.cpl" Alias "CPlApplet" _ (ByVal hwndCPl As Long, ByVal uMsg As Long, ByVal lParam1 As Long, ByVal lParam2 As Long) As Long Declare Function CPlApplet_TweakUI Lib "tweakui.cpl" Alias "CPlApplet" _ (ByVal hwndCPl As Long, ByVal uMsg As Long, ByVal lParam1 As Long, ByVal lParam2 As Long) As Long Declare Function CPlApplet_mlcfg32 Lib "mlcfg32.cpl" Alias "CPlApplet" _ (ByVal hwndCPl As Long, ByVal uMsg As Long, ByVal lParam1 As Long, ByVal lParam2 As Long) As Long Declare Function CPlApplet_Main Lib "main.cpl" Alias "CPlApplet" _ (ByVal hwndCPl As Long, ByVal uMsg As Long, ByVal lParam1 As Long, ByVal lParam2 As Long) As Long <#Module=mdlDemo> 'Константы панели управления: Const CPL_INIT = 1 Const CPL_GETCOUNT = 2 Const CPL_INQUIRE = 3 Const CPL_SELECT = 4 Const CPL_DBLCLK = 5 Const CPL_STOP = 6 Const CPL_EXIT = 7 Const CPL_NEWINQUIRE = 8 Type CPLINFO idIcon As Long idName As Long idInfo As Long lData As Long End Type Dim ci As CPLINFO Data = ci.lData '--------------------------------------- Sub Load(cmdLine) With form .scalemode = 3 .add "command",1 .command(1).caption="Bluetooth" .command(1).move 10,10,100,20 .add "command",2 .command(2).caption="Add/Remove" .command(2).move 10,40,100,20 .add "command",3 .command(3).caption="Date/Time" .command(3).move 10,70,100,20 .add "command",4 .command(4).caption="Dialing" .command(4).move 10,100,100,20 .add "command",5 .command(5).caption="Display" .command(5).move 120,10,100,20 .add "command",6 .command(6).caption="Internet" .command(6).move 120,40,100,20 .add "command",7 .command(7).caption="Keyboard" .command(7).move 120,70,100,20 .add "command",8 .command(8).caption="Mail" .command(8).move 120,100,100,20 .add "command",9 .command(9).caption="Mouse" .command(9).move 230,10,100,20 .add "command",10 .command(10).caption="Multimedia" .command(10).move 230,40,100,20 .add "command",11 .command(11).caption="Regional" .command(11).move 230,70,100,20 .add "command",12 .command(12).caption="Tweak UI" .command(12).move 230,100,100,20 .show End With End Sub <#Module> <#form=Form> Sub MainCplApplet(lParam1) If CPlApplet_Main(hWnd, CPL_INIT, 0, 0) <> 0 Then CPlApplet_Main hWnd, CPL_INQUIRE, lParam1, VarPtr(ci) CPlApplet_Main hWnd, CPL_DBLCLK, lParam1, Data CPlApplet_Main hWnd, CPL_STOP, 0, Data CPlApplet_Main hWnd, CPL_EXIT, 0, 0 End If End Sub 'Bluetooth Properties Sub Command1_Click() If CPlApplet_Bth(hWnd, CPL_INIT, 0, 0) <> 0 Then CPlApplet_Bth hWnd, CPL_INQUIRE, 0, VarPtr(ci) CPlApplet_Bth hWnd, CPL_DBLCLK, 0, Data CPlApplet_Bth hWnd, CPL_STOP, 0, Data CPlApplet_Bth hWnd, CPL_EXIT, 0, 0 End If End Sub 'Установка/Удаление программ Sub Command2_Click() If CPlApplet_AppWiz(hWnd, CPL_INIT, 0, 0) <> 0 Then CPlApplet_AppWiz hWnd, CPL_INQUIRE, 0, VarPtr(ci) CPlApplet_AppWiz hWnd, CPL_DBLCLK, 0, Data CPlApplet_AppWiz hWnd, CPL_STOP, 0, Data CPlApplet_AppWiz hWnd, CPL_EXIT, 0, 0 End If End Sub 'Настройка Даты/Время Sub Command3_Click() If CPlApplet_TimeDate(hWnd, CPL_INIT, 0, 0) <> 0 Then CPlApplet_TimeDate hWnd, CPL_INQUIRE, 0, VarPtr(ci) CPlApplet_TimeDate hWnd, CPL_DBLCLK, 0, Data CPlApplet_TimeDate hWnd, CPL_STOP, 0, Data CPlApplet_TimeDate hWnd, CPL_EXIT, 0, 0 End If End Sub 'Настройка модема Sub Command4_Click() If CPlApplet_Telephon(hWnd, CPL_INIT, 0, 0) <> 0 Then CPlApplet_Telephon hWnd, CPL_INQUIRE, 0, VarPtr(ci) CPlApplet_Telephon hWnd, CPL_DBLCLK, 0, Data CPlApplet_Telephon hWnd, CPL_STOP, 0, Data CPlApplet_Telephon hWnd, CPL_EXIT, 0, 0 End If End Sub 'Свойства экрана Sub Command5_Click() If CPlApplet_Desk(hWnd, CPL_INIT, 0, 0) <> 0 Then CPlApplet_Desk hWnd, CPL_INQUIRE, 0, VarPtr(ci) CPlApplet_Desk hWnd, CPL_DBLCLK, 0, Data CPlApplet_Desk hWnd, CPL_STOP, 0, Data CPlApplet_Desk hWnd, CPL_EXIT, 0, 0 End If End Sub 'Интернет Sub Command6_Click() If CPlApplet_InetCpl(hWnd, CPL_INIT, 0, 0) <> 0 Then CPlApplet_InetCpl hWnd, CPL_INQUIRE, 0, VarPtr(ci) CPlApplet_InetCpl hWnd, CPL_DBLCLK, 0, Data CPlApplet_InetCpl hWnd, CPL_STOP, 0, Data CPlApplet_InetCpl hWnd, CPL_EXIT, 0, 0 End If End Sub 'Свойсва клавиатуры Sub Command7_Click() MainCplApplet 1 End Sub 'Настройки почты Sub Command8_Click() If CPlApplet_mlcfg32(hWnd, CPL_INIT, 0, 0) <> 0 Then CPlApplet_mlcfg32 hWnd, CPL_INQUIRE, 0, VarPtr(ci) CPlApplet_mlcfg32 hWnd, CPL_DBLCLK, 0, Data CPlApplet_mlcfg32 hWnd, CPL_STOP, 0, Data CPlApplet_mlcfg32 hWnd, CPL_EXIT, 0, 0 End If End Sub 'Настройки мыши Sub Command9_Click() MainCplApplet 0 End Sub 'Настройки мультимедия Sub Command10_Click() If CPlApplet_MMSys(hWnd, CPL_INIT, 0, 0) <> 0 Then CPlApplet_MMSys hWnd, CPL_INQUIRE, 0, VarPtr(ci) CPlApplet_MMSys hWnd, CPL_DBLCLK, 0, Data CPlApplet_MMSys hWnd, CPL_STOP, 0, Data CPlApplet_MMSys hWnd, CPL_EXIT, 0, 0 End If End Sub 'Региональные настройки Sub Command11_Click() If CPlApplet_Intl(hWnd, CPL_INIT, 0, 0) <> 0 Then CPlApplet_Intl hWnd, CPL_INQUIRE, 0, VarPtr(ci) CPlApplet_Intl hWnd, CPL_DBLCLK, 0, Data CPlApplet_Intl hWnd, CPL_STOP, 0, Data CPlApplet_Intl hWnd, CPL_EXIT, 0, 0 End If End Sub 'Tweak UI Sub Command12_Click() If CPlApplet_TweakUI(hWnd, CPL_INIT, 0, 0) <> 0 Then CPlApplet_TweakUI hWnd, CPL_INQUIRE, 0, VarPtr(ci) CPlApplet_TweakUI hWnd, CPL_DBLCLK, 0, Data CPlApplet_TweakUI hWnd, CPL_STOP, 0, Data CPlApplet_TweakUI hWnd, CPL_EXIT, 0, 0 End If End Sub sub Form_Unload() endmf end sub <#Form>