[INPUT] Use APPLET_PROC instead of a custom CPLAPPLET_PROC and simpify the code

This commit is contained in:
Eric Kohl 2020-03-15 15:10:14 +01:00
parent beeb989eaa
commit d1d9920b06
2 changed files with 6 additions and 11 deletions

View file

@ -10,14 +10,11 @@
#include "input.h"
#include <cpl.h>
#define NUM_APPLETS (1)
static LONG CALLBACK SystemApplet(VOID);
static LONG CALLBACK SystemApplet(HWND hwnd, UINT uMsg, LPARAM lParam1, LPARAM lParam2);
HINSTANCE hApplet = NULL;
static HWND hCPLWindow;
/* Applets */
static APPLET Applets[NUM_APPLETS] =
@ -57,7 +54,7 @@ PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
/* First Applet */
static LONG CALLBACK
SystemApplet(VOID)
SystemApplet(HWND hwnd, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
{
PROPSHEETPAGEW page[2];
PROPSHEETHEADERW header;
@ -69,7 +66,7 @@ SystemApplet(VOID)
header.dwSize = sizeof(header);
header.dwFlags = PSH_PROPSHEETPAGE | PSH_USEICONID | PSH_USECALLBACK;
header.hwndParent = hCPLWindow;
header.hwndParent = hwnd;
header.hInstance = hApplet;
header.pszIcon = MAKEINTRESOURCEW(IDI_KEY_SHORT_ICO);
header.pszCaption = szCaption;
@ -114,8 +111,7 @@ CPlApplet(HWND hwndCPl, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
break;
case CPL_DBLCLK:
hCPLWindow = hwndCPl;
Applets[i].AppletProc();
Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2);
break;
}

View file

@ -15,17 +15,16 @@
#include <windowsx.h>
#include <setupapi.h>
#include <strsafe.h>
#include <cpl.h>
#include "resource.h"
typedef LONG (CALLBACK *CPLAPPLET_PROC)(VOID);
typedef struct
{
int idIcon;
int idName;
int idDescription;
CPLAPPLET_PROC AppletProc;
APPLET_PROC AppletProc;
} APPLET, *PAPPLET;
extern HINSTANCE hApplet;