Annotation of mstools/samples/sdktools/uconvert/dialogs.c, revision 1.1.1.1

1.1       root        1: /**************************************************************************\
                      2: * dialogs.c -- dialog procedure support for uconvert
                      3: *
                      4: *         Steve Firebaugh
                      5: *         Microsoft Developer Support
                      6: *         Copyright (c) 1992, 1993 Microsoft Corporation
                      7: *
                      8: \**************************************************************************/
                      9: #define UNICODE
                     10: 
                     11: 
                     12: #include <windows.h>
                     13: #include "uconvert.h"
                     14: #include "install.h"
                     15: 
                     16: 
                     17: /* Define affecting the positioning of child windows in dialog. */
                     18: #define DLGBORDER    GetSystemMetrics (SM_CXFRAME)*2
                     19: 
                     20: /***************************************************************************\
                     21: *    FUNCTION: AboutProc
                     22: \***************************************************************************/
                     23: LRESULT CALLBACK AboutProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
                     24: {
                     25: 
                     26:   switch (message) {
                     27: 
                     28:     case WM_COMMAND:
                     29:       switch (LOWORD (wParam)) {
                     30:         case IDCANCEL:
                     31:           EndDialog (hwnd, FALSE);
                     32:         break;
                     33: 
                     34:         case IDOK:
                     35:           EndDialog (hwnd, TRUE);
                     36:         break;
                     37:       }
                     38:     break; /* end WM_COMMAND */
                     39: 
                     40: 
                     41:     case WM_SYSCOMMAND:
                     42:       if (LOWORD (wParam) == SC_CLOSE)
                     43:         EndDialog (hwnd, FALSE);
                     44:     break;
                     45: 
                     46:   } /* end switch */
                     47:   return FALSE;
                     48: }
                     49: 
                     50: 
                     51: 
                     52: /***************************************************************************\
                     53: *    FUNCTION: ConversionOptionsProc
                     54: *
                     55: * Fill Dlg with state information on WM_INITDIALOG.
                     56: *  Take it back down and change internal state on WM_COMMAND, IDOK.
                     57: *
                     58: * Global variables:
                     59: *  gMBFlags
                     60: *  gWCFlags
                     61: *  glpDefaultChar
                     62: *  glpUsedDefaultChar
                     63: *
                     64: \***************************************************************************/
                     65: LRESULT CALLBACK ConversionOptionsProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
                     66: {
                     67: 
                     68:   switch (message) {
                     69: 
                     70:     /******************************************************************\
                     71:     *  WM_INITDIALOG
                     72:     *
                     73:     * Set radio buttons appropriately.
                     74:     \******************************************************************/
                     75:     case WM_INITDIALOG:
                     76:       if (gMBFlags & MB_PRECOMPOSED)
                     77:         SendDlgItemMessage (hwnd, DID_PRECOMPOSED, BM_SETCHECK, 1, 0);
                     78: 
                     79:       if (gMBFlags & MB_COMPOSITE)
                     80:         SendDlgItemMessage (hwnd, DID_COMPOSITE, BM_SETCHECK, 1, 0);
                     81: 
                     82:       if (gMBFlags & MB_USEGLYPHCHARS)
                     83:         SendDlgItemMessage (hwnd, DID_USEGLYPHCHARS, BM_SETCHECK, 1, 0);
                     84: 
                     85:       if (gMBFlags & WC_COMPOSITECHECK)
                     86:         SendDlgItemMessage (hwnd, DID_COMPOSITECHECK, BM_SETCHECK, 1, 0);
                     87: 
                     88:       if (gMBFlags & WC_DISCARDNS)
                     89:         SendDlgItemMessage (hwnd, DID_DISCARDNS, BM_SETCHECK, 1, 0);
                     90: 
                     91:       if (gMBFlags & WC_SEPCHARS)
                     92:         SendDlgItemMessage (hwnd, DID_SEPCHARS, BM_SETCHECK, 1, 0);
                     93: 
                     94:       if (gMBFlags & WC_DEFAULTCHAR)
                     95:         SendDlgItemMessage (hwnd, DID_DEFAULTCHAR, BM_SETCHECK, 1, 0);
                     96: 
                     97:       SendDlgItemMessage (hwnd, DID_EFDEFAULTCHAR, EM_LIMITTEXT, 1, 0);
                     98:       SetDlgItemTextA (hwnd, DID_EFDEFAULTCHAR, glpDefaultChar);
                     99: 
                    100:       if (gUsedDefaultChar)
                    101:         SendDlgItemMessage (hwnd, DID_USEDDEFAULTCHAR, BM_SETCHECK, 1, 0);
                    102: 
                    103: 
                    104:       SetFocus (GetDlgItem (hwnd, IDOK));
                    105:     return FALSE;
                    106: 
                    107: 
                    108:     case WM_COMMAND:
                    109:       switch (LOWORD (wParam)) {
                    110:         case IDCANCEL:
                    111:           EndDialog (hwnd, FALSE);
                    112:         break;
                    113: 
                    114:         /******************************************************************\
                    115:         *  WM_COMMAND, IDOK
                    116:         *
                    117:         * Get state from radio buttons and others.
                    118:         \******************************************************************/
                    119:         case IDOK: {
                    120: 
                    121:           if (SendDlgItemMessage(hwnd, DID_PRECOMPOSED, BM_GETCHECK, 0,0))
                    122:             gMBFlags |= MB_PRECOMPOSED;
                    123:           else
                    124:             gMBFlags &= ~MB_PRECOMPOSED;
                    125: 
                    126:           if (SendDlgItemMessage(hwnd, DID_COMPOSITE, BM_GETCHECK, 0,0))
                    127:             gMBFlags |= MB_COMPOSITE;
                    128:           else
                    129:             gMBFlags &= ~MB_COMPOSITE;
                    130: 
                    131:           if (SendDlgItemMessage(hwnd, DID_USEGLYPHCHARS, BM_GETCHECK, 0,0))
                    132:             gMBFlags |= MB_USEGLYPHCHARS;
                    133:           else
                    134:             gMBFlags &= ~MB_USEGLYPHCHARS;
                    135: 
                    136:           if (SendDlgItemMessage(hwnd, DID_DISCARDNS, BM_GETCHECK, 0,0))
                    137:             gMBFlags |= WC_DISCARDNS;
                    138:           else
                    139:             gMBFlags &= ~WC_DISCARDNS;
                    140: 
                    141:           if (SendDlgItemMessage(hwnd, DID_COMPOSITECHECK, BM_GETCHECK, 0,0))
                    142:             gMBFlags |= WC_COMPOSITECHECK;
                    143:           else
                    144:             gMBFlags &= ~WC_COMPOSITECHECK;
                    145: 
                    146:           if (SendDlgItemMessage(hwnd, DID_SEPCHARS, BM_GETCHECK, 0,0))
                    147:             gMBFlags |= WC_SEPCHARS;
                    148:           else
                    149:             gMBFlags &= ~WC_SEPCHARS;
                    150: 
                    151:           if (SendDlgItemMessage(hwnd, DID_DEFAULTCHAR, BM_GETCHECK, 0,0))
                    152:             gMBFlags |= WC_DEFAULTCHAR;
                    153:           else
                    154:             gMBFlags &= ~WC_DEFAULTCHAR;
                    155: 
                    156:           GetDlgItemTextA (hwnd, DID_EFDEFAULTCHAR, glpDefaultChar, 2); // CHAR + NULL
                    157: 
                    158:           EndDialog (hwnd, TRUE);
                    159:         } break;
                    160: 
                    161: 
                    162:         /******************************************************************\
                    163:         *  WM_COMMAND, DID_*
                    164:         *
                    165:         * Manage radio button pattern.
                    166:         \******************************************************************/
                    167:         case DID_PRECOMPOSED:
                    168:           SendDlgItemMessage (hwnd, DID_PRECOMPOSED, BM_SETCHECK, TRUE, 0);
                    169:           SendDlgItemMessage (hwnd, DID_COMPOSITE,   BM_SETCHECK, FALSE, 0);
                    170:         break;
                    171: 
                    172:         case DID_COMPOSITE:
                    173:           SendDlgItemMessage (hwnd, DID_PRECOMPOSED, BM_SETCHECK, FALSE, 0);
                    174:           SendDlgItemMessage (hwnd, DID_COMPOSITE,   BM_SETCHECK, TRUE, 0);
                    175:         break;
                    176: 
                    177:       }
                    178:     break; /* end WM_COMMAND */
                    179: 
                    180: 
                    181: 
                    182:     case WM_SYSCOMMAND:
                    183:       if (LOWORD (wParam) == SC_CLOSE)
                    184:           EndDialog (hwnd, FALSE);
                    185:     break;
                    186: 
                    187:   } /* end switch */
                    188:   return FALSE;
                    189: }
                    190: 
                    191: 
                    192: 
                    193: /***************************************************************************\
                    194: *    FUNCTION: SourceOptionsProc
                    195: *
                    196: * Fill Dlg with state information on WM_INITDIALOG.
                    197: *  Take it back down and change internal state on WM_COMMAND, IDOK.
                    198: *
                    199: * Global variables:
                    200: *   gTypeSource
                    201: *   giSourceCodePage
                    202: *   giDestinationCodePage
                    203: *
                    204: \***************************************************************************/
                    205: LRESULT CALLBACK SourceOptionsProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
                    206: {
                    207: TCHAR buffer[50];
                    208: 
                    209:   switch (message) {
                    210: 
                    211:     /******************************************************************\
                    212:     *  WM_INITDIALOG
                    213:     *
                    214:     * Set radio buttons appropriately.
                    215:     \******************************************************************/
                    216:     case WM_INITDIALOG:
                    217:       SetWindowText (hwnd, TEXT("Interpret Source As..."));
                    218:       ListInstalledTables (GetDlgItem (hwnd, DID_CODEPAGELIST),CB_ADDSTRING, TRUE);
                    219:       if (gTypeSource == TYPEUNICODE)
                    220:         SendDlgItemMessage (hwnd, DID_RBUNICODE, BM_SETCHECK, 1, 0);
                    221: 
                    222:       /*
                    223:        * if gTypeSource == TYPECODEPAGE, then see if it is one of the
                    224:        *  standard radio buttons.  If so, check the right one.
                    225:        *  if not, check, "other" and select correct entry in combobox.
                    226:        */
                    227:       else if (gTypeSource == TYPECODEPAGE) {
                    228:         if (giSourceCodePage == GetACP())
                    229:           SendDlgItemMessage (hwnd, DID_RBANSICP, BM_SETCHECK, 1, 0);
                    230:         else if (giSourceCodePage == GetOEMCP())
                    231:           SendDlgItemMessage (hwnd, DID_RBOEMCP, BM_SETCHECK, 1, 0);
                    232:         else {
                    233:           SendDlgItemMessage (hwnd, DID_RBOTHERCP, BM_SETCHECK, 1, 0);
                    234:           wsprintf (buffer, TEXT("%d"), giSourceCodePage);
                    235:           SendDlgItemMessage (hwnd, DID_CODEPAGELIST, CB_SELECTSTRING, 0, (LPARAM)buffer);
                    236:         }
                    237:       } else {
                    238:         // OK to not be specified here.  Wait for user to make choice.
                    239:       }
                    240: 
                    241: 
                    242:       SetFocus (GetDlgItem (hwnd, IDOK));
                    243:     return FALSE;
                    244: 
                    245: 
                    246:     case WM_COMMAND:
                    247:       switch (LOWORD (wParam)) {
                    248:         case IDCANCEL:
                    249:           EndDialog (hwnd, FALSE);
                    250:         break;
                    251: 
                    252:         /******************************************************************\
                    253:         *  WM_COMMAND, IDOK
                    254:         *
                    255:         * Get state from radio buttons and others.
                    256:         \******************************************************************/
                    257:         case IDOK: {
                    258:           BOOL success;
                    259: 
                    260:           if (SendDlgItemMessage(hwnd, DID_RBUNICODE, BM_GETCHECK, 0,0)) {
                    261:             gTypeSource = TYPEUNICODE;
                    262:           } else if (SendDlgItemMessage(hwnd, DID_RBANSICP, BM_GETCHECK, 0,0)) {
                    263:             gTypeSource = TYPECODEPAGE;
                    264:             giSourceCodePage=GetACP();
                    265:           } else if (SendDlgItemMessage(hwnd, DID_RBOEMCP, BM_GETCHECK, 0,0)) {
                    266:             gTypeSource = TYPECODEPAGE;
                    267:             giSourceCodePage=GetOEMCP();
                    268:           } else if (SendDlgItemMessage(hwnd, DID_RBOTHERCP, BM_GETCHECK, 0,0)) {
                    269:             gTypeSource = TYPECODEPAGE;
                    270:             giSourceCodePage=GetDlgItemInt (hwnd, DID_CODEPAGELIST, &success, FALSE);
                    271:           } else
                    272:             gTypeSource = TYPEUNKNOWN;
                    273:           EndDialog (hwnd, TRUE);
                    274:         } break;
                    275:       }
                    276:     break; /* end WM_COMMAND */
                    277: 
                    278: 
                    279:     case WM_SYSCOMMAND:
                    280:       if (LOWORD (wParam) == SC_CLOSE)
                    281:           EndDialog (hwnd, FALSE);
                    282:     break;
                    283: 
                    284:   } /* end switch */
                    285:   return FALSE;
                    286: }
                    287: 
                    288: /***************************************************************************\
                    289: *    FUNCTION: DestinationOptionsProc
                    290: *
                    291: * Fill Dlg with state information on WM_INITDIALOG.
                    292: *  Take it back down and change internal state on WM_COMMAND, IDOK.
                    293: *
                    294: *
                    295: * Global variables:
                    296: *   gTypeSource
                    297: *   giSourceCodePage
                    298: *   giDestinationCodePage
                    299: *
                    300: \***************************************************************************/
                    301: LRESULT CALLBACK DestinationOptionsProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
                    302: {
                    303: TCHAR buffer[50];
                    304: 
                    305:   switch (message) {
                    306: 
                    307:     /******************************************************************\
                    308:     *  WM_INITDIALOG
                    309:     *
                    310:     * Set radio buttons appropriately.
                    311:     \******************************************************************/
                    312:     case WM_INITDIALOG:
                    313:       SetWindowText (hwnd, TEXT("Convert Destination To..."));
                    314:       ListInstalledTables (GetDlgItem (hwnd, DID_CODEPAGELIST),CB_ADDSTRING, TRUE);
                    315: 
                    316:       /* if source is unicode, destination will be code page. */
                    317:       if (gTypeSource == TYPEUNICODE) {
                    318:         EnableWindow (GetDlgItem (hwnd, DID_RBUNICODE), FALSE);
                    319: 
                    320:         if (giDestinationCodePage == GetACP())
                    321:           SendDlgItemMessage (hwnd, DID_RBANSICP, BM_SETCHECK, 1, 0);
                    322:         else if (giDestinationCodePage == GetOEMCP())
                    323:           SendDlgItemMessage (hwnd, DID_RBOEMCP, BM_SETCHECK, 1, 0);
                    324:         else {
                    325:           SendDlgItemMessage (hwnd, DID_RBOTHERCP, BM_SETCHECK, 1, 0);
                    326:           wsprintf (buffer, TEXT("%d"), giDestinationCodePage);
                    327:           SendDlgItemMessage (hwnd, DID_CODEPAGELIST, CB_SELECTSTRING, 0, (LPARAM)buffer);
                    328:         }
                    329: 
                    330:       /* otherwise destination is unicode, so disable most of the checkboxes. */
                    331:       } else if (gTypeSource == TYPECODEPAGE) {
                    332:         SendDlgItemMessage (hwnd, DID_RBUNICODE, BM_SETCHECK, 1, 0);
                    333:         EnableWindow (GetDlgItem (hwnd, DID_RBANSICP), FALSE);
                    334:         EnableWindow (GetDlgItem (hwnd, DID_RBOEMCP), FALSE);
                    335:         EnableWindow (GetDlgItem (hwnd, DID_RBOTHERCP), FALSE);
                    336:         EnableWindow (GetDlgItem (hwnd, DID_CODEPAGELIST), FALSE);
                    337:       } else {
                    338:         EndDialog (hwnd, FALSE);  // shouldn't get here.
                    339:       }
                    340: 
                    341:       SetFocus (GetDlgItem (hwnd, IDOK));
                    342:     return FALSE;
                    343: 
                    344: 
                    345:     case WM_COMMAND:
                    346:       switch (LOWORD (wParam)) {
                    347:         case IDCANCEL:
                    348:           EndDialog (hwnd, FALSE);
                    349:         break;
                    350: 
                    351:         /******************************************************************\
                    352:         *  WM_COMMAND, IDOK
                    353:         *
                    354:         * Get state from radio buttons and others.
                    355:         \******************************************************************/
                    356:         case IDOK: {
                    357:           BOOL success;
                    358:           if (SendDlgItemMessage(hwnd, DID_RBUNICODE, BM_GETCHECK, 0,0)) {
                    359:             // Do nothing. gTypeSource already implies dest <-> unicode.
                    360:           } else if (SendDlgItemMessage(hwnd, DID_RBANSICP, BM_GETCHECK, 0,0)) {
                    361:             giDestinationCodePage=GetACP();
                    362:           } else if (SendDlgItemMessage(hwnd, DID_RBOEMCP, BM_GETCHECK, 0,0)) {
                    363:             giDestinationCodePage=GetOEMCP();
                    364:           } else if (SendDlgItemMessage(hwnd, DID_RBOTHERCP, BM_GETCHECK, 0,0)) {
                    365:             giDestinationCodePage=GetDlgItemInt (hwnd, DID_CODEPAGELIST, &success, FALSE);
                    366:           }
                    367: 
                    368:           EndDialog (hwnd, TRUE);
                    369:         } break;
                    370:       }
                    371:     break; /* end WM_COMMAND */
                    372: 
                    373:     case WM_SYSCOMMAND:
                    374:       if (LOWORD (wParam) == SC_CLOSE)
                    375:           EndDialog (hwnd, FALSE);
                    376:     break;
                    377: 
                    378:   } /* end switch */
                    379:   return FALSE;
                    380: }
                    381: 
                    382: 
                    383: /***************************************************************************\
                    384: *    FUNCTION: ViewSourceProc
                    385: *
                    386: * Fill Text, Name, and Type information into the dialog.
                    387: *  Set a proper font to display the text depending on what type it is.
                    388: *
                    389: \***************************************************************************/
                    390: LRESULT CALLBACK ViewSourceProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
                    391: {
                    392: RECT rect;
                    393: 
                    394:   switch (message) {
                    395: 
                    396:     /******************************************************************\
                    397:     *  WM_INITDIALOG
                    398:     \******************************************************************/
                    399:     case WM_INITDIALOG:
                    400: 
                    401:       /* Text is unicode... use *W() variants of functions. */
                    402:       if (gTypeSource == TYPEUNICODE) {
                    403:         WCHAR buffer[MAX_PATH];
                    404:         LOGFONTW logfont;
                    405:         HFONT hFont;
                    406: 
                    407:         SetWindowTextW (GetDlgItem (hwnd, DID_TEXT), (LPCWSTR)pSourceData);
                    408:         GetWindowTextW (hwndName0, buffer, MAX_PATH);
                    409:         SetWindowTextW (GetDlgItem (hwnd, DID_NAME), buffer);
                    410:         GetWindowTextW (hwndCodePage0, buffer, MAX_PATH);
                    411:         SetWindowTextW (GetDlgItem (hwnd, DID_TYPE), buffer);
                    412: 
                    413:         GetObjectW (GetStockObject (SYSTEM_FONT), sizeof(LOGFONTW), &logfont);
                    414:         logfont.lfCharSet = UNICODE_CHARSET;
                    415:         lstrcpyW (logfont.lfFaceName, L"Lucida Sans Unicode");
                    416:         hFont = CreateFontIndirectW (&logfont);
                    417:         SendMessageW (GetDlgItem (hwnd, DID_TEXT), WM_SETFONT, (WPARAM) hFont, 0);
                    418: 
                    419: 
                    420:       /* Text is codepage... use *A() variants of functions. */
                    421:       } else {
                    422:         char buffer[MAX_PATH];
                    423:         LOGFONTA logfont;
                    424:         HFONT hFont;
                    425: 
                    426:         SetWindowTextA (GetDlgItem (hwnd, DID_TEXT), pSourceData);
                    427:         GetWindowTextA (hwndName0, buffer, MAX_PATH);
                    428:         SetWindowTextA (GetDlgItem (hwnd, DID_NAME), buffer);
                    429:         GetWindowTextA (hwndCodePage0, buffer, MAX_PATH);
                    430:         SetWindowTextA (GetDlgItem (hwnd, DID_TYPE), buffer);
                    431: 
                    432:         GetObjectA (GetStockObject (SYSTEM_FONT), sizeof(LOGFONTA), &logfont);
                    433:         logfont.lfCharSet = giSourceCodePage;
                    434:         lstrcpyA (logfont.lfFaceName, "");
                    435:         hFont = CreateFontIndirectA (&logfont);
                    436:         SendMessageA (GetDlgItem (hwnd, DID_TEXT), WM_SETFONT, (WPARAM) hFont, 0);
                    437: 
                    438:       }
                    439:       SetWindowText (hwnd, TEXT("View Source"));
                    440:       GetClientRect (hwnd, &rect);
                    441:       SendMessage (hwnd, WM_SIZE, 0,
                    442:                  MAKELPARAM ((rect.right - rect.left), (rect.bottom - rect.top)));
                    443:     break;
                    444: 
                    445:     case WM_SIZE: {
                    446:       HWND hwndText;
                    447: 
                    448:       hwndText = GetDlgItem (hwnd, DID_TEXT);
                    449:       MoveWindow (hwndText, DLGBORDER, 60, (int) LOWORD(lParam) - 2*DLGBORDER,
                    450:                                 (int) HIWORD(lParam) - 60 - DLGBORDER , TRUE);
                    451:     }
                    452: 
                    453:     case WM_COMMAND:
                    454:       switch (LOWORD (wParam)) {
                    455:         case IDCANCEL:
                    456:         case IDOK:
                    457:           EndDialog (hwnd, TRUE);
                    458:       }
                    459:     break; /* end WM_COMMAND */
                    460: 
                    461:     case WM_SYSCOMMAND:
                    462:       if (LOWORD (wParam) == SC_CLOSE)
                    463:           EndDialog (hwnd, FALSE);
                    464:     break;
                    465: 
                    466:   } /* end switch */
                    467:   return FALSE;
                    468: }
                    469: 
                    470: 
                    471: 
                    472: /***************************************************************************\
                    473: *    FUNCTION: ViewDestinationProc
                    474: *
                    475: * Fill Text, Name, and Type information into the dialog.
                    476: *  Set a proper font to display the text depending on what type it is.
                    477: *
                    478: \***************************************************************************/
                    479: LRESULT CALLBACK ViewDestinationProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
                    480: {
                    481: RECT rect;
                    482: 
                    483:   switch (message) {
                    484: 
                    485:     /******************************************************************\
                    486:     *  WM_INITDIALOG
                    487:     \******************************************************************/
                    488:     case WM_INITDIALOG:
                    489: 
                    490:       /* Destination text is unicode... use *W() variants of functions. */
                    491:       if (gTypeSource != TYPEUNICODE) {
                    492:         WCHAR buffer[MAX_PATH];
                    493:         LOGFONTW logfont;
                    494:         HFONT hFont;
                    495: 
                    496:         SetWindowTextW (GetDlgItem (hwnd, DID_TEXT), (LPCWSTR)pDestinationData);
                    497:         GetWindowTextW (hwndName1, buffer, MAX_PATH);
                    498:         SetWindowTextW (GetDlgItem (hwnd, DID_NAME), buffer);
                    499:         GetWindowTextW (hwndCodePage1, buffer, MAX_PATH);
                    500:         SetWindowTextW (GetDlgItem (hwnd, DID_TYPE), buffer);
                    501: 
                    502:         GetObjectW (GetStockObject (SYSTEM_FONT), sizeof(LOGFONTW), &logfont);
                    503:         logfont.lfCharSet = UNICODE_CHARSET;
                    504:         lstrcpyW (logfont.lfFaceName, L"Lucida Sans Unicode");
                    505:         hFont = CreateFontIndirectW (&logfont);
                    506:         SendMessageW (GetDlgItem (hwnd, DID_TEXT), WM_SETFONT, (WPARAM) hFont, 0);
                    507: 
                    508: 
                    509:       /* Destination text is codepage... use *A() variants of functions. */
                    510:       } else {
                    511:         char buffer[MAX_PATH];
                    512:         LOGFONTA logfont;
                    513:         HFONT hFont;
                    514: 
                    515:         SetWindowTextA (GetDlgItem (hwnd, DID_TEXT), pDestinationData);
                    516:         GetWindowTextA (hwndName1, buffer, MAX_PATH);
                    517:         SetWindowTextA (GetDlgItem (hwnd, DID_NAME), buffer);
                    518:         GetWindowTextA (hwndCodePage1, buffer, MAX_PATH);
                    519:         SetWindowTextA (GetDlgItem (hwnd, DID_TYPE), buffer);
                    520: 
                    521:         GetObjectA (GetStockObject (SYSTEM_FONT), sizeof(LOGFONTA), &logfont);
                    522:         logfont.lfCharSet = giDestinationCodePage;
                    523:         lstrcpyA (logfont.lfFaceName, "");
                    524:         hFont = CreateFontIndirectA (&logfont);
                    525:         SendMessageA (GetDlgItem (hwnd, DID_TEXT), WM_SETFONT, (WPARAM) hFont, 0);
                    526: 
                    527:       }
                    528:       SetWindowText (hwnd, TEXT("View Destination"));
                    529:       GetClientRect (hwnd, &rect);
                    530:       SendMessage (hwnd, WM_SIZE, 0,
                    531:                  MAKELPARAM ((rect.right - rect.left),(rect.bottom - rect.top)));
                    532: 
                    533:     break;
                    534: 
                    535: 
                    536:     case WM_SIZE: {
                    537:       HWND hwndText;
                    538: 
                    539:       hwndText = GetDlgItem (hwnd, DID_TEXT);
                    540:       MoveWindow (hwndText, DLGBORDER, 60, (int) LOWORD(lParam) - 2*DLGBORDER,
                    541:                                 (int) HIWORD(lParam) - 60 - DLGBORDER , TRUE);
                    542:     }
                    543: 
                    544:     case WM_COMMAND:
                    545:       switch (LOWORD (wParam)) {
                    546:         case IDCANCEL:
                    547:         case IDOK:
                    548:           EndDialog (hwnd, TRUE);
                    549:       }
                    550:     break; /* end WM_COMMAND */
                    551: 
                    552:     case WM_SYSCOMMAND:
                    553:       if (LOWORD (wParam) == SC_CLOSE)
                    554:           EndDialog (hwnd, FALSE);
                    555:     break;
                    556: 
                    557:   } /* end switch */
                    558:   return FALSE;
                    559: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.