Add Keyboard and Mouse (Main) control panel application.

svn path=/trunk/; revision=11474
This commit is contained in:
Eric Kohl 2004-10-30 12:36:14 +00:00
parent b2a213a80c
commit 92ac842d73
11 changed files with 512 additions and 0 deletions

View file

@ -0,0 +1,8 @@
*.coff
*.cpl
*.d
*.a
*.o
*.sym
*.map
*.tmp

View file

@ -0,0 +1,111 @@
/*
* ReactOS
* Copyright (C) 2004 ReactOS Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: keyboard.c,v 1.1 2004/10/30 12:35:16 ekohl Exp $
*
* PROJECT: ReactOS Main Control Panel
* FILE: lib/cpl/main/keyboard.c
* PURPOSE: Keyboard Control Panel
* PROGRAMMER: Eric Kohl
*/
#include <windows.h>
#include <commctrl.h>
#include <prsht.h>
#include <cpl.h>
#include "main.h"
#include "resource.h"
/* Property page dialog callback */
static INT_PTR CALLBACK
Page1Proc(HWND hwndDlg,
UINT uMsg,
WPARAM wParam,
LPARAM lParam)
{
switch(uMsg)
{
case WM_INITDIALOG:
break;
}
return FALSE;
}
/* Property page dialog callback */
static INT_PTR CALLBACK
Page2Proc(HWND hwndDlg,
UINT uMsg,
WPARAM wParam,
LPARAM lParam)
{
switch(uMsg)
{
case WM_INITDIALOG:
break;
}
return FALSE;
}
/* Property page dialog callback */
static INT_PTR CALLBACK
Page3Proc(HWND hwndDlg,
UINT uMsg,
WPARAM wParam,
LPARAM lParam)
{
switch(uMsg)
{
case WM_INITDIALOG:
break;
}
return FALSE;
}
LONG APIENTRY
KeyboardApplet(HWND hwnd, UINT uMsg, LONG wParam, LONG lParam)
{
PROPSHEETPAGE psp[3];
PROPSHEETHEADER psh;
TCHAR Caption[256];
LoadString(hApplet, IDS_CPLNAME_2, Caption, sizeof(Caption) / sizeof(TCHAR));
ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
psh.dwSize = sizeof(PROPSHEETHEADER);
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_PROPTITLE;
psh.hwndParent = NULL;
psh.hInstance = hApplet;
psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDC_CPLICON_1));
psh.pszCaption = Caption;
psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
psh.nStartPage = 0;
psh.ppsp = psp;
InitPropSheetPage(&psp[0], IDD_PROPPAGE1, Page1Proc);
InitPropSheetPage(&psp[1], IDD_PROPPAGE2, Page2Proc);
InitPropSheetPage(&psp[2], IDD_PROPPAGE3, Page3Proc);
return (LONG)(PropertySheet(&psh) != -1);
}
/* EOF */

116
reactos/lib/cpl/main/main.c Normal file
View file

