00276 :
00277
00278 Process messages.
00279
00280 Arguments:
00281
00282
hWnd - window hande
00283
msg -
type of message
00284 wParam - additional information
00285 lParam - additional information
00286
00287 Return Value:
00288
00289 status of operation
00290
00291
00292 Revision
History:
00293
00294 02-17-91 Initial code
00295
00296 --*/
00297
00298 {
00299
00300
BOOL Status;
00301 UCHAR tmsg[256];
00302
int MBresult;
00303
char txtbuf[80];
00304
char strbuf[256];
00305
char tmpbuf[5][20];
00306
int i,j,k,
n;
00307
char *kptr;
00308
char TestTypeEntry[16];
00309
int TestType;
00310
int Num_Selected_Tests;
00311
int Test_Item[25];
00312
char SelectedFont[32];
00313
int SelectedFontSize = 12;
00314
BYTE SelectedFontBold =
FALSE;
00315
BYTE SelectedFontItalic =
FALSE;
00316
BYTE SelectedFontUnderline =
FALSE;
00317
BYTE SelectedFontStrike =
FALSE;
00318 COLORREF SelectedFontColor = RGB(0,0,0);
00319
char tst[2];
00320
BYTE FontRed, FontGreen, FontBlue;
00321
char TextString[256];
00322
int No_String_Lengths, No_Font_Sizes;
00323
int StringLength[16], FontSize[16];
00324
int Source_String_Length;
00325
int Text_Test_Order[16];
00326
int VPixelsPerLogInch;
00327
static int Last_Checked = 5;
00328
00329
double Sum;
00330
double Sample[
NUM_SAMPLES];
00331
00332
static HDC hdc2;
00333
static HFONT hfont;
00334
static HFONT hfontOld;
00335
static COLORREF crOld;
00336
00337
00338
switch (
msg) {
00339
00340
case WM_CREATE:
00341 {
00342 ULONG ix;
00343 HWND hwnd;
00344 HMENU hAdd =
GetSubMenu(
GetMenu(hWnd),1);
00345 HMENU hmenu =
GetSubMenu(
GetSubMenu(
GetSubMenu(
GetMenu(hWnd),2),0),0);
00346
00347
for (ix=0;ix<
NUM_TESTS;ix++)
00348 {
00349
00350
if ((ix > 0) && ((ix % 20) == 0))
00351 {
00352
AppendMenu(hAdd, MF_MENUBARBREAK | MF_SEPARATOR,0,0);
00353 }
00354
00355 wsprintf(tmsg,
"T%i: %s",ix,gTestEntry[ix].Api);
00356
AppendMenu(hAdd, MF_STRING | MF_ENABLED, ID_TEST_START + ix, tmsg);
00357 }
00358
00359
CheckMenuItem(hmenu,5,MF_BYPOSITION|MF_CHECKED);
00360
00361 }
00362
break;
00363
case WM_COMMAND:
00364 {
00365
00366
switch (LOWORD(wParam)){
00367
case IDM_EXIT:
00368 {
00369
SendMessage(hWnd,WM_CLOSE,0,0L);
00370 }
00371
break;
00372
00373
case IDM_SHOW:
00374 DialogBox(hInstMain, (LPSTR)IDD_RESULTS, hWnd, ResultsDlgProc);
00375
break;
00376
00377
case IDM_HELP:
00378 DialogBox(hInstMain, (LPSTR)IDD_HELP, hWnd, HelpDlgProc);
00379
break;
00380
00381
00382
00383
00384
00385
case IDM_S001:
00386 {
00387
StrLen = 1;
00388 Last_Checked =
SyncMenuChecks(hWnd, Last_Checked, 0);
00389 }
00390
break;
00391
00392
case IDM_S002:
00393 {
00394
StrLen = 2;
00395 Last_Checked =
SyncMenuChecks(hWnd, Last_Checked, 1);
00396
00397 }
00398
break;
00399
00400
case IDM_S004:
00401 {
00402
StrLen = 4;
00403 Last_Checked =
SyncMenuChecks(hWnd, Last_Checked, 2);
00404
00405 }
00406
break;
00407
00408
case IDM_S008:
00409 {
00410
StrLen = 8;
00411 Last_Checked =
SyncMenuChecks(hWnd, Last_Checked, 3);
00412
00413 }
00414
break;
00415
00416
case IDM_S016:
00417 {
00418
StrLen = 16;
00419 Last_Checked =
SyncMenuChecks(hWnd, Last_Checked, 4);
00420
00421 }
00422
break;
00423
00424
case IDM_S032:
00425 {
00426
StrLen = 32;
00427 Last_Checked =
SyncMenuChecks(hWnd, Last_Checked, 5);
00428
00429 }
00430
break;
00431
00432
case IDM_S064:
00433 {
00434
StrLen = 64;
00435 Last_Checked =
SyncMenuChecks(hWnd, Last_Checked, 6);
00436
00437 }
00438
break;
00439
00440
case IDM_S128:
00441 {
00442
StrLen = 128;
00443 Last_Checked =
SyncMenuChecks(hWnd, Last_Checked, 7);
00444
00445 }
00446
break;
00447
00448
00449
00450
00451
00452
case IDM_TRANSPARENT:
00453 {
00454 HMENU hmenu =
GetSubMenu(
GetSubMenu(
GetMenu(hWnd),2),0);
00455
if(
SelectedFontTransparent ==
TRUE)
00456 {
00457
SelectedFontTransparent =
FALSE;
00458
CheckMenuItem(hmenu,2,MF_BYPOSITION|MF_UNCHECKED);
00459 }
00460
else if(
SelectedFontTransparent ==
FALSE)
00461 {
00462
SelectedFontTransparent =
TRUE;
00463
CheckMenuItem(hmenu,2,MF_BYPOSITION|MF_CHECKED);
00464 }
00465 }
00466
break;
00467
00468
00469
case IDM_FONT:
00470 {
00471
00472
00473
cf.lStructSize =
sizeof (CHOOSEFONT);
00474
cf.hwndOwner =
hWnd;
00475
cf.lpLogFont = &
lf;
00476
cf.Flags = CF_SCREENFONTS | CF_EFFECTS | CF_INITTOLOGFONTSTRUCT;
00477
cf.nFontType = SCREEN_FONTTYPE;
00478
00479
00480
00481
00482
00483
if (ChooseFont(&cf)){
00484 hdc2 =
GetDC(hWnd);
00485 hfont = CreateFontIndirect(
cf.lpLogFont);
00486 hfontOld = SelectObject(hdc2, hfont);
00487 crOld = SetTextColor(hdc2,
cf.rgbColors);
00488
00489 }
00490
00491 }
00492
break;
00493
00494
00495
00496
00497
00498
case IDM_RUN:
00499 {
00500 ULONG
Index;
00501
PFN_MS pfn;
00502 HDC hdc =
GetDC(hWnd);
00503 RECT CliRect = {20,20,500,40};
00504
00505
if(
NULL==
GetWindow(ghwndMDIClient,GW_CHILD))
00506
SendMessage(ghwndMDIClient, WM_MDICREATE, 0, (LPARAM)&mcs);
00507
00508
for (
Index=0;
Index<
NUM_TESTS;
Index++)
00509 {
00510 HDC hdc2 =
GetDC(hWnd);
00511
00512
FillRect(hdc,&CliRect,GetStockObject(GRAY_BRUSH));
00513 wsprintf(tmsg,
"Testing %s",gTestEntry[Index].Api);
00514 TextOut(hdc2,20,20,tmsg,
strlen(tmsg));
00515 pfn =
gTestEntry[
Index].
pfn;
00516
ShowCursor(FALSE);
00517
00518 hfont = CreateFontIndirect(
cf.lpLogFont);
00519 hfontOld = SelectObject(hdc2, hfont);
00520 crOld = SetTextColor(hdc2,
cf.rgbColors);
00521
if(
SelectedFontTransparent)SetBkMode(hdc2,TRANSPARENT);
00522
00524
00525
for(j=0; j<
NUM_SAMPLES; j++)
00526 {
00527
00528 GdiFlush();
00529
00530 Sample[j] = (
double)(*pfn)(hdc2,
gTestEntry[
Index].
Iter);
00531
Detailed_Data[
Index][j] = (
long)(0.5 + Sample[j]);
00532 }
00533
00534
Get_Stats(Sample,NUM_SAMPLES,HI_FILTER,VAR_LIMIT,&TestStats[Index]);
00536
00537
ShowCursor(TRUE);
00538
00539 SetTextColor(hdc, crOld);
00540 SelectObject(hdc, hfontOld);
00541 DeleteObject(hfont);
00542 SetBkMode(hdc2,OPAQUE);
00543
00544
ReleaseDC(hWnd,hdc2);
00545 }
00546
00547
ReleaseDC(hWnd,hdc);
00548
if(
BatchFlag !=
TRUE)
00549 DialogBox(hInstMain, (LPSTR)IDD_RESULTS, hWnd, ResultsDlgProc);
00550 }
00551
break;
00552
00553
case IDM_QRUN1:
00554 {
00555 ULONG
Index;
00556
PFN_MS pfn;
00557 HDC hdc =
GetDC(hWnd);
00558 RECT CliRect = {20,20,500,40};
00559
00560
00561
if(
NULL==
GetWindow(ghwndMDIClient,GW_CHILD))
00562
SendMessage(ghwndMDIClient, WM_MDICREATE, 0, (LPARAM)&mcs);
00563
00564
for (
Index=0;
Index<
NUM_QTESTS;
Index++)
00565 {
00566 HDC hdc2 =
GetDC(hWnd);
00567
00568
FillRect(hdc,&CliRect,GetStockObject(GRAY_BRUSH));
00569 wsprintf(tmsg,
"Testing %s",gTestEntry[Index].Api);
00570 TextOut(hdc2,20,20,tmsg,
strlen(tmsg));
00571 pfn =
gTestEntry[
Index].
pfn;
00572
ShowCursor(FALSE);
00573
00574 hfont = CreateFontIndirect(
cf.lpLogFont);
00575 hfontOld = SelectObject(hdc2, hfont);
00576 crOld = SetTextColor(hdc2,
cf.rgbColors);
00577
if(
SelectedFontTransparent)SetBkMode(hdc2,TRANSPARENT);
00578
00580
00581
for(j=0; j<
NUM_SAMPLES; j++)
00582 {
00583
00584 GdiFlush();
00585
00586 Sample[j] = (
double)(*pfn)(hdc2,
gTestEntry[
Index].
Iter);
00587
Detailed_Data[
Index][j] = (
long)(0.5 + Sample[j]);
00588 }
00589
00590
Get_Stats(Sample,NUM_SAMPLES,HI_FILTER,VAR_LIMIT,&TestStats[Index]);
00592
00593
00594
ShowCursor(TRUE);
00595
00596 SetTextColor(hdc, crOld);
00597 SelectObject(hdc, hfontOld);
00598 DeleteObject(hfont);
00599 SetBkMode(hdc2,OPAQUE);
00600
ReleaseDC(hWnd,hdc2);
00601 }
00602
00603
ReleaseDC(hWnd,hdc);
00604
00605
if(
BatchFlag !=
TRUE)
00606 DialogBox(hInstMain, (LPSTR)IDD_RESULTS, hWnd, ResultsDlgProc);
00607 }
00608
break;
00609
00610
case IDM_QRUN2:
00611 {
00612 ULONG
Index;
00613
PFN_MS pfn;
00614 HDC hdc =
GetDC(hWnd);
00615 RECT CliRect = {20,20,500,40};
00616
00617
TextSuiteFlag =
TRUE;
00618
00619
if(
NULL==
GetWindow(ghwndMDIClient,GW_CHILD))
00620
SendMessage(ghwndMDIClient, WM_MDICREATE, 0, (LPARAM)&mcs);
00621
00622
for (
Index =
FIRST_TEXT_FUNCTION;
Index <=
LAST_TEXT_FUNCTION;
Index++)
00623 {
00624 HDC hdc2 =
GetDC(hWnd);
00625
00626
FillRect(hdc,&CliRect,GetStockObject(GRAY_BRUSH));
00627 wsprintf(tmsg,
"Testing %s",gTestEntry[Index].Api);
00628 TextOut(hdc2,20,20,tmsg,
strlen(tmsg));
00629 pfn =
gTestEntry[
Index].
pfn;
00630
ShowCursor(FALSE);
00631
00632 hfont = CreateFontIndirect(
cf.lpLogFont);
00633 hfontOld = SelectObject(hdc2, hfont);
00634 crOld = SetTextColor(hdc2,
cf.rgbColors);
00635
if(
SelectedFontTransparent)SetBkMode(hdc2,TRANSPARENT);
00637
00638
for(j=0; j<
NUM_SAMPLES; j++)
00639 {
00640
00641 GdiFlush();
00642
00643 Sample[j] = (
double)(*pfn)(hdc2,
gTestEntry[
Index].
Iter);
00644
Detailed_Data[
Index][j] = (
long)(0.5 + Sample[j]);
00645
00646 }
00647
00648
Get_Stats(Sample,NUM_SAMPLES,HI_FILTER,VAR_LIMIT,&TestStats[Index]);
00650
00651
ShowCursor(TRUE);
00652 SetTextColor(hdc, crOld);
00653 SelectObject(hdc, hfontOld);
00654 DeleteObject(hfont);
00655 SetBkMode(hdc2,OPAQUE);
00656
00657
ReleaseDC(hWnd,hdc2);
00658
00659 }
00660
00661
ReleaseDC(hWnd,hdc);
00662
00663
if(
BatchFlag !=
TRUE)
00664 DialogBox(hInstMain, (LPSTR)IDD_RESULTS, hWnd, ResultsDlgProc);
00665
00666 }
00667
break;
00668
00669
00670
00671
00672
case RUN_BATCH:
00673 {
00674
fpIniFile = fopen(IniFileName,
"r");
00675
if(
NULL ==
fpIniFile)
00676 {
00677 MessageBox(hWnd,
"USRBATCH.INI File Not Found, Cannot Continue in Batch Mode",
"INI File Not Found",MB_ICONSTOP|MB_OK);
00678
BatchFlag =
FALSE;
00679
break;
00680 }
00681
else
00682
00683 {
00684
if(!GetPrivateProfileString(
"BATCH",
"RUN",
"TEXT",TestTypeEntry,
sizeof(TestTypeEntry),IniFileName))
00685 {
00686 MessageBox(hWnd,
"Invalid Caption 1 in USRBATCH.INI File ",
"INI File Error",MB_ICONSTOP|MB_OK);
00687
BatchFlag =
FALSE;
00688
break;
00689 }
00690
00691
BatchCycle = GetPrivateProfileInt(
"BATCH",
"CYCLE",1,IniFileName);
00692
00693
if(
NULL != strstr(TestTypeEntry,
"ALL"))
00694 {
00695 TestType =
ALL;
00696 }
00697
else if(
NULL != strstr(TestTypeEntry,
"QUICK"))
00698 {
00699 TestType =
QUICK;
00700 }
00701
else if(
NULL != strstr(TestTypeEntry,
"TEXT"))
00702 {
00703 TestType =
TEXT_SUITE;
00704 }
00705
else if(
NULL != strstr(TestTypeEntry,
"SELECT"))
00706 {
00707 TestType =
SELECT;
00708 }
00709
else
00710 {
00711 MessageBox(hWnd,
"Invalid or No Test-Type Entry in USRBATCH.INI File",
"INI File Error",MB_ICONSTOP|MB_OK);
00712
BatchFlag =
FALSE;
00713
break;
00714 }
00715
00716
switch (TestType)
00717 {
00718
case ALL:
00719 {
00720 fclose(fpIniFile);
00721
OutFileName =
SelectOutFileName(hWnd);
00722
if(
NULL ==
OutFileName)
00723 {
00724
BatchFlag =
FALSE;
00725
break;
00726 }
00727
fpOutFile = fopen(OutFileName,
"w+");
00728
00729
for(i=0; i <
BatchCycle; i++)
00730 {
00731
SendMessage(hWnd,WM_COMMAND,IDM_RUN,0L);
00732
WriteBatchResults(fpOutFile, TestType, i+1);
00733 }
00734
00735 fclose(fpOutFile);
00736
00737
if(
Finish_Message ==
TRUE)
00738 {
00739 strcpy(txtbuf,
"Batch Job Finished Successfully, Results Written to ");
00740 strcat(txtbuf,OutFileName);
00741 MessageBox(hWnd,txtbuf,
"Batch Job Finished",MB_ICONINFORMATION|MB_OK);
00742 }
00743
00744
if(
Dont_Close_App ==
TRUE)
00745 {
00746
BatchFlag =
FALSE;
00747
for(i=0; i<(
int)
NUM_TESTS; i++)
00748 {
00749
gTestEntry[i].
Result = 0;
00750 }
00751 }
00752
else
00753 {
00754
SendMessage(hWnd,WM_COMMAND,IDM_EXIT,0L);
00755 }
00756
00757 }
00758
00759
break;
00760
00761
case QUICK:
00762 {
00763 fclose(fpIniFile);
00764
00765
OutFileName =
SelectOutFileName(hWnd);
00766
00767
fpOutFile = fopen(OutFileName,
"w+");
00768
if(
NULL ==
fpOutFile)
00769 {
00770
BatchFlag =
FALSE;
00771
break;
00772 }
00773
00774
for(i=0; i <
BatchCycle; i++)
00775 {
00776
SendMessage(hWnd,WM_COMMAND,IDM_QRUN1,0L);
00777
WriteBatchResults(fpOutFile, TestType, i+1);
00778 }
00779
00780 fclose(fpOutFile);
00781
00782
if(
Finish_Message ==
TRUE)
00783 {
00784 strcpy(txtbuf,
"Batch Job Finished Successfully, Results Written to ");
00785 strcat(txtbuf,OutFileName);
00786 MessageBox(hWnd,txtbuf,
"Batch Job Finished",MB_ICONINFORMATION|MB_OK);
00787 }
00788
00789
if(
Dont_Close_App ==
TRUE)
00790 {
00791
BatchFlag =
FALSE;
00792
for(i=0; i<(
int)
NUM_TESTS; i++)
00793 {
00794
gTestEntry[i].
Result = 0;
00795 }
00796 }
00797
else
00798 {
00799
SendMessage(hWnd,WM_COMMAND,IDM_EXIT,0L);
00800 }
00801
00802 }
00803
break;
00804
00805
case TEXT_SUITE:
00806 {
00807
00808
n = GetPrivateProfileString(
"TEXT",
"FONT",
"Arial",txtbuf,
sizeof(txtbuf),IniFileName);
00809
00810 i = 0;
00811
00812
do
00813 {
00814 sscanf(&txtbuf[i],
"%1c",tst);
00815 ++i;
00816 }
00817
while((i <=
n ) && (tst[0] !=
',') && (tst[0] !=
';'));
00818
00819 strncpy(&SelectedFont[0],&txtbuf[0],i-1);
00820 strcpy(&SelectedFont[i-1],
"\0");
00821
00822
if(
NULL != strstr(&txtbuf[i],
"BOLD"))
00823 {
00824 SelectedFontBold =
TRUE;
00825 }
00826
00827
if(
NULL != strstr(&txtbuf[i],
"ITALIC"))
00828 {
00829 SelectedFontItalic =
TRUE;
00830 }
00831
00832
if(
NULL != strstr(&txtbuf[i],
"UNDERLINE"))
00833 {
00834 SelectedFontUnderline =
TRUE;
00835 }
00836
00837
if(
NULL != strstr(&txtbuf[i],
"STRIKE"))
00838 {
00839 SelectedFontStrike =
TRUE;
00840 }
00841
00842
if(
NULL != strstr(&txtbuf[i],
"TRANSPARENT"))
00843 {
00844
SelectedFontTransparent =
TRUE;
00845 }
00846
00847 kptr = strstr(&txtbuf[0],
"RGB(");
00848
if(
NULL != kptr)
00849 {
00850 sscanf(kptr+4,
"%s",tmpbuf[0]);
00851
00852 FontRed = 0;
00853 FontGreen = 0;
00854 FontBlue = 0;
00855
00856 j = 0;
00857
00858 sscanf(&tmpbuf[0][j],
"%1c",tst);
00859
00860
while(tst[0] ==
' ')
00861 {
00862 ++j;
00863 sscanf(&tmpbuf[0][j],
"%1c",tst);
00864 }
00865
while(tst[0] !=
',')
00866 {
00867 FontRed = 10*FontRed + atoi(tst);
00868 ++j;
00869 sscanf(&tmpbuf[0][j],
"%1c",tst);
00870 }
00871
00872 ++j;
00873 sscanf(&tmpbuf[0][j],
"%1c",tst);
00874
while(tst[0] ==
' ')
00875 {
00876 ++j;
00877 sscanf(&tmpbuf[0][j],
"%1c",tst);
00878 }
00879
while(tst[0] !=
',')
00880 {
00881 FontGreen = 10*FontGreen + atoi(tst);
00882 ++j;
00883 sscanf(&tmpbuf[0][j],
"%1c",tst);
00884 }
00885
00886 ++j;
00887 sscanf(&tmpbuf[0][j],
"%1c",tst);
00888
while(tst[0] ==
' ')
00889 {
00890 ++j;
00891 sscanf(&tmpbuf[0][j],
"%1c",tst);
00892 }
00893
while(tst[0] !=
')')
00894 {
00895 FontBlue = 10*FontBlue + atoi(tst);
00896 ++j;
00897 sscanf(&tmpbuf[0][j],
"%1c",tst);
00898
if(tst[0] ==
' ')
break;
00899 }
00900
00901 SelectedFontColor = RGB(FontRed, FontGreen, FontBlue);
00902 }
00903
00904 k = GetPrivateProfileString(
"TEXT",
"STRING_CONTENT",DEFAULT_A_STRING,strbuf,
sizeof(strbuf),IniFileName);
00905
00906 strncpy(SourceString,strbuf,(size_t)k);
00907 Source_String_Length = k;
00908
00909 MultiByteToWideChar(CP_ACP|CP_OEMCP,0,SourceString,-1,SourceStringW,
sizeof(SourceStringW));
00910
00911
for(j=0; j<2; j++)
00912 Text_Test_Order[j] = 0;
00913
00914 GetPrivateProfileString(
"RUN",
"ORDER",
"FONT_SIZE, STRING_LENGTH",txtbuf,
sizeof(txtbuf),IniFileName);
00915
if(strstr(txtbuf,
"STRING_LENGTH") > strstr(txtbuf,
"FONT_SIZE"))
00916 {
00917 Text_Test_Order[0] = 1;
00918 Text_Test_Order[1] = 2;
00919 }
00920
else
00921 {
00922 Text_Test_Order[0] = 2;
00923 Text_Test_Order[1] = 1;
00924 }
00925
00926 k = GetPrivateProfileString(
"RUN",
"STRING_LENGTH",
"32",txtbuf,
sizeof(txtbuf),IniFileName);
00927 No_String_Lengths =
Std_Parse(txtbuf, k, StringLength);
00928
00929
if(No_String_Lengths==0)
00930 {
00931 MessageBox(hWnd,
"Invalid or No String Length Entry in GDIBATCH.INI File",
"INI File Error",MB_ICONSTOP|MB_OK);
00932
BatchFlag =
FALSE;
00933
break;
00934 }
00935
00936 k = GetPrivateProfileString(
"RUN",
"FONT_SIZE",
"10",txtbuf,
sizeof(txtbuf),IniFileName);
00937 No_Font_Sizes =
Std_Parse(txtbuf, k, FontSize);
00938
00939
if(No_Font_Sizes==0)
00940 {
00941 MessageBox(hWnd,
"Invalid or No Font Size Entry in GDIBATCH.INI File",
"INI File Error",MB_ICONSTOP|MB_OK);
00942
BatchFlag =
FALSE;
00943
break;
00944 }
00945
00946 fclose(fpIniFile);
00947
00948
00949
00950
lf.lfWidth = 0;
00951
lf.lfEscapement = 0;
00952
lf.lfOrientation = 0;
00953
lf.lfWeight = (SelectedFontBold ==
FALSE)? 400 : 700;
00954
lf.lfItalic = SelectedFontItalic;
00955
lf.lfUnderline = SelectedFontUnderline;
00956
lf.lfStrikeOut = SelectedFontStrike;
00957
lf.lfCharSet = ANSI_CHARSET;
00958
lf.lfOutPrecision = OUT_DEFAULT_PRECIS;
00959
lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
00960
lf.lfQuality = DEFAULT_QUALITY;
00961
lf.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
00962 lstrcpy(&
lf.lfFaceName[0],&SelectedFont[0]);
00963
00964
00965
00966 hdc2 =
GetDC(hWnd);
00967 GetTextFace(hdc2,
sizeof(SelectedFont), &SelectedFont[0]);
00968 VPixelsPerLogInch = GetDeviceCaps(hdc2, LOGPIXELSY);
00969
ReleaseDC(hWnd,hdc2);
00970
00971
00972
00973
cf.lStructSize =
sizeof (CHOOSEFONT);
00974
cf.hwndOwner =
hWnd;
00975
cf.lpLogFont = &
lf;
00976
cf.Flags = CF_SCREENFONTS | CF_EFFECTS | CF_INITTOLOGFONTSTRUCT;
00977
cf.nFontType = SCREEN_FONTTYPE;
00978
cf.rgbColors = SelectedFontColor;
00979
00980
00981
00982
OutFileName =
SelectOutFileName(hWnd);
00983
fpOutFile = fopen(OutFileName,
"w+");
00984
if(
NULL ==
OutFileName)
00985 {
00986 MessageBox(hWnd,
"Could not Open an Output File, Batch Mode Halted",
"Output Open File Error",MB_ICONSTOP|MB_OK);
00987
BatchFlag =
FALSE;
00988
break;
00989 }
00990
00991
00992
00993
if(Text_Test_Order[1] == 1)
00994 {
00995
00996
for(i = 0; i < No_String_Lengths; i++)
00997 {
00998
StrLen =
StringLength[i];
00999
String_Length_Warn = (
StrLen <= (size_t)Source_String_Length)?
FALSE :
TRUE;
01000 strcpy(&DestString[StrLen],
"\0");
01001
pszTest =(PSZ) strncpy(&DestString[0], SourceString, StrLen);
01002
pwszTest = (PWSTR) wcsncpy(&DestStringW[0], SourceStringW, StrLen);
01003
01004
for(j = 0; j < No_Font_Sizes; j++)
01005 {
01006
lf.lfHeight = -MulDiv(FontSize[j], VPixelsPerLogInch, POINTS_PER_INCH);
01007
cf.iPointSize = 10*FontSize[j];
01008
01009
for(k=0; k <
BatchCycle; k++)
01010 {
01011
SendMessage(hWnd,WM_COMMAND,IDM_QRUN2,0L);
01012
WriteBatchResults(fpOutFile, TestType, k+1);
01013 }
01014
01015 }
01016
01017 }
01018
01019 }
01020
01021
else
01022 {
01023
01024
for(i = 0; i < No_Font_Sizes; i++)
01025 {
01026
01027
lf.lfHeight = -MulDiv(FontSize[i], VPixelsPerLogInch, POINTS_PER_INCH);
01028
cf.iPointSize = 10*FontSize[i];
01029
01030
for(j = 0; j < No_String_Lengths; j++)
01031 {
01032
StrLen =
StringLength[j];
01033
String_Length_Warn = (
StrLen <= (size_t)Source_String_Length)?
FALSE :
TRUE;
01034 strcpy(&DestString[StrLen],
"\0");
01035
pszTest =(PSZ) strncpy(&DestString[0], SourceString, StrLen);
01036
pwszTest = (PWSTR) wcsncpy(&DestStringW[0], SourceStringW, StrLen);
01037
01038
for(k=0; k <
BatchCycle; k++)
01039 {
01040
SendMessage(hWnd,WM_COMMAND,IDM_QRUN2,0L);
01041
WriteBatchResults(fpOutFile, TestType, k+1);
01042 }
01043
01044 }
01045
01046 }
01047
01048 }
01049
01050
01051 fclose(fpOutFile);
01052
01053
if(
Finish_Message ==
TRUE)
01054 {
01055 strcpy(txtbuf,
"Batch Job Finished Successfully, Results Written to ");
01056 strcat(txtbuf,OutFileName);
01057 MessageBox(hWnd,txtbuf,
"Batch Job Finished",MB_ICONINFORMATION|MB_OK);
01058 }
01059
01060
if(
Dont_Close_App ==
TRUE)
01061 {
01062 HMENU hmenu =
GetSubMenu(
GetSubMenu(
GetMenu(hWnd),2),0);
01063
if(
SelectedFontTransparent ==
TRUE)
01064 {
01065
CheckMenuItem(hmenu,2,MF_BYPOSITION|MF_CHECKED);
01066 }
01067
01068
if(
StrLen == 1)i=0;
01069
else if(
StrLen == 2)i=1;
01070
else if(
StrLen == 4)i=2;
01071
else if(
StrLen == 8)i=3;
01072
else if(
StrLen == 16)i=4;
01073
else if(
StrLen == 32)i=5;
01074
else if(
StrLen == 64)i=6;
01075
else if(
StrLen == 128)i=7;
01076
else
01077 {
01078 i = 8;
01079 }
01080 Last_Checked =
SyncMenuChecks(hWnd, Last_Checked, i);
01081
01082
BatchFlag =
FALSE;
01083
for(i=0; i<(
int)
NUM_TESTS; i++)
01084 {
01085
gTestEntry[i].
Result = 0;
01086 }
01087
01088 }
01089
else
01090 {
01091
SendMessage(hWnd,WM_COMMAND,IDM_EXIT,0L);
01092 }
01093
01094 }
01095
01096
break;
01097
01098
case SELECT:
01099 {
01100
01101 k = GetPrivateProfileString(
"BATCH",
"TEST",
"0",txtbuf,
sizeof(txtbuf),IniFileName);
01102 fclose(fpIniFile);
01103
01104 Num_Selected_Tests =
Std_Parse(txtbuf, k, Test_Item);
01105
01106
if(Num_Selected_Tests == 0)
01107 {
01108 MessageBox(hWnd,
"Invalid Test-Number Entry in USRBATCH.INI File ",
"INI File Error",MB_ICONSTOP|MB_OK);
01109
BatchFlag =
FALSE;
01110
break;
01111 }
01112
01113
for(i=0; i<Num_Selected_Tests; i++)
01114 {
01115
if(Test_Item[i] > (
int)
NUM_TESTS)
01116 {
01117 MessageBox(hWnd,
"Invalid Test-Number Entry in USRBATCH.INI File ",
"INI File Error",MB_ICONSTOP|MB_OK);
01118
BatchFlag =
FALSE;
01119
break;
01120 }
01121 }
01122
01123
OutFileName =
SelectOutFileName(hWnd);
01124
if(
NULL ==
OutFileName)
01125 {
01126
BatchFlag =
FALSE;
01127
break;
01128 }
01129
fpOutFile = fopen(OutFileName,
"w+");
01130
01131
for(j=0; j <
BatchCycle; j++)
01132 {
01133
for(i=0; i < Num_Selected_Tests; i++)
01134 {
01135
SendMessage(hWnd,WM_COMMAND,ID_TEST_START+Test_Item[i],0L);
01136 }
01137
01138
WriteBatchResults(fpOutFile, TestType, i+1);
01139 }
01140
01141 fclose(fpOutFile);
01142
01143
if(
Finish_Message ==
TRUE)
01144 {
01145 strcpy(txtbuf,
"Batch Job Finished Successfully, Results Written to ");
01146 strcat(txtbuf,OutFileName);
01147 MessageBox(hWnd,txtbuf,
"Batch Job Finished",MB_ICONINFORMATION|MB_OK);
01148 }
01149
01150
if(
Dont_Close_App ==
TRUE)
01151 {
01152
BatchFlag =
FALSE;
01153
for(i=0; i<(
int)
NUM_TESTS; i++)
01154 {
01155
gTestEntry[i].
Result = 0;
01156 }
01157 }
01158
else
01159 {
01160
SendMessage(hWnd,WM_COMMAND,IDM_EXIT,0L);
01161 }
01162
01163 }
01164
break;
01165
01166 }
01167
01168 }
01169
01170 }
01171
break;
01172
01173
01174
01175
01176
01177
default:
01178
01179 {
01180 ULONG
Test = LOWORD(wParam) -
ID_TEST_START;
01181 ULONG
Index;
01182
PFN_MS pfn;
01183 RECT CliRect = {0,0,10000,10000};
01184 HDC hdc =
GetDC(hWnd);
01185
FillRect(hdc,&CliRect,GetStockObject(GRAY_BRUSH));
01186
01187
if(
NULL==
GetWindow(ghwndMDIClient,GW_CHILD))
01188
SendMessage(ghwndMDIClient, WM_MDICREATE, 0, (LPARAM)&mcs);
01189
01190
if (
Test <
NUM_TESTS)
01191 {
01192 HDC hdc2 =
GetDC(hWnd);
01193
01194 wsprintf(tmsg,
"Testing %s",gTestEntry[Test].Api);
01195 TextOut(hdc,20,20,tmsg,
strlen(tmsg));
01196
01197 pfn =
gTestEntry[
Test].
pfn;
01198
ShowCursor(FALSE);
01199
01200 hfont = CreateFontIndirect(
cf.lpLogFont);
01201 hfontOld = SelectObject(hdc2, hfont);
01202 crOld = SetTextColor(hdc2,
cf.rgbColors);
01203
if(
SelectedFontTransparent)SetBkMode(hdc2,TRANSPARENT);
01204
01206
Index =
Test;
01207
for(j = 0; j <
NUM_SAMPLES; j++)
01208 {
01209
01210 GdiFlush();
01211
01212 Sample[j] = (
double)(*pfn)(hdc2,
gTestEntry[
Index].
Iter);
01213
Detailed_Data[
Index][j] = (
long)(0.5 + Sample[j]);
01214
if (Sample[j] == 0) {
01215
01216
break;
01217 }
01218
01219 }
01220
01221
Get_Stats(Sample,NUM_SAMPLES,HI_FILTER,VAR_LIMIT,&TestStats[Index]);
01223
01224
ShowCursor(TRUE);
01225
01226 SetTextColor(hdc2, crOld);
01227 SelectObject(hdc2, hfontOld);
01228 DeleteObject(hfont);
01229 SetBkMode(hdc2, OPAQUE);
01230
01231
ReleaseDC(hWnd,hdc2);
01232
01233 wsprintf(tmsg,
"Finished %s",gTestEntry[Test].Api);
01234 TextOut(hdc,20,20,tmsg,
strlen(tmsg));
01235 }
01236
01237
ReleaseDC(hWnd,hdc);
01238 }
01239
01240 }
01241
01242
01243
if(
BatchFlag ==
FALSE)
01244 {
01245
pszTest =(PSZ) strncpy(DestString, SourceString, StrLen);
01246
DestString[
StrLen] =
'\0';
01247
pwszTest = (PWSTR) wcsncpy(DestStringW, SourceStringW, StrLen);
01248
DestStringW[
StrLen] =
L'\0';
01249 }
01250
01251 }
01252
break;
01253
01254
case WM_PAINT:
01255 {
01256 PAINTSTRUCT ps;
01257 HDC hDC =
BeginPaint(hWnd,&ps);
01258 EndPaint(hWnd,&ps);
01259 }
01260
break;
01261
01262
case WM_DESTROY:
01263
PostQuitMessage(0);
01264
break;
01265
01266
default:
01267
01268
01269
01270
01271
01272
01273
01274
01275
return DefFrameProc(hWnd, ghwndMDIClient, msg, wParam, lParam);
01276
01277 }
01278
01279
01280
01281
Status = QueryPerformanceFrequency((LARGE_INTEGER *)&PerformanceFreq);
01282
if(
Status){
01283
PerformanceFreq /= 10000;
01284
01285 }
01286
else
01287 {
01288 MessageBox(NULL,
01289
"High Resolution Performance Counter Doesn't Seem to be Supported on This Machine",
01290
"Warning", MB_OK | MB_ICONEXCLAMATION);
01291
01292
PerformanceFreq = 1;
01293 }
01294
01295
01296
return ((LRESULT)
NULL);
01297 }