The Windows XP Control Panel used cpl files to control various settings in the Windows XP Control Panel.
This is the makefile for the cpl files in the Windows XP source code.
1 2 3 4 | .NOTPARALLEL: world all clean install depend: @enterdir inetcpl ${MAKE} ${MFLAGS} $@ |
This is the source code for a cpl file, this is LANG.CPP – “Language” property page for InetCpl.
This section of the code does various things, such as maintaining a list of languages and a listing of processes.
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 | // GetInstallLanguage // // synopsis - borrowed this function from shlwapi. we can remove this // once we have it exported from shlwapi.dll // LANGID GetInstallLanguage(void) { static LANGID LangID = 0; TCHAR szISO639[3]; DWORD cb; if (0 == LangID) { cb = sizeof(szISO639); if (ERROR_SUCCESS == SHGetValue(HKEY_LOCAL_MACHINE, c_szInstall, c_szLocale, NULL, szISO639, &cb)) { int i; for (i = 0; i < ARRAYSIZE(c_ISO639); i++) { if (!StrCmpNI(szISO639, c_ISO639[i].ISO639, ARRAYSIZE(szISO639))) { LangID = c_ISO639[i].LangID; break; } } } } return LangID; } // CUILangList // // maintains the list of UI languages for user to choose // class CUILangList { public: CUILangList() {_iLangIdx = -1; lang = s_arryLangList; _nLangList = ARRAYSIZE(s_arryLangList); _fOffice9Installed = -1;}; void ValidateLangList(); BOOL IsValidLang(int idx) { return (idx < _nLangList) ? lang[idx].fValid: FALSE; }; int GetCurrentLangIdx(); void SetCurrentLangIdx(int idx); LPCTSTR GetCurrentLangName(); LPCTSTR GetLangNameOfIdx(int idx); WORD GetLangIdOfIdx(int idx) { return (idx < _nLangList) ? lang[idx].wlangid:0; }; UINT GetIds(int idx); int GetListSize() {return _nLangList;}; BOOL IsOffice9Installed(); static HRESULT GetLangList(HWND hdlg, CUILangList ** ppLangList); static HRESULT RemoveLangList(HWND hdlg); private: int _iLangIdx; int _nLangList; int _fOffice9Installed; LANGLIST *lang; }; // CShutDownProcInfo // // manages information about processes we want // to shutdown/restart. // typedef enum { PS_UNKNOWN=0, PS_CANDIDATE, PS_TO_BE_SHUTDOWN, PS_IGNORE, PS_SHUTDOWN_OK, PS_WAITING, PS_TO_BE_SHUTDOWN_WITH_NO_RELAUNCH, PS_SHUTDOWN_OK_NO_RELAUNCH_NEEDED, } PROCSTATE; class CShutDownProcInfo : public CProcessInfo { public: CShutDownProcInfo(HWND hdlgParent); ~CShutDownProcInfo(); HRESULT EnsureProcList(); HRESULT IncreaseProcList(); HRESULT NotifyShutDownToFolks(int *nProccess); HRESULT AddToProcList(HWND hwndShutDown); HRESULT WaitForOneProcess(int iProc); HRESULT WaitForFolksShutDown(); HRESULT GetRestartAppPath(LPTSTR szPath, int cchPath, int iProc); HRESULT RestartFolks(); static DWORD CALLBACK ShutDownThreadProc(void *pv); protected: typedef struct { DWORD dwPID; TCHAR szExeName[32]; PROCSTATE State; } PROCLIST; PROCLIST *_pProcList; int _nAlloced; int _iProcList; HWND _hdlgParent; BOOL _fAllShutDown; }; // this always fills '0' to empty digits // caller has to make sure sz has cdigit+1 of buffer void IntToHex(OUT LPTSTR sz, IN int cdigit, IN int value) { int i, idigit; if (sz && value > 0 && cdigit > 0) { // nul terminate the buffer sz[cdigit] = TEXT('\0'); for (i = cdigit-1; i >= 0; i--, value /= 16) { idigit = value%16; if (idigit < 10) sz[i] = (TCHAR)idigit + TEXT('0'); else sz[i] = (TCHAR)idigit - 10 + TEXT('A'); } } } |
And this is a .h file I found in the cpls/system folder. This is netid.h.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | /*++ Microsoft Confidential Copyright (c) 1992-1997 Microsoft Corporation All rights reserved Module Name: netid.h Abstract: Public declarations for the Network ID tab of the System Control Panel Applet --*/ #ifndef _SYSDM_NETID_H_ #define _SYSDM_NETID_H_ // // Public function prototypes // HPROPSHEETPAGE CreateNetIDPage( int, DLGPROC ); #endif // _SYSDM_NETID_H_ |
Very interesting.
Finally, the keyboard configuration cpl file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | /*++ Copyright (c) 1994-1998, Microsoft Corporation All rights reserved. Module Name: keybd.c Abstract: This module contains the main routines for the Keyboard applet. Revision History: --*/ // // Include Files. // #include "main.h" #include "rc.h" #include "applet.h" #include <regstr.h> #include <cplext.h> #include "util.h" #include <intlid.h> // // Constant Declarations. // #define MAX_PAGES 32 // limit on number of pages const HWPAGEINFO c_hpiKeybd = { // Keyboard device class { 0x4d36e96bL, 0xe325, 0x11ce, { 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 } }, // Keyboard troubleshooter command line IDS_KEYBD_TSHOOT, }; // // Global Variables. // // // Location of prop sheet hooks in the registry. // static const TCHAR sc_szRegKeybd[] = REGSTR_PATH_CONTROLSFOLDER TEXT("\\Keyboard"); // // Function Prototypes. // INT_PTR CALLBACK KeyboardSpdDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); //////////////////////////////////////////////////////////////////////////// // // _AddKeybdPropSheetPage // // Adds a property sheet page. // //////////////////////////////////////////////////////////////////////////// BOOL CALLBACK _AddKeybdPropSheetPage( HPROPSHEETPAGE hpage, LPARAM lParam) { PROPSHEETHEADER *ppsh = (PROPSHEETHEADER *)lParam; if (hpage && ppsh->nPages < MAX_PAGES) { ppsh->phpage[ppsh->nPages++] = hpage; return (TRUE); } return (FALSE); } //////////////////////////////////////////////////////////////////////////// // // KeybdApplet // //////////////////////////////////////////////////////////////////////////// int KeybdApplet( HINSTANCE instance, HWND parent, LPCTSTR cmdline) { HPROPSHEETPAGE rPages[MAX_PAGES]; PROPSHEETPAGE psp; PROPSHEETHEADER psh; HPSXA hpsxa; int Result; // // Make the initial page. // psh.dwSize = sizeof(psh); psh.dwFlags = PSH_PROPTITLE; psh.hwndParent = parent; psh.hInstance = instance; psh.pszCaption = MAKEINTRESOURCE(IDS_KEYBD_TITLE); psh.nPages = 0; if (cmdline) { psh.nStartPage = lstrlen(cmdline) ? StrToLong(cmdline) : 0; } else { psh.nStartPage = 0; } psh.phpage = rPages; // // Load any installed extensions. // hpsxa = SHCreatePropSheetExtArray(HKEY_LOCAL_MACHINE, sc_szRegKeybd, 8); // // Add the Speed page. // psp.dwSize = sizeof(psp); psp.dwFlags = PSP_DEFAULT; psp.hInstance = instance; psp.pszTemplate = MAKEINTRESOURCE(DLG_KEYBD_SPEED); psp.pfnDlgProc = KeyboardSpdDlg; psp.lParam = 0; _AddKeybdPropSheetPage(CreatePropertySheetPage(&psp), (LPARAM)&psh); // // Add the Hardware page (not replaceable). // _AddKeybdPropSheetPage(CreateHardwarePage(&c_hpiKeybd), (LPARAM)&psh); // // Add any extra pages that the extensions want in there. // if (hpsxa) { UINT cutoff = psh.nPages; UINT added = SHAddFromPropSheetExtArray( hpsxa, _AddKeybdPropSheetPage, (LPARAM)&psh ); if (psh.nStartPage >= cutoff) { psh.nStartPage += added; } } // // Invoke the Property Sheets. // switch (PropertySheet(&psh)) { case ( ID_PSRESTARTWINDOWS ) : { Result = APPLET_RESTART; break; } case ( ID_PSREBOOTSYSTEM ) : { Result = APPLET_REBOOT; break; } default : { Result = 0; break; } } // // Free any loaded extensions. // if (hpsxa) { SHDestroyPropSheetExtArray(hpsxa); } return (Result); } |
Another file in the inetcpl folder, this one is a debugging file.
1 2 3 4 5 6 7 8 9 | #include "inetcplp.h" // Define some things for debug.h // #define SZ_DEBUGINI "shellext.ini" #define SZ_DEBUGSECTION "inetcpl" #define SZ_MODULE "INETCPL" #define DECLARE_DEBUG #include <debug.h> |
And this one, this is a .h file. This is full of lexical tokens that name entities. This is just making it easy to refer to an object.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | /* * * IMPORTANT IMPORTANT IMPORTANT * */ //inetcore\urlmon\download\webjitres.h and shell\cpls\inetcpl\webjitres.h need to be IDENTICAL. #ifndef IDC_STATIC #define IDC_STATIC -1 #endif #define IDC_PROGRESS1 20000 #define IDC_CHECK1 20001 #define IDC_TEXT 20002 #define IDB_BITMAP1 20003 #define IDC_ICON1 20004 #define IDC_REMAINING_SIZE 20005 #define IDC_REMAINING_TIME 20006 #define IDS_DOWNLOAD_MSG 20201 #define IDS_ERROROCCURED 20202 #define IDS_JAVAVMJIT 20203 #define IDS_MEDIAPLAYER 20204 #define IDS_MISSINGCOMPONENTNAME 20301 #define IDS_REINSTALL 20302 #define IDS_DIALOGERROR 20303 #define IDS_DIALOGERROR2 20304 #define IDS_WARNINGINSTALLING 20305 #define IDS_ALTWARNINGDOWNLOAD 20306 #define IDS_ALTLANGUAGEDOWNLOAD 20307 #define IDS_DLFAIL 20308 #define IDS_INSTALLFAIL 20309 #define IDS_SERVERERROR 20310 #define IDS_UNKNOWNERROR 20311 #define IDS_PRODUCTUPDATES 20312 #define IDS_NOTCONNECTED 20313 #define IDS_CERTREFUSE 20314 #define IDS_IBUSY 20315 #define IDS_SECURITYHIGH 20316 #define IDS_SECURITYHIGH1 20317 #define IDS_SECURITYHIGH2 20318 #define IDS_SECURITYHIGH3 20319 #define IDS_OFFLINEALERT 20320 #define IDS_OFFLINEALERT2 20321 #define IDS_ADMINRIGHTS 20322 #define IDS_PLATFORMNOT 20323 #define IDS_INTERNAL 20324 #define IDS_SETUP 20325 #define IDS_PROCESS 20326 #define IDS_KILOBYTES_TEXT 20327 #define IDS_MEGABYTE_TEXT 20328 #define IDS_MINUTES_TEXT 20329 #define IDS_LessThanAMinute_TEXT 20330 #define IDS_hr1_TEXT 20331 #define IDS_hrs_TEXT 20332 #define IDS_SIZE 20333 #define IDS_TIME 20334 #define IDS_DOWNLOADING 20335 #define IDS_INSTALLING 20336 #define IDS_CHECKTRUST 20337 #define IDS_ERRORTITLE 20338 #define IDS_WEBJITHELPFILE 20339 #define IDD_WEBJIT 20440 #define IDDOWNLOAD 20441 |
And finally, this is the central header file for the Internet Control panel.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 | //********************************************************************* //* Microsoft Windows ** //* Copyright(c) Microsoft Corp., 1994-1995 ** //********************************************************************* // // INETCPL.H - central header file for Internet control panel // // HISTORY: // // 4/3/95 jeremys Created. // 6/25/96 t-ashlem condensed most header files into here // and other cleanup // #ifndef _INETCPL_H_ #define _INETCPL_H_ // Extra error checking (catches false errors, but useful to run every so often) #if 1 #pragma warning(3:4701) // local may be used w/o init #pragma warning(3:4702) // Unreachable code #pragma warning(3:4705) // Statement has no effect #pragma warning(3:4709) // command operator w/o index expression #endif // IEUNIX - removing warning for redefinition of STRICT #ifdef STRICT #undef STRICT #endif #define STRICT // Use strict handle types #define _SHELL32_ #define _CRYPT32_ // get DECLSPEC_IMPORT stuff right for Cert API #include <windows.h> #include <windowsx.h> #ifdef WINNT #include <shellapi.h> #endif // WINNT #include <shlobj.h> #include <commctrl.h> #include <comctrlp.h> #include <prsht.h> #include <cpl.h> #include <regstr.h> #include <ccstock.h> #include <validate.h> #include <debug.h> #include <mshtml.h> #include <wincrypt.h> #include <shfusion.h> // // All HKEYs are defined in this library: INETREG.LIB // please change/add any HKEYs to this library. Thanks! // #include <inetreg.h> // // Delay load DLLs' globals (see DLYLDDLL.C for details) // #include "dlylddll.h" #include <ratings.h> #include <commdlg.h> #include <olectl.h> #define _WINX32_ // get DECLSPEC_IMPORT stuff right for WININET API #include <urlmon.h> #include <wininet.h> #define _URLCACHEAPI_ // get DECLSPEC_IMPORT stuff right for wininet urlcache #ifdef WINNT #include <winineti.h> #endif // WINNT #define MAX_URL_STRING INTERNET_MAX_URL_LENGTH #include <shlwapi.h> #include "ieguidp.h" #include "oleacc.h" // Hack. winuserp.h and winable.h both define the flag WINEVENT_VALID. Since // no one in inetcpl uses this value we undef it to make the compile work. #undef WINEVENT_VALID #include "winable.h" #ifdef UNICODE #define POST_IE5_BETA #include <w95wraps.h> #endif #include <ras.h> #include <raserror.h> // // When a user clicks "reset web defaults" (on the programs tab), we may need // to update the url shown in the general tab. The general tab will check this // flag each time it's made active, and also when we hit ok or apply. // extern BOOL g_fReloadHomePage; /////////////////////////////////////////////////////////////////////// // // Structure Defintions and other typedefs // /////////////////////////////////////////////////////////////////////// typedef struct _RESTRICT_FLAGS { BOOL fGeneralTab; // Enable/disable "General" tab BOOL fSecurityTab; // Enable/disable "Security" tab BOOL fContentTab; // Enable/disable "Content" tab BOOL fConnectionsTab; // Enable/disable "Programs" tab BOOL fProgramsTab; // Enable/disable "Connections" tab BOOL fAdvancedTab; // Enable/disable "Advanced" tab BOOL fPrivacyTab; // Enable/disable "Privacy" tab BOOL fColors; // Colors section of Colors dialog BOOL fLinks; // Links section of Links dialog BOOL fFonts; // Fonts dialog BOOL fInternational; // Languages dialog BOOL fDialing; // Connection section of Connection tab (incl Settings subdialog) BOOL fProxy; // Proxy section of Connection tab (incl Advanced subdialog) BOOL fPlaces; // Home page section of General tab BOOL fHistory; // History section of General tab BOOL fMailNews; // Messaging section of the Programs tab BOOL fRatings; // Ratings buttons on Content tab BOOL fCertif; // Certificate section of Content tab BOOL fCertifPers; // Personal Cert button BOOL fCertifSite; // Site Cert button BOOL fCertifPub; // Publishers button BOOL fCache; // Temporary Internet Files section of General tab BOOL fAutoConfig; // Autoconig section of Connection tab BOOL fAccessibility; // Accessibility dialog BOOL fSecChangeSettings; // can't change level BOOL fSecAddSites; // can't add/remove sites BOOL fProfiles; // Profile Asst section of Content tab BOOL fFormSuggest; // AutoSuggest for forms on Content tab BOOL fFormPasswords; // AutoSuggest for form passwords on Content tab #ifdef WALLET BOOL fWallet; // MS Wallet section of Content tab #endif BOOL fConnectionWizard; // Connection Wizard section of Connection tab BOOL fCalContact; // Cal/Contact section of Programs tab BOOL fAdvanced; // Advanced page BOOL fCacheReadOnly; // Disables the delete and Settings buttons on the general panel BOOL fResetWebSettings; // Disables the "reset web settings" feature BOOL fDefault; // IE should check if it's the default browser BOOL fPrivacySettings; // Disables privacy settings #if 0 BOOL fMultimedia; // OBSOLETE: do not use BOOL fToolbar; // OBSOLETE: do not use BOOL fFileTypes; // OBSOLETE: do not use BOOL fActiveX; // OBSOLETE: do not use BOOL fActiveDownload; // OBSOLETE: do not use BOOL fActiveControls; // OBSOLETE: do not use BOOL fActiveScript; // OBSOLETE: do not use BOOL fActiveJava; // OBSOLETE: do not use BOOL fActiveSafety; // OBSOLETE: do not use BOOL fWarnings; // OBSOLETE: do not use BOOL fOther; // OBSOLETE: do not use BOOL fCrypto; // OBSOLETE: do not use BOOL fPlacesDefault; // OBSOLETE: do not use #endif } RESTRICT_FLAGS, *LPRESTRICT_FLAGS; typedef struct tagPROXYINFO { BOOL fEnable; BOOL fEditCurrentProxy; BOOL fOverrideLocal; BOOL fCustomHandler; TCHAR szProxy[MAX_URL_STRING]; TCHAR szOverride[MAX_URL_STRING]; } PROXYINFO, *LPPROXYINFO; // function pointer typedefs typedef DWORD (WINAPI * RASENUMENTRIESA) (LPSTR, LPSTR, LPRASENTRYNAMEA, LPDWORD, LPDWORD); typedef DWORD (WINAPI * RASENUMENTRIESW) (LPSTR, LPSTR, LPRASENTRYNAMEW, LPDWORD, LPDWORD); typedef DWORD (WINAPI * RASCREATEPHONEBOOKENTRYA) (HWND,LPSTR); typedef DWORD (WINAPI * RASEDITPHONEBOOKENTRYA) (HWND,LPSTR,LPSTR); typedef DWORD (WINAPI * RASEDITPHONEBOOKENTRYW) (HWND,LPWSTR,LPWSTR); typedef DWORD (WINAPI * RASGETENTRYDIALPARAMSA) (LPSTR, LPRASDIALPARAMSA, LPBOOL); typedef DWORD (WINAPI * RASGETENTRYDIALPARAMSW) (LPWSTR, LPRASDIALPARAMSW, LPBOOL); typedef DWORD (WINAPI * RASSETENTRYDIALPARAMSA) (LPSTR, LPRASDIALPARAMSA, BOOL); typedef DWORD (WINAPI * RASSETENTRYDIALPARAMSW) (LPWSTR, LPRASDIALPARAMSW, BOOL); typedef DWORD (WINAPI * RASDELETEENTRYA) (LPSTR, LPSTR); typedef DWORD (WINAPI * RASDELETEENTRYW) (LPWSTR, LPWSTR); typedef DWORD (WINAPI * RASGETENTRYPROPERTIESW) (LPCWSTR, LPCWSTR, LPRASENTRYW, LPDWORD, LPBYTE, LPDWORD); typedef DWORD (WINAPI * RNAACTIVATEENGINE) (void); typedef DWORD (WINAPI * RNADEACTIVATEENGINE) (void); typedef DWORD (WINAPI * RNADELETEENTRY) (LPSTR); /////////////////////////////////////////////////////////////////////// // // #defines // /////////////////////////////////////////////////////////////////////// #define IDC_NOTUSED ((unsigned) IDC_UNUSED) #define INM_UPDATE (WM_USER + 100) #define MAX_RES_LEN 255 #define SMALL_BUF_LEN 48 #define MAX_PATH_URL INTERNET_MAX_URL_LENGTH // NOTE: If you change these max values to something other than two digits, then you'll need to change // the call in connectn.cpp:DialupDlgInit which sets the limittext to 2 chars. #define DEF_AUTODISCONNECT_TIME 20 // default disconnect timeout is 20 mins #define MIN_AUTODISCONNECT_TIME 3 // minimum disconnect timeout is 3 mins #define MAX_AUTODISCONNECT_TIME 59 // maximum disconnect timeout is 59 mins // NOTE: If you change these max values to something other than two digits, then you'll need to change // the call in connectn.cpp:DialupDlgInit which sets the limittext to 2 chars. #define DEF_REDIAL_TRIES 10 #define MAX_REDIAL_TRIES 99 #define MIN_REDIAL_TRIES 1 #define CO_INTERNET 1 #define CO_INTRANET 2 // NOTE: If you change these max values to something other than two digits, then you'll need to change // the call in connectn.cpp:DialupDlgInit which sets the limittext to 2 chars. #define DEF_REDIAL_WAIT 5 #define MAX_REDIAL_WAIT 99 #define MIN_REDIAL_WAIT 5 #define MESSAGE_SIZE 255 #define BITMAP_WIDTH 16 #define BITMAP_HEIGHT 16 #define NUM_BITMAPS 5 #define MAX_KEY_NAME 64 #define COLOR_BG 0 // #define IDCHECKED 0 #define IDUNCHECKED 1 #define IDRADIOON 2 #define IDRADIOOFF 3 #define IDUNKNOWN 4 // #define SZDEFAULTBITMAP TEXT("DefaultBitmap") #define SZHT_RADIO TEXT("radio") #define SZHT_CHECKBOX TEXT("checkbox") // #define RET_CHECKBOX 0 #define RET_RADIO 1 // #define TREE_NEITHER 1 #define TREE_CHECKBOX 2 #define TREE_RADIO 4 // #define ARRAYSIZE(a) (sizeof(a)/sizeof(a[0])) // #define RCS_GETSTATE 1 #define RCS_SETSTATE 2 // Used with the various registry functions to detect when a value isn't // present #define VALUE_NOT_PRESENT -255 #define DEFAULT_CPL_PAGE -1 /////////////////////////////////////////////////////////////////////// // // Macros // /////////////////////////////////////////////////////////////////////// #define ENABLEAPPLY(hDlg) SendMessage( GetParent(hDlg), PSM_CHANGED, (WPARAM)hDlg, 0L ) #define SetPropSheetResult( hwnd, result ) SetWindowLongPtr(hwnd, DWLP_MSGRESULT, result) #undef DATASEG_READONLY #define DATASEG_READONLY ".rdata" #include "resource.h" #include "clsutil.h" /////////////////////////////////////////////////////////////////////// // // Read-Only Global Variables // /////////////////////////////////////////////////////////////////////// extern HINSTANCE ghInstance; // global module instance handle extern const DWORD mapIDCsToIDHs[]; // Help IDC to IDH map extern RESTRICT_FLAGS g_restrict; // var to restrict access to pages // functions in UTIL.C int MsgBox(HWND hWnd,UINT nMsgID,UINT uIcon,UINT uButtons); int MsgBoxSz(HWND hWnd,LPTSTR szText,UINT uIcon,UINT uButtons); int _cdecl MsgBoxParam(HWND hWnd,UINT nMsgID,UINT uIcon,UINT uButtons,...); LPTSTR LoadSz(UINT idString,LPTSTR lpszBuf,UINT cbBuf); BOOL EnableDlgItem(HWND hDlg,UINT uID,BOOL fEnable); VOID _cdecl DisplayErrorMessage(HWND hWnd,UINT uStrID,UINT uError, UINT uErrorClass,UINT uIcon,...); BOOL WarnFieldIsEmpty(HWND hDlg,UINT uCtrlID,UINT uStrID); VOID DisplayFieldErrorMsg(HWND hDlg,UINT uCtrlID,UINT uStrID); VOID GetErrorDescription(CHAR * pszErrorDesc,UINT cbErrorDesc, UINT uError,UINT uErrorClass); BOOL IsNTSPx(BOOL fEqualOrGreater, UINT uMajorVer, UINT uSPVer); // functions in RNACALL.C BOOL InitRNA(HWND hWnd); VOID DeInitRNA(); // structure for getting proc addresses of api functions typedef struct APIFCN { PVOID * ppFcnPtr; LPCSTR pszName; } APIFCN; #undef DATASEG_PERINSTANCE #define DATASEG_PERINSTANCE ".instance" #undef DATASEG_SHARED #define DATASEG_SHARED ".data" #define DATASEG_DEFAULT DATASEG_SHARED /////////////////////////////////////////////////////////////////////// // // Global Variables // /////////////////////////////////////////////////////////////////////// extern TCHAR g_szCurrentURL[INTERNET_MAX_URL_LENGTH]; extern HWND g_hwndUpdate; extern HWND g_hwndPropSheet; extern BOOL g_fChangedMime; /////////////////////////////////////////////////////////////////////// // // Dialog Procs // /////////////////////////////////////////////////////////////////////// INT_PTR CALLBACK AdvancedDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); INT_PTR CALLBACK TemporaryDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); INT_PTR CALLBACK ConnectionDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); INT_PTR CALLBACK General_DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); #ifdef UNIX BOOL CALLBACK AssocDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); BOOL CALLBACK AliasDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); #endif STDAPI_(INT_PTR) OpenFontsDialog(HWND hDlg, LPCSTR lpszKeyPath); STDAPI_(INT_PTR) OpenFontsDialogEx(HWND hDlg, LPCTSTR lpszKeyPath); INT_PTR CALLBACK FontsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); INT_PTR CALLBACK LanguageDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); INT_PTR CALLBACK PlacesDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam,LPARAM lParam); INT_PTR CALLBACK ProgramsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); INT_PTR CALLBACK ProxyDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); INT_PTR CALLBACK SafetyDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam,LPARAM lParam); INT_PTR CALLBACK SecurityDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam,LPARAM lParam); INT_PTR CALLBACK PrintDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); INT_PTR CALLBACK ContentDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); INT_PTR CALLBACK PrivacyDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); extern "C" void CALLBACK OpenLanguageDialog(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow); void KickLanguageDialog(HWND hDlg); /////////////////////////////////////////////////////////////////////// // // Dialog Proc Helpers // /////////////////////////////////////////////////////////////////////// // hunts down all windows and notifies them that they should update themselves void UpdateAllWindows(); // Windows Help helper void ResWinHelp( HWND hwnd, int ids, int id2, DWORD_PTR dwp); #ifdef UNIX void FindEditClient(LPTSTR szProtocol, HWND hwndDlg, int nIDDlgItem, LPTSTR szPath); BOOL EditScript(HKEY hkeyProtocol); BOOL FindScript(HWND hwndLable, HKEY hkeyProtocol); #define DIR_SEPR FILENAME_SEPARATOR #include <tchar.h> #include <platform.h> #include "unixstuff.h" inline BOOL HAS_DRIVE_LETTER(LPCTSTR pszPath) { ASSERT(pszPath!=NULL); return (pszPath[0] == '/'); } #else #define DIR_SEPR '\\' inline BOOL HAS_DRIVE_LETTER(LPCTSTR pszPath) { ASSERT(pszPath!=NULL); ASSERT(pszPath[0]!='\0'); return (pszPath[1] == ':'); } #endif // // We can be hung if we use sendMessage, and you can not use pointers with asynchronous // calls such as PostMessage or SendNotifyMessage. So we resort to using a timeout. // This function should be used to broadcast notification messages, such as WM_SETTINGCHANGE, // that pass pointers. // inline LRESULT SendBroadcastMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) { return SHSendMessageBroadcastW(uMsg, wParam, lParam); } // struct used in security.cpp as tls in a hack to get around bad dialog creation situation struct SECURITYINITFLAGS { DWORD dwZone; BOOL fForceUI; BOOL fDisableAddSites; SECURITYINITFLAGS() { dwZone = 0; fForceUI = FALSE; fDisableAddSites = FALSE; } }; LANGID INETCPL_GetUILanguage(); #endif // _INETCPL_H_ |
Plus this very interesting file. This dates to 1994…
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 | //********************************************************************* //* Microsoft Windows ** //* Copyright(c) Microsoft Corp., 1994-1995 ** //********************************************************************* // // CLSUTIL.H - header file for utility C++ classes // // HISTORY: // // 12/07/94 jeremys Borrowed from WNET common library // #ifndef _CLSUTIL_H_ #define _CLSUTIL_H_ /************************************************************************* NAME: BUFFER_BASE SYNOPSIS: Base class for transient buffer classes INTERFACE: BUFFER_BASE() Construct with optional size of buffer to allocate. Resize() Resize buffer to specified size. Returns TRUE if successful. QuerySize() Return the current size of the buffer in bytes. QueryPtr() Return a pointer to the buffer. PARENT: None USES: None CAVEATS: This is an abstract class, which unifies the interface of BUFFER, GLOBAL_BUFFER, etc. NOTES: In standard OOP fashion, the buffer is deallocated in the destructor. HISTORY: 03/24/93 gregj Created base class **************************************************************************/ class BUFFER_BASE { protected: UINT _cb; virtual BOOL Alloc( UINT cbBuffer ) = 0; virtual BOOL Realloc( UINT cbBuffer ) = 0; public: BUFFER_BASE() { _cb = 0; } // buffer not allocated yet ~BUFFER_BASE() { _cb = 0; } // buffer size no longer valid BOOL Resize( UINT cbNew ); UINT QuerySize() const { return _cb; }; }; #define GLOBAL_BUFFER BUFFER /************************************************************************* NAME: BUFFER SYNOPSIS: Wrapper class for new and delete INTERFACE: BUFFER() Construct with optional size of buffer to allocate. Resize() Resize buffer to specified size. Only works if the buffer hasn't been allocated yet. QuerySize() Return the current size of the buffer in bytes. QueryPtr() Return a pointer to the buffer. PARENT: BUFFER_BASE USES: operator new, operator delete CAVEATS: NOTES: In standard OOP fashion, the buffer is deallocated in the destructor. HISTORY: 03/24/93 gregj Created **************************************************************************/ class BUFFER : public BUFFER_BASE { protected: TCHAR *_lpBuffer; virtual BOOL Alloc( UINT cbBuffer ); virtual BOOL Realloc( UINT cbBuffer ); public: BUFFER( UINT cbInitial=0 ); ~BUFFER(); BOOL Resize( UINT cbNew ); TCHAR * QueryPtr() const { return (TCHAR *)_lpBuffer; } operator TCHAR *() const { return (TCHAR *)_lpBuffer; } }; class RegEntry { public: RegEntry(const TCHAR *pszSubKey, HKEY hkey = HKEY_CURRENT_USER, REGSAM regsam = KEY_READ|KEY_WRITE); ~RegEntry(); long GetError() { return _error; } long SetValue(const TCHAR *pszValue, const TCHAR *string); long SetValue(const TCHAR *pszValue, unsigned long dwNumber); TCHAR * GetString(const TCHAR *pszValue, TCHAR *string, unsigned long length); long GetNumber(const TCHAR *pszValue, long dwDefault = 0); long DeleteValue(const TCHAR *pszValue); long FlushKey(); long MoveToSubKey(const TCHAR *pszSubKeyName); HKEY GetKey() { return _hkey; } private: HKEY _hkey; long _error; BOOL bhkeyValid; }; class RegEnumValues { public: RegEnumValues(RegEntry *pRegEntry); ~RegEnumValues(); long Next(); TCHAR * GetName() {return pchName;} DWORD GetType() {return dwType;} LPBYTE GetData() {return pbValue;} DWORD GetDataLength() {return dwDataLength;} long GetError() { return _error; } private: RegEntry * pRegEntry; DWORD iEnum; DWORD cEntries; TCHAR * pchName; LPBYTE pbValue; DWORD dwType; DWORD dwDataLength; DWORD cMaxValueName; DWORD cMaxData; LONG _error; }; /************************************************************************* NAME: WAITCURSOR SYNOPSIS: Sets the cursor to an hourclass until object is destructed **************************************************************************/ class WAITCURSOR { private: HCURSOR m_curOld; HCURSOR m_curNew; public: WAITCURSOR() { m_curNew = ::LoadCursor( NULL, IDC_WAIT ); m_curOld = ::SetCursor( m_curNew ); } ~WAITCURSOR() { ::SetCursor( m_curOld ); } }; /************************************************************************* NAME: CAccessibleWrapper SYNOPSIS: Sets the cursor to an hourclass until object is destructed **************************************************************************/ // Generic CAccessibleWrapper class - just calls through on all methods. // Add overriding behavior in classes derived from this. class CAccessibleWrapper: public IAccessible, public IOleWindow, public IEnumVARIANT { // We need to do our own refcounting for this wrapper object ULONG m_ref; // Need ptr to the IAccessible - also keep around ptrs to EnumVar and // OleWindow as part of this object, so we can filter those interfaces // and trap their QI's... // (We leave pEnumVar and OleWin as NULL until we need them) IAccessible * m_pAcc; IEnumVARIANT * m_pEnumVar; IOleWindow * m_pOleWin; public: CAccessibleWrapper( IAccessible * pAcc ); virtual ~CAccessibleWrapper(); // IUnknown // (We do our own ref counting) virtual STDMETHODIMP QueryInterface(REFIID riid, void** ppv); virtual STDMETHODIMP_(ULONG) AddRef(); virtual STDMETHODIMP_(ULONG) Release(); // IDispatch virtual STDMETHODIMP GetTypeInfoCount(UINT* pctinfo); virtual STDMETHODIMP GetTypeInfo(UINT itinfo, LCID lcid, ITypeInfo** pptinfo); virtual STDMETHODIMP GetIDsOfNames(REFIID riid, OLECHAR** rgszNames, UINT cNames, LCID lcid, DISPID* rgdispid); virtual STDMETHODIMP Invoke(DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pdispparams, VARIANT* pvarResult, EXCEPINFO* pexcepinfo, UINT* puArgErr); // IAccessible virtual STDMETHODIMP get_accParent(IDispatch ** ppdispParent); virtual STDMETHODIMP get_accChildCount(long* pChildCount); virtual STDMETHODIMP get_accChild(VARIANT varChild, IDispatch ** ppdispChild); virtual STDMETHODIMP get_accName(VARIANT varChild, BSTR* pszName); virtual STDMETHODIMP get_accValue(VARIANT varChild, BSTR* pszValue); virtual STDMETHODIMP get_accDescription(VARIANT varChild, BSTR* pszDescription); virtual STDMETHODIMP get_accRole(VARIANT varChild, VARIANT *pvarRole); virtual STDMETHODIMP get_accState(VARIANT varChild, VARIANT *pvarState); virtual STDMETHODIMP get_accHelp(VARIANT varChild, BSTR* pszHelp); virtual STDMETHODIMP get_accHelpTopic(BSTR* pszHelpFile, VARIANT varChild, long* pidTopic); virtual STDMETHODIMP get_accKeyboardShortcut(VARIANT varChild, BSTR* pszKeyboardShortcut); virtual STDMETHODIMP get_accFocus(VARIANT * pvarFocusChild); virtual STDMETHODIMP get_accSelection(VARIANT * pvarSelectedChildren); virtual STDMETHODIMP get_accDefaultAction(VARIANT varChild, BSTR* pszDefaultAction); virtual STDMETHODIMP accSelect(long flagsSel, VARIANT varChild); virtual STDMETHODIMP accLocation(long* pxLeft, long* pyTop, long* pcxWidth, long* pcyHeight, VARIANT varChild); virtual STDMETHODIMP accNavigate(long navDir, VARIANT varStart, VARIANT * pvarEndUpAt); virtual STDMETHODIMP accHitTest(long xLeft, long yTop, VARIANT * pvarChildAtPoint); virtual STDMETHODIMP accDoDefaultAction(VARIANT varChild); virtual STDMETHODIMP put_accName(VARIANT varChild, BSTR szName); virtual STDMETHODIMP put_accValue(VARIANT varChild, BSTR pszValue); // IEnumVARIANT virtual STDMETHODIMP Next(ULONG celt, VARIANT* rgvar, ULONG * pceltFetched); virtual STDMETHODIMP Skip(ULONG celt); virtual STDMETHODIMP Reset(void); virtual STDMETHODIMP Clone(IEnumVARIANT ** ppenum); // IOleWindow virtual STDMETHODIMP GetWindow(HWND* phwnd); virtual STDMETHODIMP ContextSensitiveHelp(BOOL fEnterMode); }; #endif // _CLSUTIL_H_ |
This section of code from the above file sets the Windows mouse cursor to an hourglass whilst you wait for an operation to complete…
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | /************************************************************************* NAME: WAITCURSOR SYNOPSIS: Sets the cursor to an hourclass until object is destructed **************************************************************************/ class WAITCURSOR { private: HCURSOR m_curOld; HCURSOR m_curNew; public: WAITCURSOR() { m_curNew = ::LoadCursor( NULL, IDC_WAIT ); m_curOld = ::SetCursor( m_curNew ); } ~WAITCURSOR() { ::SetCursor( m_curOld ); } }; /************************************************************************* NAME: CAccessibleWrapper SYNOPSIS: Sets the cursor to an hourclass until object is destructed **************************************************************************/ // Generic CAccessibleWrapper class - just calls through on all methods. // Add overriding behavior in classes derived from this. class CAccessibleWrapper: public IAccessible, public IOleWindow, public IEnumVARIANT { // We need to do our own refcounting for this wrapper object ULONG m_ref; // Need ptr to the IAccessible - also keep around ptrs to EnumVar and // OleWindow as part of this object, so we can filter those interfaces // and trap their QI's... // (We leave pEnumVar and OleWin as NULL until we need them) IAccessible * m_pAcc; IEnumVARIANT * m_pEnumVar; IOleWindow * m_pOleWin; public: CAccessibleWrapper( IAccessible * pAcc ); virtual ~CAccessibleWrapper(); // IUnknown // (We do our own ref counting) virtual STDMETHODIMP QueryInterface(REFIID riid, void** ppv); virtual STDMETHODIMP_(ULONG) AddRef(); virtual STDMETHODIMP_(ULONG) Release(); // IDispatch virtual STDMETHODIMP GetTypeInfoCount(UINT* pctinfo); virtual STDMETHODIMP GetTypeInfo(UINT itinfo, LCID lcid, ITypeInfo** pptinfo); virtual STDMETHODIMP GetIDsOfNames(REFIID riid, OLECHAR** rgszNames, UINT cNames, LCID lcid, DISPID* rgdispid); virtual STDMETHODIMP Invoke(DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pdispparams, VARIANT* pvarResult, EXCEPINFO* pexcepinfo, UINT* puArgErr); // IAccessible virtual STDMETHODIMP get_accParent(IDispatch ** ppdispParent); virtual STDMETHODIMP get_accChildCount(long* pChildCount); virtual STDMETHODIMP get_accChild(VARIANT varChild, IDispatch ** ppdispChild); virtual STDMETHODIMP get_accName(VARIANT varChild, BSTR* pszName); virtual STDMETHODIMP get_accValue(VARIANT varChild, BSTR* pszValue); virtual STDMETHODIMP get_accDescription(VARIANT varChild, BSTR* pszDescription); virtual STDMETHODIMP get_accRole(VARIANT varChild, VARIANT *pvarRole); virtual STDMETHODIMP get_accState(VARIANT varChild, VARIANT *pvarState); virtual STDMETHODIMP get_accHelp(VARIANT varChild, BSTR* pszHelp); virtual STDMETHODIMP get_accHelpTopic(BSTR* pszHelpFile, VARIANT varChild, long* pidTopic); virtual STDMETHODIMP get_accKeyboardShortcut(VARIANT varChild, BSTR* pszKeyboardShortcut); virtual STDMETHODIMP get_accFocus(VARIANT * pvarFocusChild); virtual STDMETHODIMP get_accSelection(VARIANT * pvarSelectedChildren); virtual STDMETHODIMP get_accDefaultAction(VARIANT varChild, BSTR* pszDefaultAction); virtual STDMETHODIMP accSelect(long flagsSel, VARIANT varChild); virtual STDMETHODIMP accLocation(long* pxLeft, long* pyTop, long* pcxWidth, long* pcyHeight, VARIANT varChild); virtual STDMETHODIMP accNavigate(long navDir, VARIANT varStart, VARIANT * pvarEndUpAt); virtual STDMETHODIMP accHitTest(long xLeft, long yTop, VARIANT * pvarChildAtPoint); virtual STDMETHODIMP accDoDefaultAction(VARIANT varChild); virtual STDMETHODIMP put_accName(VARIANT varChild, BSTR szName); virtual STDMETHODIMP put_accValue(VARIANT varChild, BSTR pszValue); // IEnumVARIANT virtual STDMETHODIMP Next(ULONG celt, VARIANT* rgvar, ULONG * pceltFetched); virtual STDMETHODIMP Skip(ULONG celt); virtual STDMETHODIMP Reset(void); virtual STDMETHODIMP Clone(IEnumVARIANT ** ppenum); // IOleWindow virtual STDMETHODIMP GetWindow(HWND* phwnd); virtual STDMETHODIMP ContextSensitiveHelp(BOOL fEnterMode); }; |
We have all seen the Windows hourglass cursor for a very long time have we not?