@ -0,0 +1,116 @@
/*
* ReactOS
* Copyright (C) 2004 ReactOS Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: main.c,v 1.1 2004/10/30 12:35:16 ekohl Exp $
*
* PROJECT: ReactOS Sample Control Panel
* FILE: lib/cpl/main/main.c
* PURPOSE: ReactOS Main Control Panel
* PROGRAMMER: Eric Kohl
* UPDATE HISTORY:
* 05-01-2004 Created
*/
#include <windows.h>
#include <commctrl.h>
#include <cpl.h>
#include "main.h"
#include "resource.h"
#define NUM_APPLETS (2)
HINSTANCE hApplet = 0;
/* Applets */
APPLET Applets[NUM_APPLETS] =
{
{IDC_CPLICON_1, IDS_CPLNAME_1, IDS_CPLDESCRIPTION_1, MouseApplet},
{IDC_CPLICON_2, IDS_CPLNAME_2, IDS_CPLDESCRIPTION_2, KeyboardApplet}
};
VOID
InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC DlgProc)
{
ZeroMemory(psp, sizeof(PROPSHEETPAGE));
psp->dwSize = sizeof(PROPSHEETPAGE);
psp->dwFlags = PSP_DEFAULT;
psp->hInstance = hApplet;
psp->pszTemplate = MAKEINTRESOURCE(idDlg);
psp->pfnDlgProc = DlgProc;
}
/* Control Panel Callback */
LONG CALLBACK
CPlApplet(HWND hwndCpl,
UINT uMsg,
LPARAM lParam1,
LPARAM lParam2)
{
switch(uMsg)
{
case CPL_INIT:
return TRUE;
case CPL_GETCOUNT:
return NUM_APPLETS;
case CPL_INQUIRE:
{
CPLINFO *CPlInfo = (CPLINFO*)lParam2;
UINT uAppIndex = (UINT)lParam1;
CPlInfo->lData = 0;
CPlInfo->idIcon = Applets[uAppIndex].idIcon;
CPlInfo->idName = Applets[uAppIndex].idName;
CPlInfo->idInfo = Applets[uAppIndex].idDescription;
break;
}
case CPL_DBLCLK:
{
UINT uAppIndex = (UINT)lParam1;
Applets[uAppIndex].AppletProc(hwndCpl, uMsg, lParam1, lParam2);
break;
}
}
return FALSE;
}
BOOL STDCALL
DllMain(HINSTANCE hinstDLL,
DWORD dwReason,
LPVOID lpReserved)
{
switch(dwReason)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
hApplet = hinstDLL;
break;
}
return TRUE;
}

View file

@ -0,0 +1,6 @@
LIBRARY main.cpl
EXPORTS
CPlApplet@16
; EOF

View file

@ -0,0 +1,37 @@
#ifndef __CPL_MAIN_H
#define __CPL_MAIN_H
//typedef LONG (CALLBACK *APPLET_PROC)(VOID);
typedef struct _APPLET
{
UINT idIcon;
UINT idName;
UINT idDescription;
APPLET_PROC AppletProc;
} APPLET, *PAPPLET;
extern HINSTANCE hApplet;
/* keyboard.c */
LONG APIENTRY
KeyboardApplet(HWND hwnd, UINT uMsg, LONG wParam, LONG lParam);
/* main.c */
VOID
InitPropSheetPage(PROPSHEETPAGE *psp,
WORD idDlg,
DLGPROC DlgProc);
/* mouse.c */
LONG APIENTRY
MouseApplet(HWND hwnd, UINT uMsg, LONG wParam, LONG lParam);
#endif /* __CPL_MAIN_H */
/* EOF */

View file

@ -0,0 +1,49 @@
/* $Id: main.rc,v 1.1 2004/10/30 12:35:16 ekohl Exp $ */
#include <defines.h>
#include "resource.h"
#define REACTOS_VERSION_DLL
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS Sample Control Panel\0"
#define REACTOS_STR_INTERNAL_NAME "main\0"
#define REACTOS_STR_ORIGINAL_FILENAME "main.cpl\0"
#include <reactos/version.rc>
IDC_CPLICON_1 ICON "resources/mouse.ico"
IDC_CPLICON_2 ICON "resources/keyboard.ico"
LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
IDD_PROPPAGE1 DIALOGEX 0, 0, 246, 228
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Property Page 1"
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "Property Page 1",-1,73,74,90,8
END
IDD_PROPPAGE2 DIALOGEX 0, 0, 246, 228
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Property Page 2"
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "Property Page 2",-1,73,74,90,8
END
IDD_PROPPAGE3 DIALOGEX 0, 0, 246, 228
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Property Page 3"
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "Property Page 3",-1,73,74,90,8
END
STRINGTABLE
BEGIN
IDS_CPLNAME_1 "Mouse"
IDS_CPLDESCRIPTION_1 "Changes mouse settings."
IDS_CPLNAME_2 "Keyboard"
IDS_CPLDESCRIPTION_2 "Changes keyboard settings."
END

View file

