A simple, small calculator placed discreetly near the Windows Taskbar or anywhere on the screen
0

Configure Feed

Select the types of activity you want to include in your feed.

Import original TaskbarCalculator DeskBand sources (baseline)

Original Windows DeskBand shell-extension implementation, imported as the
starting point before the Windows 11 system-tray migration.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Marco Maroni (Jul 14, 2026, 2:35 PM +0200) 0342d1ef

+3859
+63
.gitattributes
··· 1 + ############################################################################### 2 + # Set default behavior to automatically normalize line endings. 3 + ############################################################################### 4 + * text=auto 5 + 6 + ############################################################################### 7 + # Set default behavior for command prompt diff. 8 + # 9 + # This is need for earlier builds of msysgit that does not have it on by 10 + # default for csharp files. 11 + # Note: This is only used by command line 12 + ############################################################################### 13 + #*.cs diff=csharp 14 + 15 + ############################################################################### 16 + # Set the merge driver for project and solution files 17 + # 18 + # Merging from the command prompt will add diff markers to the files if there 19 + # are conflicts (Merging from VS is not affected by the settings below, in VS 20 + # the diff markers are never inserted). Diff markers may cause the following 21 + # file extensions to fail to load in VS. An alternative would be to treat 22 + # these files as binary and thus will always conflict and require user 23 + # intervention with every merge. To do so, just uncomment the entries below 24 + ############################################################################### 25 + #*.sln merge=binary 26 + #*.csproj merge=binary 27 + #*.vbproj merge=binary 28 + #*.vcxproj merge=binary 29 + #*.vcproj merge=binary 30 + #*.dbproj merge=binary 31 + #*.fsproj merge=binary 32 + #*.lsproj merge=binary 33 + #*.wixproj merge=binary 34 + #*.modelproj merge=binary 35 + #*.sqlproj merge=binary 36 + #*.wwaproj merge=binary 37 + 38 + ############################################################################### 39 + # behavior for image files 40 + # 41 + # image files are treated as binary by default. 42 + ############################################################################### 43 + #*.jpg binary 44 + #*.png binary 45 + #*.gif binary 46 + 47 + ############################################################################### 48 + # diff behavior for common document formats 49 + # 50 + # Convert binary document formats to text before diffing them. This feature 51 + # is only available from the command line. Turn it on by uncommenting the 52 + # entries below. 53 + ############################################################################### 54 + #*.doc diff=astextplain 55 + #*.DOC diff=astextplain 56 + #*.docx diff=astextplain 57 + #*.DOCX diff=astextplain 58 + #*.dot diff=astextplain 59 + #*.DOT diff=astextplain 60 + #*.pdf diff=astextplain 61 + #*.PDF diff=astextplain 62 + #*.rtf diff=astextplain 63 + #*.RTF diff=astextplain
+41
AboutDialog.cpp
··· 1 + // AboutDialog.cpp : implementation file 2 + // 3 + 4 + #include "stdafx.h" 5 + #include "AboutDialog.h" 6 + #include "afxdialogex.h" 7 + 8 + 9 + // CAboutDialog dialog 10 + 11 + IMPLEMENT_DYNAMIC(CAboutDialog, CDialogEx) 12 + 13 + CAboutDialog::CAboutDialog(CWnd* pParent /*=NULL*/) 14 + : CDialogEx(CAboutDialog::IDD, pParent) 15 + { 16 + 17 + } 18 + 19 + CAboutDialog::~CAboutDialog() 20 + { 21 + } 22 + 23 + void CAboutDialog::DoDataExchange(CDataExchange* pDX) 24 + { 25 + CDialogEx::DoDataExchange(pDX); 26 + } 27 + 28 + 29 + BEGIN_MESSAGE_MAP(CAboutDialog, CDialogEx) 30 + ON_BN_CLICKED(IDOK, &CAboutDialog::OnBnClickedOk) 31 + END_MESSAGE_MAP() 32 + 33 + 34 + // CAboutDialog message handlers 35 + 36 + 37 + void CAboutDialog::OnBnClickedOk() 38 + { 39 + // TODO: Add your control notification handler code here 40 + CDialogEx::OnOK(); 41 + }
+23
AboutDialog.h
··· 1 + #pragma once 2 + 3 + 4 + // CAboutDialog dialog 5 + 6 + class CAboutDialog : public CDialogEx 7 + { 8 + DECLARE_DYNAMIC(CAboutDialog) 9 + 10 + public: 11 + CAboutDialog(CWnd* pParent = NULL); // standard constructor 12 + virtual ~CAboutDialog(); 13 + 14 + // Dialog Data 15 + enum { IDD = IDD_ABOUT }; 16 + 17 + protected: 18 + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support 19 + 20 + DECLARE_MESSAGE_MAP() 21 + public: 22 + afx_msg void OnBnClickedOk(); 23 + };
+703
Calculator.cpp
··· 1 + #include "StdAfx.h" 2 + #include "calculator.h" 3 + #include <string> 4 + 5 + #ifdef __AFX_H__ 6 + #define new DEBUG_NEW 7 + #endif 8 + 9 + #pragma warning( disable: 4996 ) 10 + 11 + const int calc::m_max_num_oper=2; 12 + 13 + calc::calc() 14 + { 15 + m_oper = new double[m_max_num_oper]; 16 + m_current_oper=0; 17 + 18 + m_operator=undefined_oper; 19 + m_prev_state=undefined_state; 20 + m_state=init; 21 + m_currentBase = decimal; 22 + m_lastDecimalNumber = 0; 23 + } 24 + 25 + calc::~calc() 26 + { 27 + delete [] m_oper; 28 + } 29 + 30 + void calc::set_precision(unsigned int precision) 31 + { 32 + m_precision = precision; 33 + } 34 + 35 + unsigned int calc::get_precision() 36 + { 37 + return m_precision; 38 + } 39 + 40 + void calc::change_state(TCHAR newChar, LPCTSTR oldString, LPTSTR newString) 41 + { 42 + if ( (m_prev_state==undefined_state && m_state==init) || m_state == error ) 43 + _tcscpy(newString, CALC_STR_0); 44 + else 45 + _tcscpy(newString, oldString); 46 + 47 + m_prev_state=m_state; 48 + 49 + switch(m_prev_state) 50 + { 51 + case error: 52 + case init: 53 + switch(newChar) 54 + { 55 + case CALC_1: 56 + case CALC_2: 57 + case CALC_3: 58 + case CALC_4: 59 + case CALC_5: 60 + case CALC_6: 61 + case CALC_7: 62 + case CALC_8: 63 + case CALC_9: 64 + if( m_currentBase != hex ) 65 + m_state=first_oper; 66 + addChar(newString,newChar); 67 + break; 68 + case CALC_P: 69 + if( m_currentBase == decimal ) 70 + { 71 + m_state=first_oper; 72 + addChar(newString,newChar); 73 + } 74 + break; 75 + case CALC_A: 76 + case CALC_B: 77 + case CALC_C: 78 + case CALC_D: 79 + case CALC_E: 80 + case CALC_F: 81 + if( m_currentBase == hex ) 82 + addChar(newString, newChar); 83 + break; 84 + case CALC_0: 85 + if( m_currentBase != hex ) 86 + m_state=first_oper; 87 + else 88 + addChar(newString, newChar); 89 + break; 90 + case CALC_000: 91 + if( m_currentBase != hex ) 92 + m_state=first_oper; 93 + break; 94 + case CALC_RESET: 95 + m_state=init; 96 + m_current_oper=0; 97 + _tcscpy(newString, CALC_STR_0); 98 + break; 99 + //case CALC_X: 100 + // changeBase(newString); 101 + 102 + } 103 + break; 104 + case first_oper: 105 + //if( newChar != CALC_X ) 106 + // restoreDecimalBase(newString); 107 + switch(newChar) 108 + { 109 + case CALC_1: 110 + case CALC_2: 111 + case CALC_3: 112 + case CALC_4: 113 + case CALC_5: 114 + case CALC_6: 115 + case CALC_7: 116 + case CALC_8: 117 + case CALC_9: 118 + case CALC_0: 119 + case CALC_P: 120 + m_state=first_oper; 121 + addChar(newString,newChar); 122 + break; 123 + case CALC_000: 124 + m_state=first_oper; 125 + addString(newString,CALC_STR_000); 126 + break; 127 + case CALC_ADD: 128 + m_state=operation; 129 + m_operator=add; 130 + addOper(newString); 131 + break; 132 + case CALC_SUB: 133 + m_state=operation; 134 + m_operator=sub; 135 + addOper(newString); 136 + break; 137 + case CALC_MUL: 138 + m_state=operation; 139 + m_operator=mul; 140 + addOper(newString); 141 + break; 142 + case CALC_DIV: 143 + m_state=operation; 144 + m_operator=div; 145 + addOper(newString); 146 + break; 147 + case CALC_SQRT: 148 + m_state=result; 149 + m_operator=calc_sqrt; 150 + addOper(newString); 151 + calcResult(newString); 152 + break; 153 + case CALC_I: 154 + m_state=result; 155 + m_operator=inverse; 156 + addOper(newString); 157 + calcResult(newString); 158 + break; 159 + case CALC_RESET: 160 + m_state=init; 161 + m_current_oper=0; 162 + _tcscpy(newString,CALC_STR_0); 163 + break; 164 + case CALC_NEG: 165 + changeToNegative(newString); 166 + break; 167 + case CALC_EURO: 168 + case CALC_L: 169 + changeEuroLire(newString, newChar); 170 + break; 171 + //case CALC_X: 172 + // changeBase(newString); 173 + // break; 174 + } 175 + break; 176 + case operation: 177 + restoreDecimalBase(newString); 178 + switch(newChar) 179 + { 180 + case CALC_1: 181 + case CALC_2: 182 + case CALC_3: 183 + case CALC_4: 184 + case CALC_5: 185 + case CALC_6: 186 + case CALC_7: 187 + case CALC_8: 188 + case CALC_9: 189 + case CALC_0: 190 + case CALC_P: 191 + m_state=second_oper; 192 + _tcscpy(newString,CALC_STR_0); 193 + addChar(newString,newChar); 194 + break; 195 + case CALC_RESET: 196 + m_state=init; 197 + m_current_oper=0; 198 + _tcscpy(newString,CALC_STR_0); 199 + break; 200 + } 201 + break; 202 + case second_oper: 203 + //if( newChar != CALC_X ) 204 + // restoreDecimalBase(newString); 205 + switch(newChar) 206 + { 207 + case CALC_1: 208 + case CALC_2: 209 + case CALC_3: 210 + case CALC_4: 211 + case CALC_5: 212 + case CALC_6: 213 + case CALC_7: 214 + case CALC_8: 215 + case CALC_9: 216 + case CALC_0: 217 + case CALC_P: 218 + m_state=second_oper; 219 + addChar(newString,newChar); 220 + break; 221 + case CALC_000: 222 + m_state=second_oper; 223 + addString(newString,CALC_STR_000); 224 + break; 225 + case CALC_ADD: 226 + addOper(newString); 227 + calcResult(newString); 228 + m_state=operation; 229 + m_operator=add; 230 + addOper(newString); 231 + break; 232 + case CALC_SUB: 233 + addOper(newString); 234 + calcResult(newString); 235 + m_state=operation; 236 + m_operator=sub; 237 + addOper(newString); 238 + break; 239 + case CALC_MUL: 240 + addOper(newString); 241 + calcResult(newString); 242 + m_state=operation; 243 + m_operator=mul; 244 + addOper(newString); 245 + break; 246 + case CALC_DIV: 247 + addOper(newString); 248 + calcResult(newString); 249 + m_state=operation; 250 + m_operator=div; 251 + addOper(newString); 252 + break; 253 + case CALC_SQRT: 254 + addOper(newString); 255 + calcResult(newString); 256 + m_state=operation; 257 + m_operator=calc_sqrt; 258 + addOper(newString); 259 + break; 260 + case CALC_I: 261 + addOper(newString); 262 + calcResult(newString); 263 + m_state=operation; 264 + m_operator=inverse; 265 + addOper(newString); 266 + break; 267 + case CALC_TOT: 268 + m_state=result; 269 + addOper(newString); 270 + calcResult(newString); 271 + break; 272 + case CALC_PERC: 273 + { 274 + opertors oldOpertor = m_operator; 275 + double oldFirstOperator = m_oper[0]; 276 + 277 + m_operator = percent; 278 + addOper(newString); 279 + calcResult(newString); 280 + 281 + m_state = second_oper; 282 + m_oper[0] = oldFirstOperator; 283 + m_current_oper++; 284 + m_operator = oldOpertor; 285 + addOper(newString); 286 + } 287 + break; 288 + case CALC_RESET: 289 + m_state=init; 290 + m_current_oper=0; 291 + _tcscpy(newString,CALC_STR_0); 292 + break; 293 + case CALC_NEG: 294 + changeToNegative(newString); 295 + break; 296 + case CALC_EURO: 297 + case CALC_L: 298 + changeEuroLire(newString, newChar); 299 + break; 300 + //case CALC_X: 301 + // changeBase(newString); 302 + // break; 303 + } 304 + break; 305 + case result: 306 + //if( newChar != CALC_X ) 307 + // restoreDecimalBase(newString); 308 + switch(newChar) 309 + { 310 + case CALC_1: 311 + case CALC_2: 312 + case CALC_3: 313 + case CALC_4: 314 + case CALC_5: 315 + case CALC_6: 316 + case CALC_7: 317 + case CALC_8: 318 + case CALC_9: 319 + case CALC_P: 320 + case CALC_0: 321 + m_state=first_oper; 322 + _tcscpy(newString,CALC_STR_0); 323 + addChar(newString,newChar); 324 + break; 325 + case CALC_ADD: 326 + m_state=operation; 327 + m_operator=add; 328 + addOper(newString); 329 + break; 330 + case CALC_SUB: 331 + m_state=operation; 332 + m_operator=sub; 333 + addOper(newString); 334 + break; 335 + case CALC_MUL: 336 + m_state=operation; 337 + m_operator=mul; 338 + addOper(newString); 339 + break; 340 + case CALC_DIV: 341 + m_state=operation; 342 + m_operator=div; 343 + addOper(newString); 344 + break; 345 + case CALC_SQRT: 346 + m_state=result; 347 + m_operator=calc_sqrt; 348 + addOper(newString); 349 + calcResult(newString); 350 + break; 351 + case CALC_I: 352 + m_state=result; 353 + m_operator=inverse; 354 + addOper(newString); 355 + calcResult(newString); 356 + break; 357 + case CALC_RESET: 358 + m_state=init; 359 + m_current_oper=0; 360 + _tcscpy(newString,CALC_STR_0); 361 + break; 362 + case CALC_NEG: 363 + changeToNegative(newString); 364 + break; 365 + case CALC_EURO: 366 + case CALC_L: 367 + changeEuroLire(newString, newChar); 368 + break; 369 + //case CALC_X: 370 + // changeBase(newString); 371 + // break; 372 + } 373 + break; 374 + } 375 + } 376 + 377 + int calc::addChar(LPTSTR string, TCHAR c) 378 + { 379 + size_t len=_tcslen(string); 380 + 381 + if( len+1>MAX_LEN_RESULT ) 382 + goto exitOverflow; 383 + 384 + if( c==CALC_P && _tcschr(string,c)!=NULL ) 385 + goto exitSequenceError; 386 + 387 + if( len==1 && string[0]=='0' 388 + && c=='0' 389 + ) 390 + goto exitSequenceError; 391 + 392 + if( len==1 && string[0]=='0' 393 + && c!='0' 394 + && c!=CALC_P 395 + ) 396 + { 397 + len=0; 398 + string[0]='\0'; 399 + } 400 + 401 + string[len]=c; 402 + string[len+1]='\0'; 403 + 404 + return 1; 405 + 406 + exitSequenceError: 407 + return 0; 408 + 409 + exitOverflow: 410 + err(overflow, string); 411 + return 0; 412 + } 413 + 414 + int calc::addString(LPTSTR string, LPTSTR str2) 415 + { 416 + size_t len=_tcslen(string); 417 + size_t len2=_tcslen(str2); 418 + if( len+len2>MAX_LEN_RESULT ) 419 + goto exitOverflow; 420 + 421 + if( _tcscmp(str2,CALC_STR_P)==0 && _tcsstr(string,CALC_STR_P)!=NULL ) 422 + goto exitSequenceError; 423 + 424 + if( len==1 && string[0]=='0' 425 + && _tcscmp(str2,CALC_STR_0)==0 426 + ) 427 + goto exitSequenceError; 428 + 429 + if( len==1 && string[0]=='0' 430 + && _tcscmp(str2,CALC_STR_000)==0 431 + ) 432 + goto exitSequenceError; 433 + 434 + if( len==1 && string[0]=='0' 435 + && _tcscmp(str2,CALC_STR_0)!=0 436 + && _tcscmp(str2,CALC_STR_P)!=0 437 + ) 438 + string[0]='\0'; 439 + 440 + 441 + _tcscat(string,str2); 442 + return 1; 443 + 444 + exitSequenceError: 445 + return 0; 446 + 447 + exitOverflow: 448 + err(overflow, string); 449 + return 0; 450 + } 451 + 452 + int calc::addOper(LPTSTR string) 453 + { 454 + _ASSERT(m_current_oper<=m_max_num_oper); 455 + 456 + m_oper[m_current_oper]=_tstof(string); 457 + 458 + if( _tcscmp(string,CALC_STR_0)!=0 && m_oper[m_current_oper]==0) 459 + { 460 + err(overflow, string); 461 + return 0; 462 + } 463 + 464 + m_current_oper++; 465 + return 1; 466 + } 467 + 468 + int calc::calcResult(LPTSTR string) 469 + { 470 + double result=0; 471 + 472 + switch(m_operator) 473 + { 474 + case undefined_oper: 475 + goto exitSequenceError; 476 + case add: 477 + result=m_oper[0]+m_oper[1]; 478 + break; 479 + case sub: 480 + result=m_oper[0]-m_oper[1]; 481 + break; 482 + case div: 483 + if(m_oper[1]!=0) 484 + result=m_oper[0]/m_oper[1]; 485 + else 486 + goto exitDivisionByZero; 487 + break; 488 + case mul: 489 + result=m_oper[0]*m_oper[1]; 490 + break; 491 + case calc_sqrt: 492 + result = sqrt(m_oper[0]); 493 + break; 494 + case inverse: 495 + result = (1/m_oper[0]); 496 + break; 497 + case percent: 498 + result = (m_oper[1]*m_oper[0])/100; 499 + } 500 + 501 + TCHAR tmp_string[100]; 502 + _stprintf(tmp_string, L"%.*lf", (int)m_precision, (double)result); 503 + trimRigthDecimalZero(tmp_string); 504 + if(_tcslen(tmp_string)>MAX_LEN_RESULT) 505 + goto exitOverflow; 506 + else 507 + _tcscpy(string,tmp_string); 508 + 509 + m_current_oper=0; 510 + return 1; 511 + 512 + exitSequenceError: 513 + m_current_oper=0; 514 + return 0; 515 + 516 + exitOverflow: 517 + err(overflow, string); 518 + m_current_oper=0; 519 + return 0; 520 + 521 + exitDivisionByZero: 522 + err(division_by_zero, string); 523 + m_current_oper=0; 524 + return 0; 525 + } 526 + 527 + int calc::trimRigthDecimalZero(LPTSTR string) 528 + { 529 + if(_tcschr(string,CALC_P)==NULL) 530 + return 1; 531 + 532 + size_t i = _tcslen(string); 533 + 534 + i--; 535 + while(string[i]!=CALC_P && string[i]==CALC_0) 536 + { 537 + string[i]='\0'; 538 + i--; 539 + } 540 + 541 + if(string[i]==CALC_P) 542 + string[i]='\0'; 543 + 544 + return 1; 545 + } 546 + 547 + 548 + void calc::err(int errorCode, LPTSTR string) 549 + { 550 + switch(errorCode) 551 + { 552 + case overflow: 553 + if( string != NULL ) 554 + _tcscpy(string, ERR_STR_OVERFLOW); 555 + m_state = error; 556 + break; 557 + case division_by_zero: 558 + if( string != NULL ) 559 + _tcscpy(string, ERR_STR_DIVBYZERO); 560 + m_state = error; 561 + break; 562 + } 563 + } 564 + 565 + int calc::changeToNegative(LPTSTR string) 566 + { 567 + double d = _tstof(string); 568 + d = d * -1; 569 + _stprintf(string, L"%.*lf", (int)m_precision, (double)d); 570 + trimRigthDecimalZero(string); 571 + return 1; 572 + } 573 + 574 + int calc::changeEuroLire(LPTSTR string, TCHAR c) 575 + { 576 + double d = _tstof(string); 577 + if( c==CALC_EURO) 578 + d = d / CHANGE_LIRE_EURO; 579 + if( c==CALC_L) 580 + d = d * CHANGE_LIRE_EURO; 581 + 582 + _stprintf(string, L"%.*lf", (int)m_precision, (double)d); 583 + 584 + return 1; 585 + } 586 + 587 + calc::base calc::get_current_base() 588 + { 589 + return m_currentBase; 590 + } 591 + 592 + void calc::restoreDecimalBase(LPTSTR string) 593 + { 594 + if( m_currentBase == hex ) 595 + { 596 + _stprintf(string, L"%.*lf",(int)m_precision, (double)m_lastDecimalNumber); 597 + m_currentBase = decimal; 598 + } 599 + } 600 + 601 + 602 + int calc::changeBase(LPTSTR string) 603 + { 604 + long double d = 0; 605 + switch(m_currentBase) 606 + { 607 + case decimal: 608 + d = _tstof(string); 609 + m_lastDecimalNumber = (double)d; 610 + _stprintf(string, L"x%lX", (long)d); 611 + m_currentBase = hex; 612 + break; 613 + case hex: 614 + d = calc::toDecimal(string); 615 + _stprintf(string, L"%.*lf", (int)m_precision, (double)d); 616 + const TCHAR* dec = _tcschr((LPCTSTR)string, CALC_P); 617 + dec++; 618 + bool withDecimal=false; 619 + while(*dec != '\0') 620 + { 621 + if( *dec != (char)'0' ) 622 + { 623 + withDecimal = true; 624 + break; 625 + } 626 + dec++; 627 + } 628 + if( !withDecimal) 629 + _stprintf(string, L"%.0lf", (double)d); 630 + m_currentBase = decimal; 631 + break; 632 + } 633 + 634 + return 1; 635 + } 636 + 637 + long double calc::toDecimal(LPCTSTR hexString) 638 + { 639 + long double retValue = 0; 640 + size_t len = _tcslen(hexString); 641 + int i=0; 642 + for(size_t y=len-1; y>=0; y--) 643 + { 644 + switch(hexString[y]) 645 + { 646 + case 'x': 647 + break; 648 + case '1': 649 + retValue += pow((long double)16, (long double)i); 650 + break; 651 + case '2': 652 + retValue += 2*pow((long double)16, (long double)i); 653 + break; 654 + case '3': 655 + retValue += 3*pow((long double)16, (long double)i); 656 + break; 657 + case '4': 658 + retValue += 4*pow((long double)16, (long double)i); 659 + break; 660 + case '5': 661 + retValue += 5*pow((long double)16, (long double)i); 662 + break; 663 + case '6': 664 + retValue += 6*pow((long double)16, (long double)i); 665 + break; 666 + case '7': 667 + retValue += 7*pow((long double)16, (long double)i); 668 + break; 669 + case '8': 670 + retValue += 8*pow((long double)16, (long double)i); 671 + break; 672 + case '9': 673 + retValue += 9*pow((long double)16, (long double)i); 674 + break; 675 + case 'a': 676 + case 'A': 677 + retValue += 10*pow((long double)16, (long double)i); 678 + break; 679 + case 'b': 680 + case 'B': 681 + retValue += 11*pow((long double)16, (long double)i); 682 + break; 683 + case 'c': 684 + case 'C': 685 + retValue += 12*pow((long double)16, (long double)i); 686 + break; 687 + case 'd': 688 + case 'D': 689 + retValue += 13*pow((long double)16, (long double)i); 690 + break; 691 + case 'e': 692 + case 'E': 693 + retValue += 14*pow((long double)16, (long double)i); 694 + break; 695 + case 'f': 696 + case 'F': 697 + retValue += 15*pow((long double)16, (long double)i); 698 + break; 699 + } 700 + i++; 701 + } 702 + return retValue; 703 + }
+118
Calculator.h
··· 1 + #pragma once 2 + 3 + #define MAX_LEN_RESULT 25 4 + 5 + #define CALC_1 _T('1') 6 + #define CALC_2 _T('2') 7 + #define CALC_3 _T('3') 8 + #define CALC_4 _T('4') 9 + #define CALC_5 _T('5') 10 + #define CALC_6 _T('6') 11 + #define CALC_7 _T('7') 12 + #define CALC_8 _T('8') 13 + #define CALC_9 _T('9') 14 + #define CALC_0 _T('0') 15 + #define CALC_000 _T('Z') 16 + #define CALC_P _T('.') 17 + #define CALC_ADD _T('+') 18 + #define CALC_SUB _T('-') 19 + #define CALC_MUL _T('*') 20 + #define CALC_DIV _T('/') 21 + #define CALC_SQRT _T('Q') 22 + #define CALC_TOT _T('=') 23 + #define CALC_RESET _T('N') 24 + #define CALC_NEG _T('P') 25 + #define CALC_PERC _T('%') 26 + #define CALC_EURO _T('R') 27 + #define CALC_L _T('L') 28 + #define CALC_I _T('I') 29 + #define CALC_X _T('X') 30 + 31 + #define CALC_A _T('A') 32 + #define CALC_B _T('B') 33 + #define CALC_C _T('C') 34 + #define CALC_D _T('D') 35 + #define CALC_E _T('E') 36 + #define CALC_F _T('F') 37 + 38 + #define CHANGE_LIRE_EURO 1936.27 39 + #define CALC_STR_0 _T("0") 40 + #define CALC_STR_P _T(".") 41 + #define CALC_STR_000 _T("000") 42 + 43 + 44 + #define ERR_STR_OVERFLOW _T("Error: overflow") 45 + #define ERR_STR_DIVBYZERO _T("Error: division by zero") 46 + 47 + #ifdef __OS2__ 48 + class _export calc 49 + #else 50 + class calc 51 + #endif 52 + { 53 + public: 54 + calc(); 55 + virtual ~calc(); 56 + 57 + void set_precision(unsigned int precision); 58 + unsigned int get_precision(); 59 + 60 + typedef enum _base{ 61 + decimal 62 + ,hex 63 + }base; 64 + 65 + base get_current_base(); 66 + 67 + void change_state(TCHAR newChar, LPCTSTR oldString, LPTSTR newString); 68 + 69 + private: 70 + enum{ 71 + overflow 72 + ,division_by_zero 73 + }; 74 + 75 + enum{ 76 + undefined_state 77 + ,init 78 + ,first_oper 79 + ,operation 80 + ,second_oper 81 + ,result 82 + ,error 83 + }m_prev_state,m_state; 84 + 85 + typedef enum _opertors 86 + { 87 + undefined_oper 88 + ,add 89 + ,sub 90 + ,div 91 + ,mul 92 + ,calc_sqrt 93 + ,percent 94 + ,inverse 95 + }opertors; 96 + 97 + opertors m_operator; 98 + 99 + base m_currentBase; 100 + double m_lastDecimalNumber; 101 + 102 + static const int m_max_num_oper; //2 103 + unsigned int m_current_oper; 104 + double* m_oper; 105 + unsigned int m_precision; 106 + 107 + int addChar(LPTSTR string, TCHAR c); 108 + int addString(LPTSTR string, LPTSTR str2); 109 + int addOper(LPTSTR string); 110 + int calcResult(LPTSTR string); 111 + int trimRigthDecimalZero(LPTSTR string); 112 + void err(int errorCode, LPTSTR string = NULL); 113 + int changeToNegative(LPTSTR string); 114 + int changeEuroLire(LPTSTR string, TCHAR c); 115 + int changeBase(LPTSTR string); 116 + void restoreDecimalBase(LPTSTR string); 117 + static long double toDecimal(LPCTSTR hexString); 118 + };
+489
CalculatorDeskBand.cpp
··· 1 + #include "StdAfx.h" 2 + #include "CalculatorDeskBand.h" 3 + #include "Utils.h" 4 + 5 + //////////////////////////////////////////////////////////////////////////////// 6 + // 7 + const UINT IDM_SEPARATOR_OFFSET = 0; 8 + const UINT IDM_SETTINGS_OFFSET = 1; 9 + 10 + //const LPCTSTR SETTINGS_SECTION_DATEFORMAT = TEXT("DateFormatDB"); 11 + 12 + BOOL CALLBACK AboutDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); 13 + 14 + //////////////////////////////////////////////////////////////////////////////// 15 + // CCalculatorDeskBand 16 + 17 + CCalculatorDeskBand::CCalculatorDeskBand() 18 + { 19 + } 20 + 21 + //////////////////////////////////////////////////////////////////////////////// 22 + // 23 + HRESULT CCalculatorDeskBand::FinalConstruct() 24 + { 25 + m_nBandID = 0; 26 + m_dwViewMode = DBIF_VIEWMODE_NORMAL; 27 + m_bRequiresSave = false; 28 + m_bCompositionEnabled = TRUE; 29 + 30 + return HandleShowRequest(); 31 + } 32 + 33 + void CCalculatorDeskBand::FinalRelease() 34 + { 35 + } 36 + 37 + HRESULT CCalculatorDeskBand::HandleShowRequest() 38 + { 39 + OLECHAR szAtom[MAX_GUID_STRING_LEN] = { 0 }; 40 + ::StringFromGUID2(CLSID_CalendarDeskBand, szAtom, MAX_GUID_STRING_LEN); 41 + 42 + HRESULT hr = S_OK; 43 + const ATOM show = ::GlobalFindAtomW(szAtom); 44 + 45 + if(show) 46 + { 47 + CComPtr<IBandSite> spBandSite; 48 + hr = spBandSite.CoCreateInstance(CLSID_TrayBandSiteService); 49 + 50 + if(SUCCEEDED(hr)) 51 + { 52 + LPUNKNOWN lpUnk = static_cast<IOleWindow*>(this); 53 + hr = spBandSite->AddBand(lpUnk); 54 + } 55 + 56 + ::GlobalDeleteAtom(show); 57 + } 58 + 59 + return hr; 60 + } 61 + 62 + HRESULT CCalculatorDeskBand::UpdateDeskband() 63 + { 64 + CComPtr<IInputObjectSite> spInputSite; 65 + HRESULT hr = GetSite(IID_IInputObjectSite, 66 + reinterpret_cast<void**>(&spInputSite)); 67 + 68 + if(SUCCEEDED(hr)) 69 + { 70 + CComQIPtr<IOleCommandTarget> spOleCmdTarget = spInputSite; 71 + 72 + if(spOleCmdTarget) 73 + { 74 + // m_nBandID must be `int' or bandID variant must be explicitly 75 + // set to VT_I4, otherwise IDeskBand::GetBandInfo won't 76 + // be called by the system. 77 + CComVariant bandID(m_nBandID); 78 + 79 + hr = spOleCmdTarget->Exec(&CGID_DeskBand, 80 + DBID_BANDINFOCHANGED, OLECMDEXECOPT_DODEFAULT, &bandID, NULL); 81 + ATLASSERT(SUCCEEDED(hr)); 82 + } 83 + } 84 + 85 + return hr; 86 + } 87 + 88 + //////////////////////////////////////////////////////////////////////////////// 89 + // IObjectWithSite 90 + 91 + HRESULT STDMETHODCALLTYPE CCalculatorDeskBand::SetSite( 92 + /* [in] */ IUnknown *pUnkSite) 93 + { 94 + HRESULT hr = __super::SetSite(pUnkSite); 95 + 96 + if(SUCCEEDED(hr) && pUnkSite) // pUnkSite is NULL when band is being destroyed 97 + { 98 + CComQIPtr<IOleWindow> spOleWindow = pUnkSite; 99 + 100 + if(spOleWindow) 101 + { 102 + HWND hwndParent = NULL; 103 + hr = spOleWindow->GetWindow(&hwndParent); 104 + 105 + if(SUCCEEDED(hr)) 106 + { 107 + m_wndCalculator.Create(hwndParent, 108 + static_cast<IDeskBand*>(this), pUnkSite); 109 + 110 + if(!m_wndCalculator.IsWindow()) 111 + hr = E_FAIL; 112 + } 113 + } 114 + } 115 + 116 + return hr; 117 + } 118 + 119 + //////////////////////////////////////////////////////////////////////////////// 120 + // IInputObject 121 + 122 + HRESULT STDMETHODCALLTYPE CCalculatorDeskBand::UIActivateIO( 123 + /* [in] */ BOOL fActivate, 124 + /* [unique][in] */ PMSG /*pMsg*/) 125 + { 126 + ATLTRACE(atlTraceCOM, 2, _T("IInputObject::UIActivateIO (%s)\n"), 127 + (fActivate ? _T("TRUE") : _T("FALSE"))); 128 + 129 + if(fActivate) 130 + m_wndCalculator.SetFocus(); 131 + 132 + return S_OK; 133 + } 134 + 135 + HRESULT STDMETHODCALLTYPE CCalculatorDeskBand::HasFocusIO() 136 + { 137 + ATLTRACE(atlTraceCOM, 2, _T("IInputObject::HasFocusIO\n")); 138 + 139 + return (m_wndCalculator.HasFocus() ? S_OK : S_FALSE); 140 + } 141 + 142 + HRESULT STDMETHODCALLTYPE CCalculatorDeskBand::TranslateAcceleratorIO( 143 + /* [in] */ PMSG /*pMsg*/) 144 + { 145 + ATLTRACE(atlTraceCOM, 2, _T("IInputObject::TranslateAcceleratorIO\n")); 146 + 147 + return S_FALSE; 148 + } 149 + 150 + //////////////////////////////////////////////////////////////////////////////// 151 + // IContextMenu 152 + 153 + HRESULT STDMETHODCALLTYPE CCalculatorDeskBand::QueryContextMenu( 154 + /* [in] */ HMENU hMenu, 155 + /* [in] */ UINT indexMenu, 156 + /* [in] */ UINT idCmdFirst, 157 + /* [in] */ UINT /*idCmdLast*/, 158 + /* [in] */ UINT uFlags) 159 + { 160 + ATLTRACE(atlTraceCOM, 2, _T("IContextMenu::QueryContextMenu\n")); 161 + 162 + if(CMF_DEFAULTONLY & uFlags) 163 + return MAKE_HRESULT(SEVERITY_SUCCESS, 0, 0); 164 + 165 + // Add a seperator 166 + ::InsertMenu(hMenu, 167 + indexMenu, 168 + MF_SEPARATOR | MF_BYPOSITION, 169 + idCmdFirst + IDM_SEPARATOR_OFFSET, 0); 170 + 171 + // Add the new menu item 172 + CString sCaption; 173 + sCaption.LoadString(IDS_DESKBANDSETTINGS); 174 + 175 + ::InsertMenu(hMenu, 176 + indexMenu, 177 + MF_STRING | MF_BYPOSITION, 178 + idCmdFirst + IDM_SETTINGS_OFFSET, 179 + sCaption); 180 + 181 + return MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_NULL, IDM_SETTINGS_OFFSET + 1); 182 + } 183 + 184 + HRESULT STDMETHODCALLTYPE CCalculatorDeskBand::InvokeCommand( 185 + LPCMINVOKECOMMANDINFO pici) 186 + { 187 + ATLTRACE(atlTraceCOM, 2, _T("IContextMenu::InvokeCommand\n")); 188 + 189 + if(!pici) return E_INVALIDARG; 190 + 191 + if(LOWORD(pici->lpVerb) == IDM_SETTINGS_OFFSET) 192 + { 193 + ATLASSERT(m_wndCalculator.IsWindow()); 194 + 195 + INT_PTR i = DialogBox(_AtlBaseModule.GetModuleInstance(), MAKEINTRESOURCE(IDD_ABOUT), pici->hwnd, (DLGPROC)AboutDialogProc); 196 + if (i == -1) 197 + { 198 + DWORD lastError = GetLastError(); 199 + ATLTRACE(atlTraceWindowing, 1, "%d", lastError); 200 + } 201 + 202 + //CDateFormatSettings dlgSettings; 203 + //const INT_PTR res = dlgSettings.DoModal(m_wndCalculator, 204 + // reinterpret_cast<LPARAM>(&m_dateFormat)); 205 + 206 + //if(res == IDOK) 207 + //{ 208 + // m_dateFormat = dlgSettings.m_dateFormat; 209 + // m_bRequiresSave = true; 210 + // 211 + // const HRESULT hr = UpdateDeskband(); 212 + // ATLASSERT(SUCCEEDED(hr)); 213 + //} 214 + } 215 + 216 + return S_OK; 217 + } 218 + 219 + HRESULT STDMETHODCALLTYPE CCalculatorDeskBand::GetCommandString( 220 + /* [in] */ UINT_PTR /*idCmd*/, 221 + /* [in] */ UINT /*uType*/, 222 + /* [in] */ UINT* /*pReserved*/, 223 + /* [out] */ LPSTR /*pszName*/, 224 + /* [in] */ UINT /*cchMax*/) 225 + { 226 + ATLTRACE(atlTraceCOM, 2, _T("IContextMenu::GetCommandString\n")); 227 + 228 + return S_OK; 229 + } 230 + 231 + //////////////////////////////////////////////////////////////////////////////// 232 + // IDeskBand 233 + 234 + HRESULT STDMETHODCALLTYPE CCalculatorDeskBand::GetBandInfo( 235 + /* [in] */ DWORD dwBandID, 236 + /* [in] */ DWORD dwViewMode, 237 + /* [out][in] */ DESKBANDINFO *pdbi) 238 + { 239 + ATLTRACE(atlTraceCOM, 2, _T("IDeskBand::GetBandInfo\n")); 240 + 241 + if(!pdbi) return E_INVALIDARG; 242 + 243 + m_nBandID = dwBandID; 244 + m_dwViewMode = dwViewMode; 245 + 246 + if(pdbi->dwMask & DBIM_MODEFLAGS) 247 + { 248 + pdbi->dwModeFlags = DBIMF_VARIABLEHEIGHT; 249 + } 250 + 251 + if(pdbi->dwMask & DBIM_MINSIZE) 252 + { 253 + pdbi->ptMinSize = m_wndCalculator.CalcIdealSize(); 254 + } 255 + 256 + if(pdbi->dwMask & DBIM_MAXSIZE) 257 + { 258 + // the band object has no limit for its maximum height 259 + pdbi->ptMaxSize.x = -1; 260 + pdbi->ptMaxSize.y = -1; 261 + } 262 + 263 + if(pdbi->dwMask & DBIM_INTEGRAL) 264 + { 265 + pdbi->ptIntegral.x = 1; 266 + pdbi->ptIntegral.y = 1; 267 + } 268 + 269 + if(pdbi->dwMask & DBIM_ACTUAL) 270 + { 271 + pdbi->ptActual = m_wndCalculator.CalcIdealSize(); 272 + } 273 + 274 + if(pdbi->dwMask & DBIM_TITLE) 275 + { 276 + CString stringCaption; 277 + stringCaption.LoadString(IDS_TASKBARCALCULATOR); 278 + lstrcpynW(pdbi->wszTitle, stringCaption, ARRAYSIZE(pdbi->wszTitle)); 279 + } 280 + 281 + if(pdbi->dwMask & DBIM_BKCOLOR) 282 + { 283 + //Use the default background color by removing this flag. 284 + pdbi->dwMask &= ~DBIM_BKCOLOR; 285 + } 286 + 287 + return S_OK; 288 + } 289 + 290 + //////////////////////////////////////////////////////////////////////////////// 291 + // IDeskBand2 292 + HRESULT STDMETHODCALLTYPE CCalculatorDeskBand::CanRenderComposited( 293 + /* [out] */ BOOL *pfCanRenderComposited) 294 + { 295 + if(pfCanRenderComposited) 296 + *pfCanRenderComposited = TRUE; 297 + 298 + return S_OK; 299 + } 300 + 301 + HRESULT STDMETHODCALLTYPE CCalculatorDeskBand::SetCompositionState( 302 + /* [in] */ BOOL fCompositionEnabled) 303 + { 304 + m_bCompositionEnabled = fCompositionEnabled; 305 + m_wndCalculator.Invalidate(); 306 + 307 + return S_OK; 308 + } 309 + 310 + HRESULT STDMETHODCALLTYPE CCalculatorDeskBand::GetCompositionState( 311 + /* [out] */ BOOL *pfCompositionEnabled) 312 + { 313 + if(pfCompositionEnabled) 314 + *pfCompositionEnabled = m_bCompositionEnabled; 315 + 316 + return S_OK; 317 + } 318 + 319 + //////////////////////////////////////////////////////////////////////////////// 320 + // IOleWindow 321 + 322 + HRESULT STDMETHODCALLTYPE CCalculatorDeskBand::GetWindow( 323 + /* [out] */ HWND *phwnd) 324 + { 325 + ATLTRACE(atlTraceCOM, 2, _T("IOleWindow::GetWindow\n")); 326 + 327 + if(phwnd) *phwnd = m_wndCalculator; 328 + 329 + return S_OK; 330 + } 331 + 332 + HRESULT STDMETHODCALLTYPE CCalculatorDeskBand::ContextSensitiveHelp( 333 + /* [in] */ BOOL /*fEnterMode*/) 334 + { 335 + ATLTRACE(atlTraceCOM, 2, _T("IOleWindow::ContextSensitiveHelp\n")); 336 + 337 + //ATLTRACENOTIMPL(_T("IOleWindow::ContextSensitiveHelp")); 338 + return S_OK; 339 + } 340 + 341 + //////////////////////////////////////////////////////////////////////////////// 342 + // IDockingWindow 343 + 344 + HRESULT STDMETHODCALLTYPE CCalculatorDeskBand::ShowDW( 345 + /* [in] */ BOOL fShow) 346 + { 347 + ATLTRACE(atlTraceCOM, 2, _T("IDockingWindow::ShowDW\n")); 348 + 349 + if(m_wndCalculator) 350 + m_wndCalculator.ShowWindow(fShow ? SW_SHOW : SW_HIDE); 351 + 352 + return S_OK; 353 + } 354 + 355 + HRESULT STDMETHODCALLTYPE CCalculatorDeskBand::CloseDW( 356 + /* [in] */ DWORD /*dwReserved*/) 357 + { 358 + ATLTRACE(atlTraceCOM, 2, _T("IDockingWindow::CloseDW\n")); 359 + 360 + if(m_wndCalculator) 361 + { 362 + m_wndCalculator.ShowWindow(SW_HIDE); 363 + m_wndCalculator.DestroyWindow(); 364 + } 365 + 366 + return S_OK; 367 + } 368 + 369 + HRESULT STDMETHODCALLTYPE CCalculatorDeskBand::ResizeBorderDW( 370 + /* [in] */ LPCRECT prcBorder, 371 + /* [in] */ IUnknown *punkToolbarSite, 372 + /* [in] */ BOOL /*fReserved*/) 373 + { 374 + ATLTRACE(atlTraceCOM, 2, _T("IDockingWindow::ResizeBorderDW\n")); 375 + 376 + if(!m_wndCalculator) return S_OK; 377 + 378 + CComQIPtr<IDockingWindowSite> spDockingWindowSite = punkToolbarSite; 379 + 380 + if(spDockingWindowSite) 381 + { 382 + BORDERWIDTHS bw = { 0 }; 383 + bw.top = bw.bottom = ::GetSystemMetrics(SM_CYBORDER); 384 + bw.left = bw.right = ::GetSystemMetrics(SM_CXBORDER); 385 + 386 + HRESULT hr = spDockingWindowSite->RequestBorderSpaceDW( 387 + static_cast<IDeskBand*>(this), &bw); 388 + 389 + if(SUCCEEDED(hr)) 390 + { 391 + HRESULT hr2 = spDockingWindowSite->SetBorderSpaceDW( 392 + static_cast<IDeskBand*>(this), &bw); 393 + 394 + if(SUCCEEDED(hr2)) 395 + { 396 + m_wndCalculator.MoveWindow(prcBorder); 397 + return S_OK; 398 + } 399 + } 400 + } 401 + 402 + return E_FAIL; 403 + } 404 + 405 + //////////////////////////////////////////////////////////////////////////////// 406 + // IPersistStreamImpl 407 + 408 + HRESULT CCalculatorDeskBand::IPersistStreamInit_Load( 409 + LPSTREAM pStm, 410 + const ATL_PROPMAP_ENTRY* pMap) 411 + { 412 + //if(m_bstrDateFormat) 413 + // m_bstrDateFormat.Empty(); 414 + 415 + const HRESULT hr = __super::IPersistStreamInit_Load(pStm, pMap); 416 + 417 + //if(SUCCEEDED(hr)) 418 + // m_dateFormat.dateFormat = m_bstrDateFormat; 419 + 420 + return hr; 421 + } 422 + 423 + HRESULT CCalculatorDeskBand::IPersistStreamInit_Save( 424 + LPSTREAM pStm, 425 + BOOL fClearDirty, 426 + const ATL_PROPMAP_ENTRY* pMap) 427 + { 428 + // m_bstrDateFormat = m_dateFormat.dateFormat; 429 + 430 + return __super::IPersistStreamInit_Save(pStm, fClearDirty, pMap); 431 + } 432 + 433 + //////////////////////////////////////////////////////////////////////////////// 434 + 435 + 436 + /************************************************************************** 437 + 438 + AboutDialogProc() 439 + 440 + **************************************************************************/ 441 + 442 + BOOL CALLBACK AboutDialogProc( 443 + HWND hwndDlg, // handle to dialog box 444 + UINT uMsg, // message 445 + WPARAM wParam, // first message parameter 446 + LPARAM lParam // second message parameter 447 + ) 448 + { 449 + 450 + switch (uMsg) 451 + { 452 + case WM_INITDIALOG: 453 + break; 454 + case WM_NOTIFY: 455 + switch (((LPNMHDR)lParam)->code) 456 + { 457 + case NM_CLICK: // Fall through to the next case. 458 + case NM_RETURN: 459 + { 460 + PNMLINK pNMLink = (PNMLINK)lParam; 461 + LITEM item = pNMLink->item; 462 + if (item.iLink == 0) 463 + { 464 + ShellExecute(NULL, L"open", item.szUrl, NULL, NULL, SW_SHOW); 465 + } 466 + break; 467 + } 468 + } 469 + break; 470 + case WM_COMMAND: 471 + switch (LOWORD(wParam)) 472 + { 473 + case IDOK: 474 + case IDCANCEL: 475 + EndDialog(hwndDlg, TRUE); 476 + return TRUE; 477 + break; 478 + 479 + default: 480 + break; 481 + } 482 + break; 483 + } 484 + 485 + return FALSE; 486 + } 487 + 488 + 489 +
+160
CalculatorDeskBand.h
··· 1 + // CalendarDeskBand.h : Declaration of the CCalculatorDeskBand 2 + 3 + #pragma once 4 + #include "resource.h" // main symbols 5 + 6 + #include "Guids.h" 7 + #include "CalculatorWindow.h" 8 + 9 + #if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA) 10 + #error "Single-threaded COM objects are not properly supported on Windows CE platform, such as the Windows Mobile platforms that do not include full DCOM support. Define _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA to force ATL to support creating single-thread COM object's and allow use of it's single-threaded COM object implementations. The threading model in your rgs file was set to 'Free' as that is the only threading model supported in non DCOM Windows CE platforms." 11 + #endif 12 + 13 + using namespace ATL; 14 + 15 + class CCalculatorDeskBand : 16 + public CComObjectRootEx<CComSingleThreadModel>, 17 + public CComCoClass<CCalculatorDeskBand, &CLSID_CalendarDeskBand>, 18 + public IObjectWithSiteImpl<CCalculatorDeskBand>, 19 + public IPersistStreamInitImpl<CCalculatorDeskBand>, 20 + public IInputObject, 21 + public IContextMenu, 22 + public IDeskBand2 23 + { 24 + typedef IPersistStreamInitImpl<CCalculatorDeskBand> IPersistStreamImpl; 25 + public: 26 + CCalculatorDeskBand(); 27 + 28 + DECLARE_REGISTRY_RESOURCEID(IDR_TASKBARCALCULATOR) 29 + 30 + BEGIN_COM_MAP(CCalculatorDeskBand) 31 + COM_INTERFACE_ENTRY(IOleWindow) 32 + COM_INTERFACE_ENTRY(IDockingWindow) 33 + COM_INTERFACE_ENTRY(IDeskBand) 34 + COM_INTERFACE_ENTRY(IDeskBand2) 35 + COM_INTERFACE_ENTRY(IInputObject) 36 + COM_INTERFACE_ENTRY(IContextMenu) 37 + COM_INTERFACE_ENTRY(IObjectWithSite) 38 + COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersistStreamImpl) 39 + COM_INTERFACE_ENTRY_IID(IID_IPersistStream, IPersistStreamImpl) 40 + COM_INTERFACE_ENTRY_IID(IID_IPersistStreamInit, IPersistStreamImpl) 41 + END_COM_MAP() 42 + 43 + BEGIN_CATEGORY_MAP(CCalculatorDeskBand) 44 + IMPLEMENTED_CATEGORY(CATID_DeskBand) 45 + END_CATEGORY_MAP() 46 + 47 + // IPersistStreamInitImpl requires property map. 48 + BEGIN_PROP_MAP(CCalculatorDeskBand) 49 + //PROP_DATA_ENTRY("Locale", m_dateFormat.lcId, VT_UI4) 50 + //PROP_DATA_ENTRY("Calendar", m_dateFormat.calId, VT_UI4) 51 + //PROP_DATA_ENTRY("CalendarType", m_dateFormat.calType, VT_UI4) 52 + //PROP_DATA_ENTRY("DateFormat", m_bstrDateFormat.m_str, VT_BSTR) 53 + END_PROP_MAP() 54 + 55 + DECLARE_PROTECT_FINAL_CONSTRUCT() 56 + 57 + HRESULT FinalConstruct(); 58 + void FinalRelease(); 59 + 60 + public: 61 + // IObjectWithSite 62 + // 63 + STDMETHOD(SetSite)( 64 + /* [in] */ IUnknown *pUnkSite); 65 + 66 + // IInputObject 67 + // 68 + STDMETHOD(UIActivateIO)( 69 + /* [in] */ BOOL fActivate, 70 + /* [unique][in] */ MSG *pMsg); 71 + 72 + STDMETHOD(HasFocusIO)(); 73 + 74 + STDMETHOD(TranslateAcceleratorIO)( 75 + /* [in] */ MSG *pMsg); 76 + 77 + // IContextMenu 78 + // 79 + STDMETHOD(QueryContextMenu)( 80 + /* [in] */ HMENU hmenu, 81 + /* [in] */ UINT indexMenu, 82 + /* [in] */ UINT idCmdFirst, 83 + /* [in] */ UINT idCmdLast, 84 + /* [in] */ UINT uFlags); 85 + 86 + STDMETHOD(InvokeCommand)( 87 + /* [in] */ CMINVOKECOMMANDINFO *pici); 88 + 89 + STDMETHOD(GetCommandString)( 90 + /* [in] */ UINT_PTR idCmd, 91 + /* [in] */ UINT uType, 92 + /* [in] */ UINT *pReserved, 93 + /* [out] */ LPSTR pszName, 94 + /* [in] */ UINT cchMax); 95 + 96 + // IDeskBand 97 + // 98 + STDMETHOD(GetBandInfo)( 99 + /* [in] */ DWORD dwBandID, 100 + /* [in] */ DWORD dwViewMode, 101 + /* [out][in] */ DESKBANDINFO *pdbi); 102 + 103 + // IDeskBand2 104 + // 105 + STDMETHOD(CanRenderComposited)( 106 + /* [out] */ BOOL *pfCanRenderComposited); 107 + 108 + STDMETHOD(SetCompositionState)( 109 + /* [in] */ BOOL fCompositionEnabled); 110 + 111 + STDMETHOD(GetCompositionState)( 112 + /* [out] */ BOOL *pfCompositionEnabled); 113 + 114 + // IOleWindow 115 + // 116 + STDMETHOD(GetWindow)( 117 + /* [out] */ HWND *phwnd); 118 + 119 + STDMETHOD(ContextSensitiveHelp)( 120 + /* [in] */ BOOL fEnterMode); 121 + 122 + // IDockingWindow 123 + // 124 + STDMETHOD(ShowDW)( 125 + /* [in] */ BOOL fShow); 126 + 127 + STDMETHOD(CloseDW)( 128 + /* [in] */ DWORD dwReserved); 129 + 130 + STDMETHOD(ResizeBorderDW)( 131 + /* [in] */ LPCRECT prcBorder, 132 + /* [in] */ IUnknown *punkToolbarSite, 133 + /* [in] */ BOOL fReserved); 134 + 135 + // IPersistStreamImpl 136 + // 137 + HRESULT IPersistStreamInit_Load( 138 + /* [in] */ LPSTREAM pStm, 139 + /* [in] */ const ATL_PROPMAP_ENTRY* pMap); 140 + 141 + HRESULT IPersistStreamInit_Save( 142 + /* [in] */ LPSTREAM pStm, 143 + /* [in] */ BOOL fClearDirty, 144 + /* [in] */ const ATL_PROPMAP_ENTRY* pMap); 145 + 146 + private: 147 + HRESULT HandleShowRequest(); 148 + HRESULT UpdateDeskband(); 149 + 150 + public: 151 + bool m_bRequiresSave; // used by IPersistStreamInitImpl 152 + 153 + private: 154 + int m_nBandID; 155 + DWORD m_dwViewMode; 156 + CCalculatorWindow m_wndCalculator; 157 + BOOL m_bCompositionEnabled; 158 + }; 159 + 160 + OBJECT_ENTRY_AUTO(CLSID_CalendarDeskBand, CCalculatorDeskBand)
+684
CalculatorWindow.cpp
··· 1 + #include "StdAfx.h" 2 + #include "CalculatorWindow.h" 3 + //#include "DateFormat.h" 4 + #include "VisualStyle.h" 5 + #include "Utils.h" 6 + #include "Calculator.h" 7 + 8 + //////////////////////////////////////////////////////////////////////////////// 9 + // 10 + const UINT_PTR UPDATE_TIMER_ID = 1; 11 + 12 + WNDPROC wpOrigEditProc; 13 + LRESULT CALLBACK WndEditProc(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam); 14 + 15 + //////////////////////////////////////////////////////////////////////////////// 16 + // 17 + class SelectGdiObject 18 + { 19 + public: 20 + SelectGdiObject(HDC hDC, HGDIOBJ hGdiObj) : 21 + m_hDC(hDC), 22 + m_hGdiObj(hGdiObj), 23 + m_hSaveGdiObj(::SelectObject(hDC, hGdiObj)) 24 + { 25 + ATLASSERT(m_hSaveGdiObj && m_hSaveGdiObj != HGDI_ERROR); 26 + } 27 + 28 + ~SelectGdiObject() 29 + { 30 + if(m_hSaveGdiObj && m_hSaveGdiObj != HGDI_ERROR) 31 + ::SelectObject(m_hDC, m_hSaveGdiObj); 32 + } 33 + 34 + operator HGDIOBJ() const { return m_hGdiObj; } 35 + 36 + private: 37 + HDC m_hDC; 38 + HGDIOBJ m_hGdiObj; 39 + HGDIOBJ m_hSaveGdiObj; 40 + 41 + private: 42 + // not copyable 43 + SelectGdiObject(const SelectGdiObject&); 44 + SelectGdiObject& operator=(const SelectGdiObject&); 45 + }; 46 + 47 + class DoubleBufferPaint 48 + { 49 + public: 50 + DoubleBufferPaint(HWND hWnd, DWORD dwRop = SRCCOPY) : m_hWnd(hWnd), m_dwRop(dwRop) 51 + { 52 + m_hdc = ::BeginPaint(m_hWnd, &m_ps); 53 + 54 + int x, y, cx, cy; 55 + InitDims(&x, &y, &cx, &cy); 56 + 57 + m_hdcMem = ::CreateCompatibleDC(m_hdc); 58 + m_hbmMem = ::CreateCompatibleBitmap(m_hdc, cx, cy); 59 + m_hbmSave = ::SelectObject(m_hdcMem, m_hbmMem); 60 + ::SetWindowOrgEx(m_hdcMem, x, y, NULL); 61 + } 62 + 63 + ~DoubleBufferPaint() 64 + { 65 + int x, y, cx, cy; 66 + InitDims(&x, &y, &cx, &cy); 67 + 68 + ::BitBlt(m_hdc, x, y, cx, cy, m_hdcMem, x, y, m_dwRop); 69 + 70 + ::SelectObject(m_hdcMem, m_hbmSave); 71 + ::DeleteObject(m_hbmMem); 72 + ::DeleteDC(m_hdcMem); 73 + 74 + ::EndPaint(m_hWnd, &m_ps); 75 + } 76 + 77 + HDC GetDC() const { return m_hdcMem; } 78 + const RECT& GetPaintRect() const { return m_ps.rcPaint; } 79 + 80 + private: 81 + void InitDims(int* px, int* py, int* pcx, int* pcy) const 82 + { 83 + *px = m_ps.rcPaint.left; 84 + *py = m_ps.rcPaint.top; 85 + *pcx = m_ps.rcPaint.right - m_ps.rcPaint.left; 86 + *pcy = m_ps.rcPaint.bottom - m_ps.rcPaint.top; 87 + } 88 + 89 + private: 90 + HWND m_hWnd; 91 + DWORD m_dwRop; 92 + 93 + HDC m_hdc; 94 + HDC m_hdcMem; 95 + HGDIOBJ m_hbmMem; 96 + HGDIOBJ m_hbmSave; 97 + PAINTSTRUCT m_ps; 98 + 99 + private: 100 + // not copyable 101 + DoubleBufferPaint(const DoubleBufferPaint&); 102 + DoubleBufferPaint& operator=(const DoubleBufferPaint&); 103 + }; 104 + 105 + //////////////////////////////////////////////////////////////////////////////// 106 + // CCalculatorWindow 107 + CCalculatorWindow::CCalculatorWindow() : 108 + m_pDeskBand(NULL), 109 + m_fHasFocus(FALSE), 110 + m_ptrVisualStyle(CVisualStyle::Create()), 111 + m_calc() 112 + { 113 + // ::GetLocalTime(&m_stLocalTime); 114 + 115 + // m_unformatInputString[0] = '\0'; 116 + // m_unformatOutputString[0] = '\0'; 117 + 118 + m_numDecimalDigit = 2; 119 + 120 + ReadRegionalSettings(); 121 + } 122 + 123 + CCalculatorWindow::~CCalculatorWindow() 124 + { 125 + } 126 + 127 + //////////////////////////////////////////////////////////////////////////////// 128 + // 129 + 130 + BOOL CCalculatorWindow::Create( 131 + HWND hwndParent, 132 + LPUNKNOWN pDeskBand, 133 + LPUNKNOWN pInputObjectSite) 134 + { 135 + if(!__super::Create(hwndParent)) 136 + return FALSE; 137 + 138 + ATLASSERT(pDeskBand); 139 + m_pDeskBand = pDeskBand; 140 + 141 + ATLASSERT(pInputObjectSite); 142 + m_spInputObjectSite = pInputObjectSite; 143 + 144 + m_hwndEdit = CreateWindowEx( 145 + WS_EX_CLIENTEDGE, 146 + TEXT("EDIT"), 147 + TEXT("0"), 148 + WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | ES_RIGHT | ES_NUMBER, 149 + 0, 150 + 0, 151 + 0, 152 + 0, 153 + m_hWnd, 154 + NULL, 155 + _AtlBaseModule.GetModuleInstance(), 156 + 0); 157 + 158 + SetWindowFont(m_hwndEdit, m_ptrVisualStyle->GetFont(), TRUE); 159 + 160 + wpOrigEditProc = (WNDPROC)::SetWindowLongPtr(m_hwndEdit, GWLP_WNDPROC, (LONG_PTR)WndEditProc); 161 + if (wpOrigEditProc == 0) 162 + return FALSE; 163 + 164 + ::SetWindowLongPtr(m_hwndEdit, GWLP_USERDATA, (LONG_PTR)this); 165 + 166 + 167 + return TRUE; 168 + } 169 + 170 + POINTL CCalculatorWindow::CalcMinimalSize() const 171 + { 172 + POINTL pt = { 173 + ::GetSystemMetrics(SM_CXMIN), 174 + ::GetSystemMetrics(SM_CYMIN) 175 + }; 176 + 177 + return pt; 178 + } 179 + 180 + POINTL CCalculatorWindow::CalcIdealSize() const 181 + { 182 + if(!IsWindow()) return CalcMinimalSize(); 183 + 184 + // m_sDateString = m_pDateFormat->FormatDateString(m_stLocalTime); 185 + 186 + HDC hic = ::CreateIC(_T("DISPLAY"), NULL, NULL, NULL); 187 + 188 + CString testString = TEXT("99.999,99"); 189 + 190 + SIZE size = { 0 }; 191 + { 192 + SelectGdiObject gdiFont(hic, m_ptrVisualStyle->GetFont()); 193 + 194 + const BOOL bRes = ::GetTextExtentPoint32(hic, 195 + testString, testString.GetLength(), &size); 196 + ATLASSERT(bRes); 197 + } 198 + 199 + ::DeleteDC(hic); 200 + 201 + const POINTL pt = { size.cx, size.cy }; 202 + 203 + return pt; 204 + } 205 + 206 + BOOL CCalculatorWindow::HasFocus() const 207 + { 208 + return m_fHasFocus; 209 + } 210 + 211 + //////////////////////////////////////////////////////////////////////////////// 212 + // Message handlers 213 + 214 + LRESULT CCalculatorWindow::OnFocus( 215 + UINT uMsg, 216 + WPARAM /*wParam*/, 217 + LPARAM /*lParam*/, 218 + BOOL& /*bHandled*/) 219 + { 220 + m_fHasFocus = (uMsg == WM_SETFOCUS); 221 + 222 + if(m_spInputObjectSite) 223 + m_spInputObjectSite->OnFocusChangeIS(m_pDeskBand, m_fHasFocus); 224 + 225 + if ( m_fHasFocus ) 226 + ReadRegionalSettings(); 227 + 228 + return 0L; 229 + } 230 + 231 + LRESULT CCalculatorWindow::OnDestroy( 232 + UINT /*uMsg*/, 233 + WPARAM /*wParam*/, 234 + LPARAM /*lParam*/, 235 + BOOL& /*bHandled*/) 236 + { 237 + KillTimer(UPDATE_TIMER_ID); 238 + 239 + if(::IsWindow(m_hwndEdit)) 240 + { 241 + ::SetWindowLongPtr(m_hwndEdit, GWLP_WNDPROC, (LONG_PTR)wpOrigEditProc); 242 + ::DestroyWindow(m_hwndEdit); 243 + } 244 + 245 + return 0; 246 + } 247 + 248 + LRESULT CCalculatorWindow::OnEraseBackground( 249 + UINT /*uMsg*/, 250 + WPARAM /*wParam*/, 251 + LPARAM /*lParam*/, 252 + BOOL& /*bHandled*/) 253 + { 254 + return 1; 255 + } 256 + 257 + LRESULT CCalculatorWindow::OnPaint( 258 + UINT /*uMsg*/, 259 + WPARAM /*wParam*/, 260 + LPARAM /*lParam*/, 261 + BOOL& /*bHandled*/) 262 + { 263 + DoubleBufferPaint dbuffPaint(m_hWnd); 264 + 265 + //Paint(dbuffPaint.GetDC(), dbuffPaint.GetPaintRect()); 266 + 267 + m_ptrVisualStyle->DrawBackground(m_hWnd, dbuffPaint.GetDC(), dbuffPaint.GetPaintRect()); 268 + 269 + ::SetBkMode(dbuffPaint.GetDC(), TRANSPARENT); 270 + 271 + RECT rc; 272 + GetClientRect(&rc); 273 + 274 + #if _DEBUG 275 + CString str; 276 + str.Format(_T("RECT (TOP: %ld, LEFT: %ld, BOTTOM: %ld, RIGHT: %ld)\n"), rc.top, rc.left, rc.bottom, rc.right); 277 + OutputDebugString(str); 278 + #endif 279 + 280 + //#ifdef BIGFONT 281 + // const UINT defaultHeight = 40; 282 + //#else 283 + // const UINT defaultHeight = 22; 284 + //#endif 285 + 286 + UINT defaultHeight = (rc.bottom - rc.top) / 2; 287 + ::SetWindowPos(m_hwndEdit, 0, rc.left, ((rc.bottom - rc.top - defaultHeight) / 2), rc.right, defaultHeight, SWP_SHOWWINDOW); 288 + 289 + return 0; 290 + } 291 + 292 + LRESULT CCalculatorWindow::OnPowerBroadcast( 293 + UINT /*uMsg*/, 294 + WPARAM wParam, 295 + LPARAM /*lParam*/, 296 + BOOL& /*bHandled*/) 297 + { 298 + if(wParam == PBT_APMRESUMECRITICAL || 299 + wParam == PBT_APMRESUMESUSPEND || 300 + wParam == PBT_APMRESUMESTANDBY) 301 + { 302 + // re-enable timer 303 + //ATLVERIFY(SetUpdateTimer() != 0); 304 + } 305 + 306 + return 0; 307 + } 308 + 309 + LRESULT CCalculatorWindow::OnThemeChanged( 310 + UINT /*uMsg*/, 311 + WPARAM /*wParam*/, 312 + LPARAM /*lParam*/, 313 + BOOL& /*bHandled*/) 314 + { 315 + // re-create theme style 316 + m_ptrVisualStyle.Free(); 317 + m_ptrVisualStyle.Attach(CVisualStyle::Create()); 318 + 319 + return 0; 320 + } 321 + 322 + void CCalculatorWindow::Paint(HDC hdc, const RECT& rcPaint) const 323 + { 324 + m_ptrVisualStyle->DrawBackground(m_hWnd, hdc, rcPaint); 325 + 326 + RECT rcClient = { 0 }; 327 + GetClientRect(&rcClient); 328 + 329 + SelectGdiObject gdiFont(hdc, m_ptrVisualStyle->GetFont()); 330 + ::SetBkMode(hdc, TRANSPARENT); 331 + 332 + ::SetTextColor(hdc, m_ptrVisualStyle->GetTextColor()); 333 + 334 + // ::DrawText(hdc, m_sDateString, m_sDateString.GetLength(), &rcClient, DT_CENTER | DT_SINGLELINE | DT_VCENTER); 335 + } 336 + 337 + LRESULT CCalculatorWindow::OnEditKeyDown(HWND hWnd, WPARAM wParam, LPARAM /*lParam*/) 338 + { 339 + TCHAR c = '0'; 340 + bool bChangeState = true; 341 + 342 + switch (wParam) 343 + { 344 + case VK_NUMPAD0: 345 + c = CALC_0; 346 + break; 347 + case VK_NUMPAD1: 348 + c = CALC_1; 349 + break; 350 + case VK_NUMPAD2: 351 + c = CALC_2; 352 + break; 353 + case VK_NUMPAD3: 354 + c = CALC_3; 355 + break; 356 + case VK_NUMPAD4: 357 + c = CALC_4; 358 + break; 359 + case VK_NUMPAD5: 360 + c = CALC_5; 361 + break; 362 + case VK_NUMPAD6: 363 + c = CALC_6; 364 + break; 365 + case VK_NUMPAD7: 366 + c = CALC_7; 367 + break; 368 + case VK_NUMPAD8: 369 + c = CALC_8; 370 + break; 371 + case VK_NUMPAD9: 372 + c = CALC_9; 373 + break; 374 + case VK_RETURN: 375 + c = CALC_TOT; 376 + break; 377 + case VK_MULTIPLY: 378 + c = CALC_MUL; 379 + break; 380 + case VK_ADD: 381 + c = CALC_ADD; 382 + break; 383 + case VK_SUBTRACT: 384 + c = CALC_SUB; 385 + break; 386 + case VK_DECIMAL: 387 + c = CALC_P; 388 + break; 389 + case VK_DIVIDE: 390 + c = CALC_DIV; 391 + break; 392 + case VK_ESCAPE: 393 + c = CALC_RESET; 394 + break; 395 + case VK_DELETE: 396 + case VK_LEFT: 397 + case VK_RIGHT: 398 + return 0; 399 + case VK_BACK: 400 + { 401 + UINT len = m_unformatOutputString.GetLength(); 402 + if (len > 1) 403 + m_unformatOutputString.Delete(len - 1, 1); 404 + else 405 + m_unformatOutputString = CALC_STR_0; 406 + } 407 + c = '_'; 408 + break; 409 + default: 410 + bChangeState = false; 411 + } 412 + 413 + if (bChangeState) 414 + ProcessChar(hWnd, c); 415 + 416 + return (bChangeState ? 0 : 1); 417 + } 418 + 419 + LRESULT CCalculatorWindow::OnEditChar(HWND hWnd, WPARAM wParam, LPARAM /*lParam*/) 420 + { 421 + TCHAR c = '0'; 422 + bool bChangeState = true; 423 + 424 + switch (wParam) 425 + { 426 + case CALC_0: 427 + case CALC_1: 428 + case CALC_2: 429 + case CALC_3: 430 + case CALC_4: 431 + case CALC_5: 432 + case CALC_6: 433 + case CALC_7: 434 + case CALC_8: 435 + case CALC_9: 436 + case CALC_TOT: 437 + case CALC_RESET: 438 + case CALC_MUL: 439 + case CALC_ADD: 440 + case CALC_SUB: 441 + case CALC_P: 442 + case CALC_DIV: 443 + case CALC_SQRT: 444 + case CALC_000: 445 + case CALC_NEG: 446 + case CALC_PERC: 447 + case CALC_EURO: 448 + case CALC_L: 449 + case CALC_X: 450 + case CALC_I: 451 + case CALC_A: 452 + case CALC_B: 453 + case CALC_C: 454 + case CALC_D: 455 + case CALC_E: 456 + case CALC_F: 457 + c = (TCHAR)wParam; 458 + break; 459 + case 'z': 460 + c = CALC_000; 461 + break; 462 + case 'n': 463 + c = CALC_RESET; 464 + break; 465 + case 'q': 466 + c = CALC_SQRT; 467 + break; 468 + case 'i': 469 + c = CALC_I; 470 + break; 471 + case 'p': 472 + c = CALC_NEG; 473 + break; 474 + case 'r': 475 + c = CALC_EURO; 476 + break; 477 + case 'l': 478 + c = CALC_L; 479 + break; 480 + case 'x': 481 + c = CALC_X; 482 + break; 483 + case 'a': 484 + c = CALC_A; 485 + break; 486 + case 'b': 487 + c = CALC_B; 488 + break; 489 + case 'c': 490 + c = CALC_C; 491 + break; 492 + case 'd': 493 + c = CALC_D; 494 + break; 495 + case 'e': 496 + c = CALC_E; 497 + break; 498 + case 'f': 499 + c = CALC_F; 500 + break; 501 + default: 502 + bChangeState = false; 503 + } 504 + 505 + if (bChangeState) 506 + ProcessChar(hWnd, c); 507 + 508 + return (bChangeState ? 0 : 1); 509 + } 510 + 511 + void CCalculatorWindow::ProcessChar(HWND hWnd, TCHAR c) 512 + { 513 + //char oldString[1024]; 514 + TCHAR newString[1024]; 515 + 516 + m_unformatInputString = m_unformatOutputString; 517 + 518 + LPTSTR unformatOutputString = m_unformatOutputString.GetBuffer(1024); 519 + m_calc.change_state(c, m_unformatInputString.GetString(), unformatOutputString); 520 + 521 + m_unformatOutputString.ReleaseBuffer(-1); 522 + 523 + if (m_unformatOutputString != ERR_STR_OVERFLOW 524 + && m_unformatOutputString != ERR_STR_DIVBYZERO) 525 + { 526 + FormatString(m_unformatOutputString, newString); 527 + } 528 + else 529 + lstrcpy(newString, m_unformatOutputString); 530 + 531 + 532 + ::SetWindowText(hWnd, (LPCTSTR)newString); 533 + 534 + int l = lstrlen(newString); 535 + 536 + ::SendMessage(hWnd, EM_SETSEL, l, l); 537 + } 538 + 539 + bool CCalculatorWindow::FormatString(LPCTSTR strInput, LPTSTR strOutput) 540 + { 541 + _tcscpy_s(strOutput, 1024, strInput); 542 + 543 + if (m_calc.get_current_base() == calc::decimal) 544 + { 545 + LPTSTR cDecSep = _tcschr(strOutput, CALC_P); 546 + if (cDecSep != NULL) 547 + *cDecSep = m_cDecSepStandard; 548 + 549 + _tcsrev(strOutput); 550 + 551 + size_t len = _tcslen(strOutput); 552 + 553 + TCHAR strBuffer[1024]; 554 + 555 + INT y = -1; 556 + UINT j = 0; 557 + UINT numDecimalDigit = 0; 558 + 559 + bool bStartFormatting = false; 560 + if (cDecSep == NULL) 561 + { 562 + bStartFormatting = true; 563 + y = 0; 564 + } 565 + 566 + for (UINT i = 0; i<len; i++) 567 + { 568 + if (strOutput[i] == m_cDecSepStandard) 569 + { 570 + numDecimalDigit = i; 571 + bStartFormatting = true; 572 + } 573 + 574 + if (bStartFormatting) 575 + { 576 + if (y == 3 && strOutput[i] != CALC_SUB) 577 + { 578 + strBuffer[j++] = m_cMigSepStandard; 579 + y = 0; 580 + } 581 + y++; 582 + } 583 + 584 + strBuffer[j++] = strOutput[i]; 585 + } 586 + strBuffer[j] = '\0'; 587 + 588 + _tcsrev(strBuffer); 589 + _tcscpy_s(strOutput, 1024, strBuffer); 590 + } 591 + 592 + return true; 593 + } 594 + 595 + 596 + 597 + bool CCalculatorWindow::ReadRegionalSettings() 598 + { 599 + TCHAR strBuf[256]; 600 + 601 + m_cDecSepStandard = ','; 602 + m_cMigSepStandard = '.'; 603 + 604 + HKEY hKey; 605 + if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_CURRENT_USER, TEXT("Control Panel\\International"), 0, KEY_QUERY_VALUE, &hKey)) 606 + { 607 + DWORD dwDataType; 608 + DWORD dwDataSize = 256; 609 + if (ERROR_SUCCESS == RegQueryValueEx(hKey, TEXT("sDecimal"), NULL, &dwDataType, (LPBYTE)strBuf, &dwDataSize)) 610 + { 611 + if (strBuf[0] != '\0') 612 + m_cDecSepStandard = strBuf[0]; 613 + } 614 + 615 + dwDataSize = 256; 616 + if (ERROR_SUCCESS == RegQueryValueEx(hKey, TEXT("sThousand"), NULL, &dwDataType, (LPBYTE)strBuf, &dwDataSize)) 617 + { 618 + if (strBuf[0] != '\0') 619 + m_cMigSepStandard = strBuf[0]; 620 + } 621 + 622 + dwDataSize = 256; 623 + if (ERROR_SUCCESS == RegQueryValueEx(hKey, TEXT("iDigits"), NULL, &dwDataType, (LPBYTE)strBuf, &dwDataSize)) 624 + { 625 + if (strBuf[0] != '\0') 626 + m_numDecimalDigit = atoi((const char*)strBuf); 627 + 628 + m_calc.set_precision(m_numDecimalDigit); 629 + } 630 + 631 + RegCloseKey(hKey); 632 + } 633 + 634 + return true; 635 + } 636 + 637 + 638 + 639 + //////////////////////////////////////////////////////////////////////////////// 640 + 641 + 642 + LRESULT CALLBACK WndEditProc(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam) 643 + { 644 + CCalculatorWindow *pThis = (CCalculatorWindow*)::GetWindowLongPtr(hWnd, GWLP_USERDATA); 645 + static bool bKeyAlreadyProcessd = false; 646 + 647 + switch (uMessage) 648 + { 649 + case WM_GETDLGCODE: 650 + return DLGC_WANTALLKEYS; 651 + 652 + case WM_KEYDOWN: 653 + if (pThis->OnEditKeyDown(hWnd, wParam, lParam) == 0) 654 + { 655 + bKeyAlreadyProcessd = true; 656 + return 0; 657 + } 658 + else 659 + bKeyAlreadyProcessd = false; 660 + break; 661 + 662 + case WM_CHAR: 663 + if (bKeyAlreadyProcessd) 664 + return 0; 665 + if (pThis->OnEditChar(hWnd, wParam, lParam) == 0) 666 + return 0; 667 + break; 668 + 669 + case WM_SETFOCUS: 670 + ::HideCaret(hWnd); 671 + //pThis->OnSetFocus(); 672 + break; 673 + 674 + case WM_KILLFOCUS: 675 + //pThis->OnKillFocus(); 676 + break; 677 + case WM_SETTINGCHANGE: 678 + pThis->ReadRegionalSettings(); 679 + pThis->ProcessChar(hWnd, '_'); 680 + break; 681 + } 682 + 683 + return ::CallWindowProc(wpOrigEditProc, hWnd, uMessage, wParam, lParam); 684 + }
+84
CalculatorWindow.h
··· 1 + #pragma once 2 + 3 + using namespace ATL; 4 + 5 + //////////////////////////////////////////////////////////////////////////////// 6 + // CCalculatorWindow 7 + class CVisualStyle; 8 + 9 + class CCalculatorWindow : 10 + public CWindowImpl<CCalculatorWindow> 11 + { 12 + public: 13 + CCalculatorWindow(); 14 + ~CCalculatorWindow(); 15 + 16 + BOOL Create( 17 + HWND hwndParent, 18 + LPUNKNOWN pDeskBand, 19 + LPUNKNOWN pInputObjectSite); 20 + 21 + POINTL CalcMinimalSize() const; 22 + POINTL CalcIdealSize() const; 23 + BOOL HasFocus() const; 24 + 25 + LRESULT OnEditKeyDown(HWND hWnd, WPARAM wParam, LPARAM lParam); 26 + LRESULT OnEditChar(HWND hWnd, WPARAM wParam, LPARAM lParam); 27 + void ProcessChar(HWND hWnd, TCHAR c); 28 + bool FormatString(LPCTSTR strInput, LPTSTR strOutput); 29 + 30 + bool ReadRegionalSettings(); 31 + 32 + 33 + 34 + BEGIN_MSG_MAP(CCalculatorWindow) 35 + MESSAGE_HANDLER(WM_DESTROY, OnDestroy) 36 + MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) 37 + MESSAGE_HANDLER(WM_PAINT, OnPaint) 38 + MESSAGE_HANDLER(WM_SETFOCUS, OnFocus) 39 + MESSAGE_HANDLER(WM_KILLFOCUS, OnFocus) 40 + MESSAGE_HANDLER(WM_POWERBROADCAST, OnPowerBroadcast) 41 + MESSAGE_HANDLER(WM_THEMECHANGED, OnThemeChanged) 42 + END_MSG_MAP() 43 + 44 + // Handler prototypes: 45 + // LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 46 + // LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); 47 + // LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled); 48 + 49 + private: 50 + LRESULT OnFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 51 + LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 52 + LRESULT OnEraseBackground(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 53 + LRESULT OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 54 + LRESULT OnPowerBroadcast(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 55 + LRESULT OnThemeChanged(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 56 + 57 + void Paint(HDC hdc, const RECT& rcPaint) const; 58 + // UINT_PTR SetUpdateTimer(); 59 + 60 + calc m_calc; 61 + CString m_unformatInputString; 62 + CString m_unformatOutputString; 63 + 64 + TCHAR m_cDecSepStandard; 65 + TCHAR m_cMigSepStandard; 66 + 67 + UINT m_numDecimalDigit; 68 + 69 + 70 + private: 71 + IUnknown* m_pDeskBand; 72 + BOOL m_fHasFocus; 73 + CComQIPtr<IInputObjectSite> m_spInputObjectSite; 74 + CAutoPtr<CVisualStyle> m_ptrVisualStyle; 75 + 76 + //const DateFormat* m_pDateFormat; 77 + //SYSTEMTIME m_stLocalTime; 78 + //mutable CString m_sDateString; 79 + 80 + HWND m_hwndEdit; 81 + }; 82 + 83 + //////////////////////////////////////////////////////////////////////////////// 84 +
+16
DateFormatSettingsRes.h
··· 1 + //////////////////////////////////////////////////////////////////////////////// 2 + // Date format setting dialog id's 3 + 4 + #if !defined(DATE_FORMAT_DLG_RES_H) 5 + #define DATE_FORMAT_DLG_RES_H 6 + 7 + #define IDD_DATEFORMAT 0x800 8 + #define IDC_SHORTDATE 0x801 9 + #define IDC_LONGDATE 0x802 10 + #define IDC_CUSTOMDATE 0x803 11 + #define IDC_DATEFORMAT 0x804 12 + #define IDC_DATESAMPLE 0x806 13 + #define IDC_LANGUAGE 0x807 14 + #define IDC_CALENDARTYPE 0x808 15 + 16 + #endif // DATE_FORMAT_DLG_RES_H
+13
DllMain.cpp
··· 1 + // dllmain.cpp : Implementation of DllMain. 2 + 3 + #include "StdAfx.h" 4 + #include "DllMain.h" 5 + 6 + CCalculatorDeskBandModule _AtlModule; 7 + 8 + // DLL Entry Point 9 + extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) 10 + { 11 + hInstance; 12 + return _AtlModule.DllMain(dwReason, lpReserved); 13 + }
+12
DllMain.h
··· 1 + // dllmain.h : Declaration of module class. 2 + 3 + using namespace ATL; 4 + 5 + class CCalculatorDeskBandModule : public CAtlDllModuleT< CCalculatorDeskBandModule > 6 + { 7 + public : 8 + //DECLARE_LIBID(LIBID_CalendarDeskBandLib) 9 + //DECLARE_REGISTRY_APPID_RESOURCEID(IDR_CALENDARDESKBAND, "{F5CD352C-35E7-4EE6-B924-3C0486A6CBBA}") 10 + }; 11 + 12 + extern class CCalculatorDeskBandModule _AtlModule;
+11
Guids.h
··· 1 + #pragma once 2 + 3 + //////////////////////////////////////////////////////////////////////////////// 4 + // 5 + const size_t MAX_GUID_STRING_LEN = 39; 6 + 7 + extern const __declspec(selectany) CLSID CLSID_CalendarDeskBand = 8 + { 0x1B1E01F4, 0x6B08, 0x44F9, { 0xA1,0xE8,0x40,0xBC,0x40,0xB5,0x55,0x78 }}; 9 + 10 + //////////////////////////////////////////////////////////////////////////////// 11 +
Resource/tbcalc.ico

This is a binary file and will not be displayed.

+10
TaskbarCalculator.def
··· 1 + ; TaskbarCalculator.def : Declares the module parameters. 2 + 3 + LIBRARY "TaskbarCalculator.DLL" 4 + 5 + EXPORTS 6 + DllCanUnloadNow PRIVATE 7 + DllGetClassObject PRIVATE 8 + DllRegisterServer PRIVATE 9 + DllUnregisterServer PRIVATE 10 + DllInstall PRIVATE
+25
TaskbarCalculator.idl
··· 1 + // CalendarDeskBand.idl : IDL source for CalendarDeskBand 2 + // 3 + 4 + // This file will be processed by the MIDL tool to 5 + // produce the type library (CalendarDeskBand.tlb) and marshalling code. 6 + 7 + [ 8 + uuid(33EB8C00-F66A-493C-8607-529060FAA378), 9 + version(1.0), 10 + helpstring("CalendarDeskBand 1.0 Type Library") 11 + ] 12 + library CalendarDeskBandLib 13 + { 14 + importlib("stdole2.tlb"); 15 + [ 16 + uuid(1B1E01F4-6B08-44F9-A1E8-40BC40B55578), 17 + helpstring("CalendarDeskBand Class") 18 + ] 19 + coclass CalendarDeskBand 20 + { 21 + [default] interface IUnknown; 22 + }; 23 + 24 + cpp_quote("const size_t MAX_GUID_STRING_LEN = 39;") 25 + };
TaskbarCalculator.rc

This is a binary file and will not be displayed.

+13
TaskbarCalculator.rgs
··· 1 + HKCR 2 + { 3 + NoRemove CLSID 4 + { 5 + ForceRemove {1B1E01F4-6B08-44F9-A1E8-40BC40B55578} = s 'Taskbar Calculator' 6 + { 7 + InprocServer32 = s '%MODULE%' 8 + { 9 + val ThreadingModel = s 'Apartment' 10 + } 11 + } 12 + } 13 + }
+38
TaskbarCalculator.sln
··· 1 +  2 + Microsoft Visual Studio Solution File, Format Version 12.00 3 + # Visual Studio 15 4 + VisualStudioVersion = 15.0.28307.902 5 + MinimumVisualStudioVersion = 10.0.40219.1 6 + Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TaskbarCalculator", "TaskbarCalculator.vcxproj", "{19259675-A5B4-403D-B7AD-8337023D3C05}" 7 + EndProject 8 + Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "TaskbarCalculatorSetup", "..\TaskbarCalculatorSetup\TaskbarCalculatorSetup.vdproj", "{B9A41F3F-1B27-4CD3-8349-728B4F89687A}" 9 + EndProject 10 + Global 11 + GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 + Debug|Win32 = Debug|Win32 13 + Debug|x64 = Debug|x64 14 + Release|Win32 = Release|Win32 15 + Release|x64 = Release|x64 16 + EndGlobalSection 17 + GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 + {19259675-A5B4-403D-B7AD-8337023D3C05}.Debug|Win32.ActiveCfg = Debug|Win32 19 + {19259675-A5B4-403D-B7AD-8337023D3C05}.Debug|Win32.Build.0 = Debug|Win32 20 + {19259675-A5B4-403D-B7AD-8337023D3C05}.Debug|x64.ActiveCfg = Debug|x64 21 + {19259675-A5B4-403D-B7AD-8337023D3C05}.Debug|x64.Build.0 = Debug|x64 22 + {19259675-A5B4-403D-B7AD-8337023D3C05}.Release|Win32.ActiveCfg = Release|Win32 23 + {19259675-A5B4-403D-B7AD-8337023D3C05}.Release|Win32.Build.0 = Release|Win32 24 + {19259675-A5B4-403D-B7AD-8337023D3C05}.Release|x64.ActiveCfg = Release|x64 25 + {19259675-A5B4-403D-B7AD-8337023D3C05}.Release|x64.Build.0 = Release|x64 26 + {B9A41F3F-1B27-4CD3-8349-728B4F89687A}.Debug|Win32.ActiveCfg = Debug 27 + {B9A41F3F-1B27-4CD3-8349-728B4F89687A}.Debug|x64.ActiveCfg = Debug 28 + {B9A41F3F-1B27-4CD3-8349-728B4F89687A}.Release|Win32.ActiveCfg = Release 29 + {B9A41F3F-1B27-4CD3-8349-728B4F89687A}.Release|x64.ActiveCfg = Release 30 + {B9A41F3F-1B27-4CD3-8349-728B4F89687A}.Release|x64.Build.0 = Release 31 + EndGlobalSection 32 + GlobalSection(SolutionProperties) = preSolution 33 + HideSolutionNode = FALSE 34 + EndGlobalSection 35 + GlobalSection(ExtensibilityGlobals) = postSolution 36 + SolutionGuid = {DC8196CC-8775-426D-9DF9-BDB53AA6DBE1} 37 + EndGlobalSection 38 + EndGlobal
+586
TaskbarCalculator.vcproj
··· 1 + <?xml version="1.0" encoding="Windows-1252"?> 2 + <VisualStudioProject 3 + ProjectType="Visual C++" 4 + Version="9.00" 5 + Name="TaskbarCalculator" 6 + ProjectGUID="{19259675-A5B4-403D-B7AD-8337023D3C05}" 7 + RootNamespace="TaskbarCalculator" 8 + Keyword="AtlProj" 9 + TargetFrameworkVersion="196613" 10 + > 11 + <Platforms> 12 + <Platform 13 + Name="Win32" 14 + /> 15 + <Platform 16 + Name="x64" 17 + /> 18 + </Platforms> 19 + <ToolFiles> 20 + </ToolFiles> 21 + <Configurations> 22 + <Configuration 23 + Name="Debug|Win32" 24 + OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" 25 + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" 26 + ConfigurationType="2" 27 + UseOfATL="1" 28 + ATLMinimizesCRunTimeLibraryUsage="false" 29 + CharacterSet="1" 30 + > 31 + <Tool 32 + Name="VCPreBuildEventTool" 33 + /> 34 + <Tool 35 + Name="VCCustomBuildTool" 36 + /> 37 + <Tool 38 + Name="VCXMLDataGeneratorTool" 39 + /> 40 + <Tool 41 + Name="VCWebServiceProxyGeneratorTool" 42 + /> 43 + <Tool 44 + Name="VCMIDLTool" 45 + PreprocessorDefinitions="_DEBUG" 46 + MkTypLibCompatible="false" 47 + TargetEnvironment="1" 48 + GenerateStublessProxies="true" 49 + GenerateTypeLibrary="false" 50 + TypeLibraryName="TaskbarCalculator.tlb" 51 + OutputDirectory="$(SolutionDir)Common" 52 + HeaderFileName="TaskbarCalculator_i.h" 53 + DLLDataFileName="" 54 + InterfaceIdentifierFileName="TaskbarCalculator_i.c" 55 + ProxyFileName="TaskbarCalculator_p.c" 56 + ValidateParameters="true" 57 + /> 58 + <Tool 59 + Name="VCCLCompilerTool" 60 + Optimization="0" 61 + AdditionalIncludeDirectories="&quot;$(SolutionDir)Common&quot;" 62 + PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;_USRDLL" 63 + MinimalRebuild="true" 64 + BasicRuntimeChecks="3" 65 + RuntimeLibrary="1" 66 + UsePrecompiledHeader="2" 67 + BrowseInformation="1" 68 + WarningLevel="4" 69 + DebugInformationFormat="4" 70 + /> 71 + <Tool 72 + Name="VCManagedResourceCompilerTool" 73 + /> 74 + <Tool 75 + Name="VCResourceCompilerTool" 76 + PreprocessorDefinitions="_DEBUG" 77 + Culture="1033" 78 + AdditionalIncludeDirectories="&quot;$(SolutionDir)Common&quot;" 79 + /> 80 + <Tool 81 + Name="VCPreLinkEventTool" 82 + /> 83 + <Tool 84 + Name="VCLinkerTool" 85 + IgnoreImportLibrary="true" 86 + LinkIncremental="2" 87 + ModuleDefinitionFile=".\TaskbarCalculator.def" 88 + GenerateDebugInformation="true" 89 + SubSystem="2" 90 + TargetMachine="1" 91 + /> 92 + <Tool 93 + Name="VCALinkTool" 94 + /> 95 + <Tool 96 + Name="VCManifestTool" 97 + /> 98 + <Tool 99 + Name="VCXDCMakeTool" 100 + /> 101 + <Tool 102 + Name="VCBscMakeTool" 103 + /> 104 + <Tool 105 + Name="VCFxCopTool" 106 + /> 107 + <Tool 108 + Name="VCAppVerifierTool" 109 + /> 110 + <Tool 111 + Name="VCPostBuildEventTool" 112 + /> 113 + </Configuration> 114 + <Configuration 115 + Name="Debug|x64" 116 + OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" 117 + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" 118 + ConfigurationType="2" 119 + UseOfATL="1" 120 + ATLMinimizesCRunTimeLibraryUsage="false" 121 + CharacterSet="1" 122 + > 123 + <Tool 124 + Name="VCPreBuildEventTool" 125 + /> 126 + <Tool 127 + Name="VCCustomBuildTool" 128 + /> 129 + <Tool 130 + Name="VCXMLDataGeneratorTool" 131 + /> 132 + <Tool 133 + Name="VCWebServiceProxyGeneratorTool" 134 + /> 135 + <Tool 136 + Name="VCMIDLTool" 137 + PreprocessorDefinitions="_DEBUG" 138 + MkTypLibCompatible="false" 139 + TargetEnvironment="3" 140 + GenerateStublessProxies="true" 141 + GenerateTypeLibrary="false" 142 + TypeLibraryName="TaskbarCalculator.tlb" 143 + OutputDirectory="$(SolutionDir)Common" 144 + HeaderFileName="TaskbarCalculator_i.h" 145 + DLLDataFileName="" 146 + InterfaceIdentifierFileName="TaskbarCalculator_i.c" 147 + ProxyFileName="TaskbarCalculator_p.c" 148 + /> 149 + <Tool 150 + Name="VCCLCompilerTool" 151 + Optimization="0" 152 + AdditionalIncludeDirectories="&quot;$(SolutionDir)Common&quot;" 153 + PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;_USRDLL" 154 + MinimalRebuild="true" 155 + BasicRuntimeChecks="3" 156 + RuntimeLibrary="1" 157 + UsePrecompiledHeader="2" 158 + BrowseInformation="1" 159 + WarningLevel="4" 160 + DebugInformationFormat="3" 161 + /> 162 + <Tool 163 + Name="VCManagedResourceCompilerTool" 164 + /> 165 + <Tool 166 + Name="VCResourceCompilerTool" 167 + PreprocessorDefinitions="_DEBUG" 168 + Culture="1033" 169 + AdditionalIncludeDirectories="&quot;$(SolutionDir)Common&quot;" 170 + /> 171 + <Tool 172 + Name="VCPreLinkEventTool" 173 + /> 174 + <Tool 175 + Name="VCLinkerTool" 176 + IgnoreImportLibrary="true" 177 + LinkIncremental="2" 178 + ModuleDefinitionFile=".\TaskbarCalculator.def" 179 + GenerateDebugInformation="true" 180 + SubSystem="2" 181 + TargetMachine="17" 182 + /> 183 + <Tool 184 + Name="VCALinkTool" 185 + /> 186 + <Tool 187 + Name="VCManifestTool" 188 + /> 189 + <Tool 190 + Name="VCXDCMakeTool" 191 + /> 192 + <Tool 193 + Name="VCBscMakeTool" 194 + /> 195 + <Tool 196 + Name="VCFxCopTool" 197 + /> 198 + <Tool 199 + Name="VCAppVerifierTool" 200 + /> 201 + <Tool 202 + Name="VCPostBuildEventTool" 203 + /> 204 + </Configuration> 205 + <Configuration 206 + Name="Release|Win32" 207 + OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" 208 + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" 209 + ConfigurationType="2" 210 + UseOfATL="1" 211 + ATLMinimizesCRunTimeLibraryUsage="false" 212 + CharacterSet="1" 213 + WholeProgramOptimization="1" 214 + > 215 + <Tool 216 + Name="VCPreBuildEventTool" 217 + /> 218 + <Tool 219 + Name="VCCustomBuildTool" 220 + /> 221 + <Tool 222 + Name="VCXMLDataGeneratorTool" 223 + /> 224 + <Tool 225 + Name="VCWebServiceProxyGeneratorTool" 226 + /> 227 + <Tool 228 + Name="VCMIDLTool" 229 + PreprocessorDefinitions="NDEBUG" 230 + MkTypLibCompatible="false" 231 + TargetEnvironment="1" 232 + GenerateStublessProxies="true" 233 + GenerateTypeLibrary="false" 234 + TypeLibraryName="TaskbarCalculator.tlb" 235 + OutputDirectory="$(SolutionDir)Common" 236 + HeaderFileName="TaskbarCalculator_i.h" 237 + DLLDataFileName="" 238 + InterfaceIdentifierFileName="TaskbarCalculator_i.c" 239 + ProxyFileName="TaskbarCalculator_p.c" 240 + ValidateParameters="true" 241 + /> 242 + <Tool 243 + Name="VCCLCompilerTool" 244 + Optimization="3" 245 + EnableIntrinsicFunctions="true" 246 + WholeProgramOptimization="true" 247 + AdditionalIncludeDirectories="&quot;$(SolutionDir)Common&quot;" 248 + PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;_USRDLL" 249 + RuntimeLibrary="0" 250 + UsePrecompiledHeader="2" 251 + WarningLevel="3" 252 + DebugInformationFormat="3" 253 + /> 254 + <Tool 255 + Name="VCManagedResourceCompilerTool" 256 + /> 257 + <Tool 258 + Name="VCResourceCompilerTool" 259 + PreprocessorDefinitions="NDEBUG" 260 + Culture="1033" 261 + AdditionalIncludeDirectories="&quot;$(SolutionDir)Common&quot;" 262 + /> 263 + <Tool 264 + Name="VCPreLinkEventTool" 265 + /> 266 + <Tool 267 + Name="VCLinkerTool" 268 + IgnoreImportLibrary="true" 269 + LinkIncremental="1" 270 + ModuleDefinitionFile=".\TaskbarCalculator.def" 271 + GenerateDebugInformation="true" 272 + SubSystem="2" 273 + OptimizeReferences="2" 274 + EnableCOMDATFolding="2" 275 + TargetMachine="1" 276 + /> 277 + <Tool 278 + Name="VCALinkTool" 279 + /> 280 + <Tool 281 + Name="VCManifestTool" 282 + /> 283 + <Tool 284 + Name="VCXDCMakeTool" 285 + /> 286 + <Tool 287 + Name="VCBscMakeTool" 288 + /> 289 + <Tool 290 + Name="VCFxCopTool" 291 + /> 292 + <Tool 293 + Name="VCAppVerifierTool" 294 + /> 295 + <Tool 296 + Name="VCPostBuildEventTool" 297 + /> 298 + </Configuration> 299 + <Configuration 300 + Name="Release|x64" 301 + OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" 302 + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" 303 + ConfigurationType="2" 304 + UseOfATL="1" 305 + ATLMinimizesCRunTimeLibraryUsage="false" 306 + CharacterSet="1" 307 + WholeProgramOptimization="1" 308 + > 309 + <Tool 310 + Name="VCPreBuildEventTool" 311 + /> 312 + <Tool 313 + Name="VCCustomBuildTool" 314 + /> 315 + <Tool 316 + Name="VCXMLDataGeneratorTool" 317 + /> 318 + <Tool 319 + Name="VCWebServiceProxyGeneratorTool" 320 + /> 321 + <Tool 322 + Name="VCMIDLTool" 323 + PreprocessorDefinitions="NDEBUG" 324 + MkTypLibCompatible="false" 325 + TargetEnvironment="3" 326 + GenerateStublessProxies="true" 327 + GenerateTypeLibrary="false" 328 + TypeLibraryName="TaskbarCalculator.tlb" 329 + OutputDirectory="$(SolutionDir)Common" 330 + HeaderFileName="TaskbarCalculator_i.h" 331 + DLLDataFileName="" 332 + InterfaceIdentifierFileName="TaskbarCalculator_i.c" 333 + ProxyFileName="TaskbarCalculator_p.c" 334 + /> 335 + <Tool 336 + Name="VCCLCompilerTool" 337 + Optimization="3" 338 + EnableIntrinsicFunctions="true" 339 + WholeProgramOptimization="true" 340 + AdditionalIncludeDirectories="&quot;$(SolutionDir)Common&quot;" 341 + PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;_USRDLL" 342 + RuntimeLibrary="0" 343 + UsePrecompiledHeader="2" 344 + WarningLevel="3" 345 + DebugInformationFormat="3" 346 + /> 347 + <Tool 348 + Name="VCManagedResourceCompilerTool" 349 + /> 350 + <Tool 351 + Name="VCResourceCompilerTool" 352 + PreprocessorDefinitions="NDEBUG" 353 + Culture="1033" 354 + AdditionalIncludeDirectories="&quot;$(SolutionDir)Common&quot;" 355 + /> 356 + <Tool 357 + Name="VCPreLinkEventTool" 358 + /> 359 + <Tool 360 + Name="VCLinkerTool" 361 + IgnoreImportLibrary="true" 362 + LinkIncremental="1" 363 + ModuleDefinitionFile=".\TaskbarCalculator.def" 364 + GenerateDebugInformation="true" 365 + SubSystem="2" 366 + OptimizeReferences="2" 367 + EnableCOMDATFolding="2" 368 + TargetMachine="17" 369 + /> 370 + <Tool 371 + Name="VCALinkTool" 372 + /> 373 + <Tool 374 + Name="VCManifestTool" 375 + /> 376 + <Tool 377 + Name="VCXDCMakeTool" 378 + /> 379 + <Tool 380 + Name="VCBscMakeTool" 381 + /> 382 + <Tool 383 + Name="VCFxCopTool" 384 + /> 385 + <Tool 386 + Name="VCAppVerifierTool" 387 + /> 388 + <Tool 389 + Name="VCPostBuildEventTool" 390 + /> 391 + </Configuration> 392 + </Configurations> 393 + <References> 394 + </References> 395 + <Files> 396 + <Filter 397 + Name="Source Files" 398 + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" 399 + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" 400 + > 401 + <File 402 + RelativePath=".\TaskbarCalculator.cpp" 403 + > 404 + </File> 405 + <File 406 + RelativePath=".\TaskbarCalculator.def" 407 + > 408 + </File> 409 + <File 410 + RelativePath=".\TaskbarCalculatorDll.cpp" 411 + > 412 + </File> 413 + <File 414 + RelativePath=".\CalendarWindow.cpp" 415 + > 416 + </File> 417 + <File 418 + RelativePath="..\Common\DateFormat.cpp" 419 + > 420 + </File> 421 + <File 422 + RelativePath="..\Common\DateFormatSettings.cpp" 423 + > 424 + </File> 425 + <File 426 + RelativePath=".\DllMain.cpp" 427 + > 428 + <FileConfiguration 429 + Name="Debug|Win32" 430 + > 431 + <Tool 432 + Name="VCCLCompilerTool" 433 + UsePrecompiledHeader="0" 434 + CompileAsManaged="0" 435 + /> 436 + </FileConfiguration> 437 + <FileConfiguration 438 + Name="Debug|x64" 439 + > 440 + <Tool 441 + Name="VCCLCompilerTool" 442 + UsePrecompiledHeader="0" 443 + CompileAsManaged="0" 444 + /> 445 + </FileConfiguration> 446 + <FileConfiguration 447 + Name="Release|Win32" 448 + > 449 + <Tool 450 + Name="VCCLCompilerTool" 451 + UsePrecompiledHeader="0" 452 + CompileAsManaged="0" 453 + /> 454 + </FileConfiguration> 455 + <FileConfiguration 456 + Name="Release|x64" 457 + > 458 + <Tool 459 + Name="VCCLCompilerTool" 460 + UsePrecompiledHeader="0" 461 + CompileAsManaged="0" 462 + /> 463 + </FileConfiguration> 464 + </File> 465 + <File 466 + RelativePath=".\stdafx.cpp" 467 + > 468 + <FileConfiguration 469 + Name="Debug|Win32" 470 + > 471 + <Tool 472 + Name="VCCLCompilerTool" 473 + UsePrecompiledHeader="1" 474 + /> 475 + </FileConfiguration> 476 + <FileConfiguration 477 + Name="Debug|x64" 478 + > 479 + <Tool 480 + Name="VCCLCompilerTool" 481 + UsePrecompiledHeader="1" 482 + /> 483 + </FileConfiguration> 484 + <FileConfiguration 485 + Name="Release|Win32" 486 + > 487 + <Tool 488 + Name="VCCLCompilerTool" 489 + UsePrecompiledHeader="1" 490 + /> 491 + </FileConfiguration> 492 + <FileConfiguration 493 + Name="Release|x64" 494 + > 495 + <Tool 496 + Name="VCCLCompilerTool" 497 + UsePrecompiledHeader="1" 498 + /> 499 + </FileConfiguration> 500 + </File> 501 + <File 502 + RelativePath="..\Common\Utils.cpp" 503 + > 504 + </File> 505 + <File 506 + RelativePath=".\VisualStyle.cpp" 507 + > 508 + </File> 509 + </Filter> 510 + <Filter 511 + Name="Header Files" 512 + Filter="h;hpp;hxx;hm;inl;inc;xsd" 513 + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" 514 + > 515 + <File 516 + RelativePath=".\TaskbarCalculator.h" 517 + > 518 + </File> 519 + <File 520 + RelativePath=".\CalendarWindow.h" 521 + > 522 + </File> 523 + <File 524 + RelativePath="..\Common\DateFormat.h" 525 + > 526 + </File> 527 + <File 528 + RelativePath="..\Common\DateFormatSettings.h" 529 + > 530 + </File> 531 + <File 532 + RelativePath=".\DllMain.h" 533 + > 534 + </File> 535 + <File 536 + RelativePath=".\Resource.h" 537 + > 538 + </File> 539 + <File 540 + RelativePath=".\stdafx.h" 541 + > 542 + </File> 543 + <File 544 + RelativePath=".\targetver.h" 545 + > 546 + </File> 547 + <File 548 + RelativePath="..\Common\Utils.h" 549 + > 550 + </File> 551 + <File 552 + RelativePath=".\VisualStyle.h" 553 + > 554 + </File> 555 + </Filter> 556 + <Filter 557 + Name="Resource Files" 558 + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" 559 + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" 560 + > 561 + <File 562 + RelativePath=".\TaskbarCalculator.rc" 563 + > 564 + </File> 565 + <File 566 + RelativePath=".\TaskbarCalculator.rgs" 567 + > 568 + </File> 569 + </Filter> 570 + <Filter 571 + Name="Generated Files" 572 + SourceControlFiles="false" 573 + > 574 + </Filter> 575 + <File 576 + RelativePath=".\ReadMe.txt" 577 + > 578 + </File> 579 + </Files> 580 + <Globals> 581 + <Global 582 + Name="RESOURCE_FILE" 583 + Value="TaskbarCalculator.rc" 584 + /> 585 + </Globals> 586 + </VisualStudioProject>
+314
TaskbarCalculator.vcxproj
··· 1 + <?xml version="1.0" encoding="utf-8"?> 2 + <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 3 + <ItemGroup Label="ProjectConfigurations"> 4 + <ProjectConfiguration Include="Debug|Win32"> 5 + <Configuration>Debug</Configuration> 6 + <Platform>Win32</Platform> 7 + </ProjectConfiguration> 8 + <ProjectConfiguration Include="Debug|x64"> 9 + <Configuration>Debug</Configuration> 10 + <Platform>x64</Platform> 11 + </ProjectConfiguration> 12 + <ProjectConfiguration Include="Release|Win32"> 13 + <Configuration>Release</Configuration> 14 + <Platform>Win32</Platform> 15 + </ProjectConfiguration> 16 + <ProjectConfiguration Include="Release|x64"> 17 + <Configuration>Release</Configuration> 18 + <Platform>x64</Platform> 19 + </ProjectConfiguration> 20 + </ItemGroup> 21 + <PropertyGroup Label="Globals"> 22 + <ProjectGuid>{19259675-A5B4-403D-B7AD-8337023D3C05}</ProjectGuid> 23 + <RootNamespace>TaskbarCalculator</RootNamespace> 24 + <Keyword>AtlProj</Keyword> 25 + <ProjectName>TaskbarCalculator</ProjectName> 26 + <WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion> 27 + </PropertyGroup> 28 + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> 29 + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> 30 + <ConfigurationType>DynamicLibrary</ConfigurationType> 31 + <PlatformToolset>v141</PlatformToolset> 32 + <UseOfAtl>Static</UseOfAtl> 33 + <CharacterSet>Unicode</CharacterSet> 34 + <WholeProgramOptimization>true</WholeProgramOptimization> 35 + </PropertyGroup> 36 + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> 37 + <ConfigurationType>DynamicLibrary</ConfigurationType> 38 + <PlatformToolset>v141</PlatformToolset> 39 + <UseOfAtl>Static</UseOfAtl> 40 + <CharacterSet>Unicode</CharacterSet> 41 + </PropertyGroup> 42 + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> 43 + <ConfigurationType>DynamicLibrary</ConfigurationType> 44 + <PlatformToolset>v141</PlatformToolset> 45 + <UseOfAtl>Static</UseOfAtl> 46 + <CharacterSet>Unicode</CharacterSet> 47 + <WholeProgramOptimization>true</WholeProgramOptimization> 48 + </PropertyGroup> 49 + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> 50 + <ConfigurationType>DynamicLibrary</ConfigurationType> 51 + <PlatformToolset>v141</PlatformToolset> 52 + <UseOfAtl>Static</UseOfAtl> 53 + <CharacterSet>Unicode</CharacterSet> 54 + </PropertyGroup> 55 + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> 56 + <ImportGroup Label="ExtensionSettings"> 57 + </ImportGroup> 58 + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> 59 + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> 60 + </ImportGroup> 61 + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> 62 + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> 63 + </ImportGroup> 64 + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> 65 + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> 66 + </ImportGroup> 67 + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> 68 + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> 69 + </ImportGroup> 70 + <PropertyGroup Label="UserMacros" /> 71 + <PropertyGroup> 72 + <_ProjectFileVersion>12.0.30501.0</_ProjectFileVersion> 73 + </PropertyGroup> 74 + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> 75 + <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> 76 + <IntDir>$(Platform)\$(Configuration)\</IntDir> 77 + <IgnoreImportLibrary>true</IgnoreImportLibrary> 78 + <LinkIncremental>true</LinkIncremental> 79 + </PropertyGroup> 80 + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> 81 + <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> 82 + <IntDir>$(Platform)\$(Configuration)\</IntDir> 83 + <IgnoreImportLibrary>true</IgnoreImportLibrary> 84 + <LinkIncremental>true</LinkIncremental> 85 + <CodeAnalysisRuleSet>NativeMinimumRules.ruleset</CodeAnalysisRuleSet> 86 + </PropertyGroup> 87 + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> 88 + <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> 89 + <IntDir>$(Platform)\$(Configuration)\</IntDir> 90 + <IgnoreImportLibrary>true</IgnoreImportLibrary> 91 + <LinkIncremental>false</LinkIncremental> 92 + </PropertyGroup> 93 + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> 94 + <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> 95 + <IntDir>$(Platform)\$(Configuration)\</IntDir> 96 + <IgnoreImportLibrary>true</IgnoreImportLibrary> 97 + <LinkIncremental>false</LinkIncremental> 98 + </PropertyGroup> 99 + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> 100 + <Midl> 101 + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> 102 + <MkTypLibCompatible>false</MkTypLibCompatible> 103 + <TargetEnvironment>Win32</TargetEnvironment> 104 + <GenerateStublessProxies>true</GenerateStublessProxies> 105 + <GenerateTypeLibrary>false</GenerateTypeLibrary> 106 + <TypeLibraryName>TaskbarCalculator.tlb</TypeLibraryName> 107 + <OutputDirectory>$(SolutionDir)Common</OutputDirectory> 108 + <HeaderFileName>TaskbarCalculator_i.h</HeaderFileName> 109 + <DllDataFileName /> 110 + <InterfaceIdentifierFileName>TaskbarCalculator_i.c</InterfaceIdentifierFileName> 111 + <ProxyFileName>TaskbarCalculator_p.c</ProxyFileName> 112 + <ValidateAllParameters>true</ValidateAllParameters> 113 + </Midl> 114 + <ClCompile> 115 + <Optimization>Disabled</Optimization> 116 + <AdditionalIncludeDirectories>$(SolutionDir)Common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> 117 + <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> 118 + <MinimalRebuild>true</MinimalRebuild> 119 + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> 120 + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> 121 + <PrecompiledHeader>Use</PrecompiledHeader> 122 + <BrowseInformation>true</BrowseInformation> 123 + <WarningLevel>Level4</WarningLevel> 124 + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> 125 + </ClCompile> 126 + <ResourceCompile> 127 + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> 128 + <Culture>0x0409</Culture> 129 + <AdditionalIncludeDirectories>$(SolutionDir)Common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> 130 + </ResourceCompile> 131 + <Link> 132 + <ModuleDefinitionFile>.\TaskbarCalculator.def</ModuleDefinitionFile> 133 + <GenerateDebugInformation>true</GenerateDebugInformation> 134 + <SubSystem>Windows</SubSystem> 135 + <TargetMachine>MachineX86</TargetMachine> 136 + </Link> 137 + </ItemDefinitionGroup> 138 + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> 139 + <Midl> 140 + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> 141 + <MkTypLibCompatible>false</MkTypLibCompatible> 142 + <TargetEnvironment>X64</TargetEnvironment> 143 + <GenerateStublessProxies>true</GenerateStublessProxies> 144 + <GenerateTypeLibrary>false</GenerateTypeLibrary> 145 + <TypeLibraryName>TaskbarCalculator.tlb</TypeLibraryName> 146 + <OutputDirectory>$(SolutionDir)Common</OutputDirectory> 147 + <HeaderFileName>TaskbarCalculator_i.h</HeaderFileName> 148 + <DllDataFileName /> 149 + <InterfaceIdentifierFileName>TaskbarCalculator_i.c</InterfaceIdentifierFileName> 150 + <ProxyFileName>TaskbarCalculator_p.c</ProxyFileName> 151 + </Midl> 152 + <ClCompile> 153 + <Optimization>Disabled</Optimization> 154 + <AdditionalIncludeDirectories>$(SolutionDir)Common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> 155 + <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> 156 + <MinimalRebuild>true</MinimalRebuild> 157 + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> 158 + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> 159 + <PrecompiledHeader>Use</PrecompiledHeader> 160 + <BrowseInformation>true</BrowseInformation> 161 + <WarningLevel>Level4</WarningLevel> 162 + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> 163 + </ClCompile> 164 + <ResourceCompile> 165 + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> 166 + <Culture>0x0409</Culture> 167 + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> 168 + </ResourceCompile> 169 + <Link> 170 + <ModuleDefinitionFile>.\TaskbarCalculator.def</ModuleDefinitionFile> 171 + <GenerateDebugInformation>true</GenerateDebugInformation> 172 + <SubSystem>Windows</SubSystem> 173 + <TargetMachine>MachineX64</TargetMachine> 174 + </Link> 175 + </ItemDefinitionGroup> 176 + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> 177 + <Midl> 178 + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> 179 + <MkTypLibCompatible>false</MkTypLibCompatible> 180 + <TargetEnvironment>Win32</TargetEnvironment> 181 + <GenerateStublessProxies>true</GenerateStublessProxies> 182 + <GenerateTypeLibrary>false</GenerateTypeLibrary> 183 + <TypeLibraryName>TaskbarCalculator.tlb</TypeLibraryName> 184 + <OutputDirectory>$(SolutionDir)Common</OutputDirectory> 185 + <HeaderFileName>TaskbarCalculator_i.h</HeaderFileName> 186 + <DllDataFileName /> 187 + <InterfaceIdentifierFileName>TaskbarCalculator_i.c</InterfaceIdentifierFileName> 188 + <ProxyFileName>TaskbarCalculator_p.c</ProxyFileName> 189 + <ValidateAllParameters>true</ValidateAllParameters> 190 + </Midl> 191 + <ClCompile> 192 + <Optimization>Full</Optimization> 193 + <IntrinsicFunctions>true</IntrinsicFunctions> 194 + <WholeProgramOptimization>true</WholeProgramOptimization> 195 + <AdditionalIncludeDirectories>$(SolutionDir)Common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> 196 + <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> 197 + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> 198 + <PrecompiledHeader>Use</PrecompiledHeader> 199 + <WarningLevel>Level3</WarningLevel> 200 + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> 201 + </ClCompile> 202 + <ResourceCompile> 203 + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> 204 + <Culture>0x0409</Culture> 205 + <AdditionalIncludeDirectories>$(SolutionDir)Common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> 206 + </ResourceCompile> 207 + <Link> 208 + <ModuleDefinitionFile>.\TaskbarCalculator.def</ModuleDefinitionFile> 209 + <GenerateDebugInformation>true</GenerateDebugInformation> 210 + <SubSystem>Windows</SubSystem> 211 + <OptimizeReferences>true</OptimizeReferences> 212 + <EnableCOMDATFolding>true</EnableCOMDATFolding> 213 + <TargetMachine>MachineX86</TargetMachine> 214 + </Link> 215 + </ItemDefinitionGroup> 216 + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> 217 + <Midl> 218 + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> 219 + <MkTypLibCompatible>false</MkTypLibCompatible> 220 + <TargetEnvironment>X64</TargetEnvironment> 221 + <GenerateStublessProxies>true</GenerateStublessProxies> 222 + <GenerateTypeLibrary>false</GenerateTypeLibrary> 223 + <TypeLibraryName>TaskbarCalculator.tlb</TypeLibraryName> 224 + <OutputDirectory>$(SolutionDir)Common</OutputDirectory> 225 + <HeaderFileName>TaskbarCalculator_i.h</HeaderFileName> 226 + <DllDataFileName /> 227 + <InterfaceIdentifierFileName>TaskbarCalculator_i.c</InterfaceIdentifierFileName> 228 + <ProxyFileName>TaskbarCalculator_p.c</ProxyFileName> 229 + </Midl> 230 + <ClCompile> 231 + <Optimization>Full</Optimization> 232 + <IntrinsicFunctions>true</IntrinsicFunctions> 233 + <WholeProgramOptimization>true</WholeProgramOptimization> 234 + <AdditionalIncludeDirectories>$(SolutionDir)Common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> 235 + <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> 236 + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> 237 + <PrecompiledHeader>Use</PrecompiledHeader> 238 + <WarningLevel>Level3</WarningLevel> 239 + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> 240 + </ClCompile> 241 + <ResourceCompile> 242 + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> 243 + <Culture>0x0409</Culture> 244 + <AdditionalIncludeDirectories>$(SolutionDir)Common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> 245 + </ResourceCompile> 246 + <Link> 247 + <ModuleDefinitionFile>.\TaskbarCalculator.def</ModuleDefinitionFile> 248 + <GenerateDebugInformation>true</GenerateDebugInformation> 249 + <SubSystem>Windows</SubSystem> 250 + <OptimizeReferences>true</OptimizeReferences> 251 + <EnableCOMDATFolding>true</EnableCOMDATFolding> 252 + <TargetMachine>MachineX64</TargetMachine> 253 + </Link> 254 + </ItemDefinitionGroup> 255 + <ItemGroup> 256 + <ClCompile Include="Calculator.cpp" /> 257 + <ClCompile Include="CalculatorDeskBand.cpp" /> 258 + <ClCompile Include="TaskbarCalculatorDeskBandDll.cpp" /> 259 + <ClCompile Include="CalculatorWindow.cpp" /> 260 + <ClCompile Include="DllMain.cpp"> 261 + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> 262 + </PrecompiledHeader> 263 + <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged> 264 + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> 265 + </PrecompiledHeader> 266 + <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</CompileAsManaged> 267 + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> 268 + </PrecompiledHeader> 269 + <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsManaged> 270 + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> 271 + </PrecompiledHeader> 272 + <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</CompileAsManaged> 273 + </ClCompile> 274 + <ClCompile Include="stdafx.cpp"> 275 + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> 276 + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader> 277 + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader> 278 + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader> 279 + </ClCompile> 280 + <ClCompile Include="Utils.cpp" /> 281 + <ClCompile Include="VisualStyle.cpp" /> 282 + </ItemGroup> 283 + <ItemGroup> 284 + <None Include="TaskbarCalculator.def" /> 285 + <None Include="TaskbarCalculator.rgs" /> 286 + </ItemGroup> 287 + <ItemGroup> 288 + <ClInclude Include="Calculator.h" /> 289 + <ClInclude Include="CalculatorDeskBand.h" /> 290 + <ClInclude Include="CalculatorWindow.h" /> 291 + <ClInclude Include="DateFormatSettingsRes.h" /> 292 + <ClInclude Include="DllMain.h" /> 293 + <ClInclude Include="Guids.h" /> 294 + <ClInclude Include="Resource.h" /> 295 + <ClInclude Include="stdafx.h" /> 296 + <ClInclude Include="targetver.h" /> 297 + <ClInclude Include="Utils.h" /> 298 + <ClInclude Include="VisualStyle.h" /> 299 + </ItemGroup> 300 + <ItemGroup> 301 + <ResourceCompile Include="TaskbarCalculator.rc" /> 302 + </ItemGroup> 303 + <ItemGroup> 304 + <Image Include="Resource\tbcalc.ico" /> 305 + </ItemGroup> 306 + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> 307 + <ImportGroup Label="ExtensionTargets"> 308 + </ImportGroup> 309 + <ProjectExtensions> 310 + <VisualStudio> 311 + <UserProperties RESOURCE_FILE="TaskbarCalculator.rc" /> 312 + </VisualStudio> 313 + </ProjectExtensions> 314 + </Project>
+100
TaskbarCalculator.vcxproj.filters
··· 1 + <?xml version="1.0" encoding="utf-8"?> 2 + <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 3 + <ItemGroup> 4 + <Filter Include="Source Files"> 5 + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> 6 + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> 7 + </Filter> 8 + <Filter Include="Header Files"> 9 + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> 10 + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> 11 + </Filter> 12 + <Filter Include="Resource Files"> 13 + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> 14 + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions> 15 + </Filter> 16 + <Filter Include="Generated Files"> 17 + <UniqueIdentifier>{7fe65bbb-c699-4ce1-8508-3dd5ce94ffd7}</UniqueIdentifier> 18 + <SourceControlFiles>False</SourceControlFiles> 19 + </Filter> 20 + </ItemGroup> 21 + <ItemGroup> 22 + <ClCompile Include="DllMain.cpp"> 23 + <Filter>Source Files</Filter> 24 + </ClCompile> 25 + <ClCompile Include="stdafx.cpp"> 26 + <Filter>Source Files</Filter> 27 + </ClCompile> 28 + <ClCompile Include="VisualStyle.cpp"> 29 + <Filter>Source Files</Filter> 30 + </ClCompile> 31 + <ClCompile Include="Calculator.cpp"> 32 + <Filter>Source Files</Filter> 33 + </ClCompile> 34 + <ClCompile Include="CalculatorDeskBand.cpp"> 35 + <Filter>Source Files</Filter> 36 + </ClCompile> 37 + <ClCompile Include="Utils.cpp"> 38 + <Filter>Source Files</Filter> 39 + </ClCompile> 40 + <ClCompile Include="TaskbarCalculatorDeskBandDll.cpp"> 41 + <Filter>Source Files</Filter> 42 + </ClCompile> 43 + <ClCompile Include="CalculatorWindow.cpp"> 44 + <Filter>Source Files</Filter> 45 + </ClCompile> 46 + </ItemGroup> 47 + <ItemGroup> 48 + <None Include="TaskbarCalculator.def"> 49 + <Filter>Source Files</Filter> 50 + </None> 51 + <None Include="TaskbarCalculator.rgs"> 52 + <Filter>Resource Files</Filter> 53 + </None> 54 + </ItemGroup> 55 + <ItemGroup> 56 + <ClInclude Include="DllMain.h"> 57 + <Filter>Header Files</Filter> 58 + </ClInclude> 59 + <ClInclude Include="Resource.h"> 60 + <Filter>Header Files</Filter> 61 + </ClInclude> 62 + <ClInclude Include="stdafx.h"> 63 + <Filter>Header Files</Filter> 64 + </ClInclude> 65 + <ClInclude Include="targetver.h"> 66 + <Filter>Header Files</Filter> 67 + </ClInclude> 68 + <ClInclude Include="VisualStyle.h"> 69 + <Filter>Header Files</Filter> 70 + </ClInclude> 71 + <ClInclude Include="Calculator.h"> 72 + <Filter>Header Files</Filter> 73 + </ClInclude> 74 + <ClInclude Include="CalculatorDeskBand.h"> 75 + <Filter>Header Files</Filter> 76 + </ClInclude> 77 + <ClInclude Include="Guids.h"> 78 + <Filter>Header Files</Filter> 79 + </ClInclude> 80 + <ClInclude Include="CalculatorWindow.h"> 81 + <Filter>Header Files</Filter> 82 + </ClInclude> 83 + <ClInclude Include="Utils.h"> 84 + <Filter>Header Files</Filter> 85 + </ClInclude> 86 + <ClInclude Include="DateFormatSettingsRes.h"> 87 + <Filter>Header Files</Filter> 88 + </ClInclude> 89 + </ItemGroup> 90 + <ItemGroup> 91 + <ResourceCompile Include="TaskbarCalculator.rc"> 92 + <Filter>Resource Files</Filter> 93 + </ResourceCompile> 94 + </ItemGroup> 95 + <ItemGroup> 96 + <Image Include="Resource\tbcalc.ico"> 97 + <Filter>Resource Files</Filter> 98 + </Image> 99 + </ItemGroup> 100 + </Project>
+66
TaskbarCalculatorDeskBandDll.cpp
··· 1 + // CalendarDeskBand.cpp : Implementation of DLL Exports. 2 + 3 + #include "stdafx.h" 4 + #include "Guids.h" 5 + #include "DllMain.h" 6 + 7 + // Used to determine whether the DLL can be unloaded by OLE 8 + STDAPI DllCanUnloadNow(void) 9 + { 10 + return _AtlModule.DllCanUnloadNow(); 11 + } 12 + 13 + 14 + // Returns a class factory to create an object of the requested type 15 + STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) 16 + { 17 + return _AtlModule.DllGetClassObject(rclsid, riid, ppv); 18 + } 19 + 20 + 21 + // DllRegisterServer - Adds entries to the system registry 22 + STDAPI DllRegisterServer(void) 23 + { 24 + // registers object, typelib and all interfaces in typelib 25 + return _AtlModule.DllRegisterServer(/*bRegTypeLib =*/ FALSE); 26 + } 27 + 28 + 29 + // DllUnregisterServer - Removes entries from the system registry 30 + STDAPI DllUnregisterServer(void) 31 + { 32 + return _AtlModule.DllUnregisterServer(/*bUnRegTypeLib =*/ FALSE); 33 + } 34 + 35 + // DllInstall - Adds/Removes entries to the system registry per user 36 + // per machine. 37 + STDAPI DllInstall(BOOL bInstall, LPCWSTR pszCmdLine) 38 + { 39 + HRESULT hr = E_FAIL; 40 + static const wchar_t szUserSwitch[] = _T("user"); 41 + 42 + if (pszCmdLine != NULL) 43 + { 44 + if (_wcsnicmp(pszCmdLine, szUserSwitch, _countof(szUserSwitch)) == 0) 45 + { 46 + AtlSetPerUserRegistration(true); 47 + } 48 + } 49 + 50 + if (bInstall) 51 + { 52 + hr = DllRegisterServer(); 53 + if (FAILED(hr)) 54 + { 55 + DllUnregisterServer(); 56 + } 57 + } 58 + else 59 + { 60 + hr = DllUnregisterServer(); 61 + } 62 + 63 + return hr; 64 + } 65 + 66 +
+24
Utils.cpp
··· 1 + #include "StdAfx.h" 2 + #include "Utils.h" 3 + #include "Guids.h" 4 + 5 + using namespace ATL; 6 + 7 + //////////////////////////////////////////////////////////////////////////////// 8 + // 9 + bool IsVistaOrHigher() 10 + { 11 + OSVERSIONINFOEX osVersionInfo; 12 + ::ZeroMemory(&osVersionInfo, sizeof(OSVERSIONINFOEX)); 13 + osVersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); 14 + osVersionInfo.dwMajorVersion = 6; 15 + ULONGLONG maskCondition = ::VerSetConditionMask(0, VER_MAJORVERSION, VER_GREATER_EQUAL); 16 + return (::VerifyVersionInfo(&osVersionInfo, VER_MAJORVERSION, maskCondition) == TRUE); 17 + 18 + //const DWORD dwVersion = ::GetVersion(); 19 + //const DWORD dwMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion))); 20 + 21 + //return dwMajorVersion >= 6; // Vista or higher 22 + } 23 + 24 + ////////////////////////////////////////////////////////////////////////////////
+8
Utils.h
··· 1 + #pragma once 2 + 3 + //////////////////////////////////////////////////////////////////////////////// 4 + // 5 + 6 + bool IsVistaOrHigher(); 7 + 8 + ////////////////////////////////////////////////////////////////////////////////
+139
VisualStyle.cpp
··· 1 + //////////////////////////////////////////////////////////////////////////////// 2 + // 3 + #include "StdAfx.h" 4 + #include "VisualStyle.h" 5 + #include "Utils.h" 6 + 7 + //////////////////////////////////////////////////////////////////////////////// 8 + // Classic visual style 9 + 10 + class CClassicVisualStyle : public CVisualStyle 11 + { 12 + public: 13 + CClassicVisualStyle() 14 + { 15 + CreateFont(); 16 + CreateTextColor(); 17 + } 18 + 19 + virtual void DrawBackground(HWND /*hWnd*/, HDC hdc, const RECT& rcPaint) const 20 + { 21 + ::FillRect(hdc, &rcPaint, ::GetSysColorBrush(CTLCOLOR_DLG)); 22 + } 23 + 24 + private: 25 + bool CreateFont() 26 + { 27 + NONCLIENTMETRICS ncm = { 0 }; 28 + ncm.cbSize = sizeof(NONCLIENTMETRICS) - 29 + (::IsVistaOrHigher() ? 0 : sizeof(ncm.iPaddedBorderWidth)); 30 + 31 + if(::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, 0)) 32 + m_hFont = ::CreateFontIndirect(&ncm.lfMessageFont); 33 + 34 + ATLASSERT(m_hFont); 35 + 36 + return (m_hFont != NULL); 37 + } 38 + 39 + bool CreateTextColor() 40 + { 41 + m_clrText = ::GetSysColor(COLOR_MENUTEXT); 42 + 43 + return true; 44 + } 45 + }; 46 + 47 + //////////////////////////////////////////////////////////////////////////////// 48 + // Themed visual style 49 + 50 + class CThemedVisualStyle : public CVisualStyle 51 + { 52 + public: 53 + CThemedVisualStyle() 54 + { 55 + CreateFont(); 56 + CreateTextColor(); 57 + } 58 + 59 + virtual void DrawBackground(HWND hWnd, HDC hdc, const RECT& rcPaint) const 60 + { 61 + ::DrawThemeParentBackground(hWnd, hdc, &rcPaint); 62 + } 63 + 64 + private: 65 + bool CreateFont() 66 + { 67 + HTHEME hTheme = ::OpenThemeData(NULL, VSCLASS_REBAR); 68 + ATLASSERT(hTheme); 69 + 70 + if(hTheme) 71 + { 72 + LOGFONT lf = { 0 }; 73 + const HRESULT hr = ::GetThemeFont(hTheme, 74 + NULL, RP_BAND, 0, TMT_FONT, &lf); 75 + ATLASSERT(SUCCEEDED(hr)); 76 + 77 + if(SUCCEEDED(hr)) 78 + { 79 + lf.lfWeight = 600; 80 + m_hFont = ::CreateFontIndirect(&lf); 81 + ATLASSERT(m_hFont); 82 + } 83 + 84 + ::CloseThemeData(hTheme); 85 + } 86 + 87 + return (m_hFont != NULL); 88 + } 89 + 90 + bool CreateTextColor() 91 + { 92 + bool bRet = false; 93 + HTHEME hTheme = ::OpenThemeData(NULL, VSCLASS_TASKBAND); 94 + ATLASSERT(hTheme); 95 + 96 + if(hTheme) 97 + { 98 + const HRESULT hr = ::GetThemeColor(hTheme, 99 + TDP_GROUPCOUNT, 0, TMT_TEXTCOLOR, &m_clrText); 100 + ATLASSERT(SUCCEEDED(hr)); 101 + 102 + ::CloseThemeData(hTheme); 103 + bRet = SUCCEEDED(hr); 104 + } 105 + 106 + return bRet; 107 + } 108 + }; 109 + 110 + 111 + //////////////////////////////////////////////////////////////////////////////// 112 + // CVisualStyle 113 + 114 + CVisualStyle::~CVisualStyle() 115 + { 116 + if(m_hFont) ::DeleteObject(m_hFont); 117 + } 118 + 119 + // static 120 + CVisualStyle* CVisualStyle::Create(VisualStyle vs) 121 + { 122 + CVisualStyle* pVS = NULL; 123 + 124 + if(vs == Auto) vs = (::IsAppThemed() ? Themed : Classic); 125 + 126 + switch(vs) 127 + { 128 + case Classic: 129 + pVS = new CClassicVisualStyle; 130 + break; 131 + case Themed: 132 + pVS = new CThemedVisualStyle; 133 + break; 134 + default: 135 + ATLASSERT(FALSE); 136 + } 137 + 138 + return pVS; 139 + }
+37
VisualStyle.h
··· 1 + #pragma once 2 + 3 + //////////////////////////////////////////////////////////////////////////////// 4 + // 5 + 6 + class CVisualStyle 7 + { 8 + public: 9 + enum VisualStyle 10 + { 11 + Auto, 12 + Classic, 13 + Themed, 14 + }; 15 + 16 + public: 17 + CVisualStyle() : m_hFont(NULL), m_clrText(0) {} 18 + virtual ~CVisualStyle(); 19 + 20 + HFONT GetFont() const { return m_hFont; } 21 + COLORREF GetTextColor() const { return m_clrText; } 22 + 23 + virtual void DrawBackground(HWND hWnd, HDC hdc, const RECT& rcPaint) const = 0; 24 + 25 + static CVisualStyle* Create(VisualStyle vs = Auto); 26 + 27 + protected: 28 + HFONT m_hFont; 29 + COLORREF m_clrText; 30 + 31 + private: 32 + // notcopyable 33 + CVisualStyle(const CVisualStyle&); 34 + CVisualStyle& operator=(const CVisualStyle&); 35 + }; 36 + 37 + ////////////////////////////////////////////////////////////////////////////////
icon1.ico

This is a binary file and will not be displayed.

resource.h

This is a binary file and will not be displayed.

+5
stdafx.cpp
··· 1 + // stdafx.cpp : source file that includes just the standard includes 2 + // CalendarDeskBand.pch will be the pre-compiled header 3 + // stdafx.obj will contain the pre-compiled type information 4 + 5 + #include "stdafx.h"
+51
stdafx.h
··· 1 + // stdafx.h : include file for standard system include files, 2 + // or project specific include files that are used frequently, 3 + // but are changed infrequently 4 + 5 + #pragma once 6 + 7 + #ifndef STRICT 8 + #define STRICT 9 + #endif 10 + 11 + #include "targetver.h" 12 + 13 + #define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES 1 // Enable template overloads of standard CRT functions 14 + #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 15 + #define VC_EXTRALEAN 16 + 17 + // Windows header files 18 + #include <Windows.h> 19 + #include <WindowsX.h> 20 + #include <ShlObj.h> 21 + #include <shellapi.h> 22 + 23 + // Visual styles 24 + #include <UxTheme.h> 25 + #include <VsSym32.h> 26 + #pragma comment(lib, "UxTheme.lib") 27 + 28 + // ATL definitions and header files 29 + #define _ATL_APARTMENT_THREADED 30 + #define _ATL_NO_AUTOMATIC_NAMESPACE 31 + 32 + #define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit 33 + 34 + // turns off ATL's hiding of some common and often safely ignored warning messages 35 + #define _ATL_ALL_WARNINGS 36 + 37 + #include <AtlBase.h> 38 + #include <AtlWin.h> 39 + #include <AtlCom.h> 40 + #include <AtlCtl.h> 41 + #include <AtlStr.h> 42 + #include <AtlColl.h> 43 + #include <AtlPath.h> 44 + 45 + // Additional headers 46 + #include "resource.h" 47 + 48 + #include "Calculator.h" 49 + 50 + // Enable visual styles (Common Controls v6.0) 51 + #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
+26
targetver.h
··· 1 + 2 + #pragma once 3 + 4 + // The following macros define the minimum required platform. The minimum required platform 5 + // is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run 6 + // your application. The macros work by enabling all features available on platform versions up to and 7 + // including the version specified. 8 + 9 + // Modify the following defines if you have to target a platform prior to the ones specified below. 10 + // Refer to MSDN for the latest info on corresponding values for different platforms. 11 + #ifndef WINVER // Specifies that the minimum required platform is Windows Vista. 12 + #define WINVER 0x0600 // Change this to the appropriate value to target other versions of Windows. 13 + #endif 14 + 15 + #ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista. 16 + #define _WIN32_WINNT 0x0600 // Change this to the appropriate value to target other versions of Windows. 17 + #endif 18 + 19 + #ifndef _WIN32_WINDOWS // Specifies that the minimum required platform is Windows 98. 20 + #define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later. 21 + #endif 22 + 23 + #ifndef _WIN32_IE // Specifies that the minimum required platform is Internet Explorer 7.0. 24 + #define _WIN32_IE 0x0700 // Change this to the appropriate value to target other versions of IE. 25 + #endif 26 +