@ -0,0 +1,50 @@
# $Id: makefile,v 1.1 2004/10/30 12:35:16 ekohl Exp $
PATH_TO_TOP = ../../..
TARGET_TYPE = dynlink
TARGET_EXTENSION = .cpl
TARGET_NAME = main
TARGET_INSTALLDIR = system32
TARGET_BASE = 0x75970000
TARGET_CFLAGS = \
-D_WIN32_IE=0x0600 \
-D_WIN32_WINNT=0x0501 \
-D__USE_W32API \
-I./include \
-DUNICODE \
-D_UNICODE \
-D__REACTOS__ \
-Wall \
-Werror \
-fno-builtin
TARGET_LFLAGS = -nostartfiles
TARGET_SDKLIBS = kernel32.a user32.a comctl32.a
TARGET_GCCLIBS = gcc
TARGET_PCH =
TARGET_CLEAN =
TARGET_OBJECTS = keyboard.o main.o mouse.o
DEP_OBJECTS = $(TARGET_OBJECTS)
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk
include $(TOOLS_PATH)/depend.mk
%/TAGS:
etags -o $(@D)/TAGS $(@D)/\*.c
etags: ./TAGS

View file

@ -0,0 +1,115 @@
/*
* ReactOS
* Copyright (C) 2004 ReactOS Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: mouse.c,v 1.1 2004/10/30 12:35:16 ekohl Exp $
*
* PROJECT: ReactOS Main Control Panel
* FILE: lib/cpl/main/mouse.c
* PURPOSE: Mouse Control Panel
* PROGRAMMER: Eric Kohl
*/
#include <windows.h>
#include <commctrl.h>
#include <cpl.h>
#include "main.h"
#include "resource.h"
/* Property page dialog callback */
static INT_PTR CALLBACK
Page1Proc(
HWND hwndDlg,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
)
{
switch(uMsg)
{
case WM_INITDIALOG:
break;
}
return FALSE;
}
/* Property page dialog callback */
static INT_PTR CALLBACK
Page2Proc(
HWND hwndDlg,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
)
{
switch(uMsg)
{
case WM_INITDIALOG:
break;
}
return FALSE;
}
/* Property page dialog callback */
static INT_PTR CALLBACK
Page3Proc(
HWND hwndDlg,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
)
{
switch(uMsg)
{
case WM_INITDIALOG:
break;
}
return FALSE;
}
LONG APIENTRY
MouseApplet(HWND hwnd, UINT uMsg, LONG lParam1, LONG lParam2)
{
PROPSHEETPAGE psp[3];
PROPSHEETHEADER psh;
TCHAR Caption[256];
LoadString(hApplet, IDS_CPLNAME_1, Caption, sizeof(Caption) / sizeof(TCHAR));
ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
psh.dwSize = sizeof(PROPSHEETHEADER);
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_PROPTITLE;
psh.hwndParent = NULL;
psh.hInstance = hApplet;
psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDC_CPLICON_1));
psh.pszCaption = Caption;
psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
psh.nStartPage = 0;
psh.ppsp = psp;
InitPropSheetPage(&psp[0], IDD_PROPPAGE1, Page1Proc);
InitPropSheetPage(&psp[1], IDD_PROPPAGE2, Page2Proc);
InitPropSheetPage(&psp[2], IDD_PROPPAGE3, Page3Proc);
return (LONG)(PropertySheet(&psh) != -1);
}
/* EOF */

View file

@ -0,0 +1,20 @@
#ifndef __CPL_RESOURCE_H
#define __CPL_RESOURCE_H
#define IDC_CPLICON_1 1
#define IDC_CPLICON_2 2
#define IDD_PROPPAGE1 100
#define IDD_PROPPAGE2 101
#define IDD_PROPPAGE3 102
#define IDS_CPLNAME_1 1000
#define IDS_CPLDESCRIPTION_1 1001
#define IDS_CPLNAME_2 1002
#define IDS_CPLDESCRIPTION_2 1003
#endif /* __CPL_RESOURCE_H */
/* EOF */

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB