Annotation of mstools/samples/ole/clidemo/dialog.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  * dialog.c - Handles the Windows 3.1 common dialogs.
                      3:  *
                      4:  * Created by Microsoft Corporation.
                      5:  * (c) Copyright Microsoft Corp. 1990 - 1992  All Rights Reserved
                      6:  */
                      7: 
                      8: //*** INCLUDES ****
                      9: 
                     10: #include <windows.h>                   //* WINDOWS
                     11: #include <ole.h>                       //* OLE
                     12: 
                     13: #include "global.h"                    //* global 
                     14: #include "demorc.h"                    //* String table constants 
                     15: #include "register.h"                  //* Class registration library
                     16: #include "utility.h"
                     17: #include "dialog.h"
                     18: #include "object.h"
                     19: 
                     20: //*** GLOBALS ***
                     21:                                        //* strings used with commdlg
                     22: CHAR        szDefExtension[CBMESSAGEMAX];
                     23: CHAR        szFilterSpec[CBFILTERMAX];
                     24: CHAR        szInsertFilter[CBFILTERMAX];
                     25: CHAR        szLastDir[CBPATHMAX];
                     26: OPENFILENAME OFN;
                     27: HWND        hwndProp = NULL;
                     28: HWND        hRetry;
                     29: 
                     30: /***************************************************************************
                     31:  * OfnInit() 
                     32:  * Initializes the standard file dialog OFN structure.
                     33:  **************************************************************************/
                     34: 
                     35: VOID FAR OfnInit(                      //* ENTRY:
                     36:    HANDLE         hInst                //* instance handle
                     37: ){                                     //* LOCAL:
                     38:    LPSTR          lpstr;               //* string pointer
                     39: 
                     40:    LoadString(hInst, IDS_FILTER, szFilterSpec, CBMESSAGEMAX);
                     41:    LoadString(hInst, IDS_EXTENSION, szDefExtension, CBMESSAGEMAX);
                     42: 
                     43:    OFN.lStructSize    = sizeof(OPENFILENAME);
                     44:    OFN.hInstance      = hInst;
                     45:    OFN.nMaxCustFilter = CBFILTERMAX;
                     46:    OFN.nMaxFile       = CBPATHMAX;
                     47:    OFN.lCustData      = NULL;
                     48:    OFN.lpfnHook       = NULL;
                     49:    OFN.lpTemplateName = NULL;
                     50:    OFN.lpstrFileTitle = NULL;
                     51:                                        //* Construct the filter string 
                     52:                                        //* for the Open and Save dialogs 
                     53:    lpstr = (LPSTR)szFilterSpec;
                     54:    lstrcat(lpstr, " (*.");
                     55:    lstrcat(lpstr, szDefExtension);
                     56:    lstrcat(lpstr, ")");
                     57:    lpstr += lstrlen(lpstr) + 1;
                     58: 
                     59:    lstrcpy(lpstr, "*.");
                     60:    lstrcat(lpstr, szDefExtension);
                     61:    lpstr += lstrlen(lpstr) + 1;
                     62:    *lpstr = 0;
                     63: 
                     64:    RegMakeFilterSpec(NULL, NULL, (LPSTR)szInsertFilter);
                     65: 
                     66: }
                     67: 
                     68: /***************************************************************************
                     69:  * OfnGetName() 
                     70:  *
                     71:  * Calls the standard file dialogs to get a file name
                     72:  **************************************************************************/
                     73: 
                     74: BOOL FAR OfnGetName(                   //* ENTRY:
                     75:    HWND           hwnd,                //* parent window handle
                     76:    LPSTR          szFileName,          //* File name
                     77:    WORD           msg                  //* operation
                     78: ){                                     //* LOCAL:
                     79:    BOOL           frc;                 //* return flag
                     80:    CHAR           szCaption[CBMESSAGEMAX];//* dialog caption
                     81: 
                     82:    OFN.hwndOwner       = hwnd;               //* window
                     83:    OFN.nFilterIndex    = 1;
                     84:    OFN.lpstrInitialDir = (LPSTR)szLastDir;
                     85:    OFN.Flags           = OFN_HIDEREADONLY;
                     86: 
                     87:    switch (msg)                        //* message
                     88:    {                                   
                     89:       case IDM_OPEN:                   //* open file
                     90:          Normalize(szFileName);
                     91:          OFN.lpstrDefExt = (LPSTR)szDefExtension;
                     92:          OFN.lpstrFile   = (LPSTR)szFileName;
                     93:          OFN.lpstrFilter = (LPSTR)szFilterSpec;
                     94:          LoadString(hInst, IDS_OPENFILE, szCaption, CBMESSAGEMAX);
                     95:          OFN.lpstrTitle  = (LPSTR)szCaption;
                     96:          OFN.Flags       |= OFN_FILEMUSTEXIST;
                     97:          return GetOpenFileName((LPOPENFILENAME)&OFN);
                     98:          break;
                     99: 
                    100:       case IDM_SAVEAS:                 //* save as file
                    101:          Normalize(szFileName);
                    102:          OFN.lpstrDefExt = (LPSTR)szDefExtension;
                    103:          OFN.lpstrFile   = (LPSTR)szFileName;
                    104:          OFN.lpstrFilter = (LPSTR)szFilterSpec;
                    105:          LoadString(hInst, IDS_SAVEFILE, szCaption, CBMESSAGEMAX);
                    106:          OFN.lpstrTitle  = (LPSTR)szCaption;
                    107:          OFN.Flags       |= OFN_PATHMUSTEXIST;
                    108:          return GetSaveFileName((LPOPENFILENAME)&OFN);
                    109:          break;
                    110:                                        
                    111:       case IDM_INSERTFILE:             //* insert file
                    112:          OFN.lpstrDefExt = NULL;
                    113:          OFN.lpstrFile   = (LPSTR)szFileName;
                    114:          OFN.lpstrFilter = (LPSTR)szInsertFilter;
                    115:          LoadString(hInst, IDS_INSERTFILE, szCaption, CBMESSAGEMAX);
                    116:          OFN.lpstrTitle  = (LPSTR)szCaption;
                    117:          OFN.Flags      |= OFN_FILEMUSTEXIST;
                    118:          frc             = GetOpenFileName((LPOPENFILENAME)&OFN);
                    119:          AddExtension(&OFN);
                    120:          return frc;
                    121:          break;
                    122: 
                    123:       default:                         //* default
                    124:          break;
                    125:    }
                    126: 
                    127: }
                    128: 
                    129: /***************************************************************************
                    130:  * OfnGetNewLinkName() - Sets up the "Change Link..." dialog box
                    131:  *
                    132:  * returns LPSTR - fully qualified filename  
                    133:  **************************************************************************/
                    134: 
                    135: LPSTR FAR OfnGetNewLinkName(           //* ENTRY:
                    136:    HWND           hwnd,                //* calling window or dialog
                    137:    LPSTR          lpstrData            //* link data
                    138: ){                                     //* LOCAL:
                    139:    LPSTR          lpReturn = NULL;     //* return string
                    140:    LPSTR          lpstrFile = NULL;    //* non-qualified file name   
                    141:    LPSTR          lpstrPath = NULL;    //* pathname
                    142:    LPSTR          lpstrTemp = NULL;    //* work string
                    143:    CHAR           szDocFile[CBPATHMAX];//* document name
                    144:    CHAR           szDocPath[CBPATHMAX];//* document path name
                    145:    CHAR           szServerFilter[CBPATHMAX]; 
                    146:    CHAR           szCaption[CBMESSAGEMAX];
                    147: 
                    148:                                        //* Figure out the link's path 
                    149:                                        //* name and file name 
                    150:    lpstrTemp = lpstrData;
                    151:    while (*lpstrTemp++);
                    152:    lpstrPath = lpstrFile = lpstrTemp;
                    153: 
                    154:    while (*(lpstrTemp = AnsiNext(lpstrTemp)))
                    155:       if (*lpstrTemp == '\\')
                    156:          lpstrFile = lpstrTemp + 1;
                    157:                                         //* Copy the document name
                    158:    lstrcpy(szDocFile, lpstrFile);
                    159:    *(lpstrFile - 1) = 0;
                    160:                                           //* Copy the path name 
                    161:    lstrcpy(szDocPath, ((lpstrPath != lpstrFile) ? lpstrPath : ""));
                    162:    if (lpstrPath != lpstrFile)           //* Restore the backslash
                    163:       *(lpstrFile - 1) = '\\';
                    164:    while (*lpstrFile != '.' && *lpstrFile)//* Get the extension 
                    165:    lpstrFile++;
                    166:                                           //* Make a filter that respects 
                    167:                                           //* the link's class name 
                    168:    OFN.hwndOwner       = hwnd;
                    169:    OFN.nFilterIndex    = RegMakeFilterSpec(lpstrData, lpstrFile, szServerFilter);
                    170:    OFN.lpstrDefExt     = NULL;
                    171:    OFN.lpstrFile       = (LPSTR)szDocFile;
                    172:    OFN.lpstrFilter     = (LPSTR)szServerFilter;
                    173:    OFN.lpstrInitialDir = (LPSTR)szDocPath;
                    174:    LoadString(hInst, IDS_CHANGELINK, szCaption, CBMESSAGEMAX);
                    175:    OFN.lpstrTitle     = (LPSTR)szCaption;
                    176:    OFN.lpstrCustomFilter = NULL;
                    177:    OFN.Flags          = OFN_HIDEREADONLY | OFN_FILEMUSTEXIST;
                    178: 
                    179:                                            //* If we get a file... */
                    180:    if (GetOpenFileName((LPOPENFILENAME)&OFN)) 
                    181:    {
                    182:       if (!(lpReturn = GlobalLock(GlobalAlloc(LHND, CBPATHMAX))))
                    183:          goto Error;
                    184: 
                    185:       AddExtension(&OFN);
                    186:       lstrcpy(lpReturn, szDocFile);
                    187: 
                    188:       OFN.lpstrInitialDir = (LPSTR)szLastDir;
                    189:    }
                    190: 
                    191:    return lpReturn;                    //* SUCCESS return
                    192: 
                    193: Error:                                 //* ERROR Tag
                    194: 
                    195:    return NULL;                        //* ERROR return
                    196:    
                    197: }
                    198: 
                    199: /***************************************************************************
                    200:  * Normalize()  
                    201:  * Removes the path specification from the file name.
                    202:  *
                    203:  * Note:  It isn't possible to get "<drive>:<filename>" as input because
                    204:  *        the path received will always be fully qualified.
                    205:  **************************************************************************/
                    206: 
                    207: VOID Normalize(                        //* ENTRY:
                    208:    LPSTR          lpstrFile            //* file name
                    209: ){                                     //* LOCAL:
                    210:    LPSTR          lpstrBackslash = NULL;//* back slash
                    211:    LPSTR          lpstrTemp = lpstrFile;//* file name
                    212: 
                    213:    while (*lpstrTemp) 
                    214:    {
                    215:       if (*lpstrTemp == '\\')
                    216:          lpstrBackslash = lpstrTemp;
                    217: 
                    218:       lpstrTemp = AnsiNext(lpstrTemp);
                    219:    }
                    220:    if (lpstrBackslash)
                    221:       lstrcpy(lpstrFile, lpstrBackslash + 1);
                    222: 
                    223: }
                    224: 
                    225: /***************************************************************************
                    226:  * AddExtension() 
                    227:  *
                    228:  * Adds the extension corresponding to the filter dropdown.
                    229:  **************************************************************************/
                    230: 
                    231: VOID AddExtension(                     //* ENTRY:
                    232:    LPOPENFILENAME lpOFN                //* open file structure
                    233: ){
                    234: 
                    235:    if (lpOFN->nFileExtension == (WORD)lstrlen(lpOFN->lpstrFile) 
                    236:          && lpOFN->nFilterIndex) 
                    237:    {
                    238:       LPSTR   lpstrFilter = (LPSTR)lpOFN->lpstrFilter;
                    239: 
                    240:       while (*lpstrFilter && --lpOFN->nFilterIndex) 
                    241:       {
                    242:          while (*lpstrFilter++) ;
                    243:          while (*lpstrFilter++) ;
                    244:       }
                    245:                                        //* If we got to the filter, 
                    246:       if (*lpstrFilter)                //* retrieve the extension 
                    247:       {
                    248:          while (*lpstrFilter++) ;
                    249:          lpstrFilter++;
                    250:                                        //* Copy the extension 
                    251:          if (lpstrFilter[1] != '*')
                    252:             lstrcat(lpOFN->lpstrFile, lpstrFilter);
                    253:       }
                    254:    }
                    255: 
                    256: }
                    257: /****************************************************************************
                    258:  *  fnInsertNew()
                    259:  *
                    260:  *  Dialog procedure for the Insert New dialog.
                    261:  *
                    262:  *  Returns int - TRUE if message processed, FALSE otherwise
                    263:  ***************************************************************************/
                    264: 
                    265: BOOL  APIENTRY fnInsertNew(            //* ENTRY:
                    266:    HWND           hDlg,                //* standard dialog box paramters
                    267:    UINT           msg, 
                    268:    DWORD          wParam, 
                    269:    LONG           lParam               //* (LPSTR) class name
                    270: ){                                     //* LOCAL:
                    271:    HWND           hwndList;            //* handle to listbox 
                    272:    static LPSTR   lpClassName;         //* classname for return value
                    273:    
                    274:    hwndList = GetDlgItem(hDlg, IDD_LISTBOX);
                    275: 
                    276:    switch (msg) 
                    277:    {
                    278:       case WM_INITDIALOG:
                    279:          if (!RegGetClassNames(hwndList))
                    280:             EndDialog(hDlg, IDCANCEL);
                    281: 
                    282:          lpClassName = (LPSTR)lParam;
                    283:          SetFocus(hwndList);
                    284:          SendMessage(hwndList, LB_SETCURSEL, 0, 0L);
                    285:          return (FALSE);
                    286: 
                    287:       case WM_COMMAND:
                    288:       {
                    289:          WORD wID  = LOWORD(wParam);
                    290:          WORD wCmd = HIWORD(wParam);
                    291: 
                    292:          switch (wID) 
                    293:          {
                    294:             case IDD_LISTBOX:
                    295:                if (wCmd != LBN_DBLCLK)
                    296:                break;
                    297: 
                    298:             case IDOK:
                    299:                if (!RegCopyClassName(hwndList, lpClassName))
                    300:                   wParam = IDCANCEL;
                    301: 
                    302:             case IDCANCEL:
                    303:                EndDialog(hDlg, wParam);
                    304:                break;
                    305:          }
                    306:          break;
                    307:       }
                    308:    }
                    309:    return FALSE;              
                    310: 
                    311: }
                    312: 
                    313: /***************************************************************************
                    314:  * LinkProperties();
                    315:  *
                    316:  * Manage the link properties dialog box.
                    317:  **************************************************************************/
                    318: 
                    319: VOID FAR LinkProperties()             
                    320: {                                      //* LOCAL
                    321: 
                    322:    DialogBox (
                    323:       hInst, 
                    324:       MAKEINTRESOURCE(DTPROP), 
                    325:       hwndFrame, 
                    326:       (DLGPROC)fnProperties
                    327:    );
                    328:    FreeProcInstance(lpfnProperties);
                    329: 
                    330: }
                    331: 
                    332: /***************************************************************************
                    333:  * fnProperties()
                    334:  *
                    335:  * Dialog procedure for link properties. The Links dialog allows the user to
                    336:  * change the link options, edit/play the object, cancel the link as 
                    337:  * well change links.
                    338:  *
                    339:  * returns BOOL - TRUE if processed, FALSE otherwise
                    340:  **************************************************************************/
                    341: 
                    342: BOOL  APIENTRY fnProperties(           //* ENTRY:
                    343:    HWND           hDlg,                //* standard dialog box parameters
                    344:    UINT           msg,                       
                    345:    DWORD          wParam, 
                    346:    LONG           lParam               //* (HWND) child window with focus
                    347: ){                                     //* LOCAL:
                    348:   static APPITEMPTR *pLinks;           //* pointer to links (associated windows)
                    349:   static INT      nLinks;              //* number of links
                    350:   static HWND     hwndList;            //* handle to listbox window 
                    351:   static BOOL     fTry;
                    352: 
                    353:    switch (msg) 
                    354:    {
                    355:       case WM_INITDIALOG: 
                    356:          hwndProp = hDlg;
                    357:          hwndList = GetDlgItem(hDlg, IDD_LINKNAME);
                    358:          if (!(InitLinkDlg(hDlg, &nLinks, hwndList, &pLinks)))
                    359:             EndDialog(hDlg, TRUE);
                    360:          UpdateLinkButtons(hDlg,nLinks,hwndList,pLinks);
                    361:          break;
                    362: 
                    363:       case WM_COMMAND: 
                    364:       {
                    365:          WORD wID = LOWORD(wParam);
                    366: 
                    367:          switch (wID) 
                    368:          {
                    369:            case IDD_CHANGE:            //* change links
                    370:                BLOCK_BUSY(fTry);
                    371:                if (ChangeLinks(hDlg,nLinks,hwndList,pLinks))
                    372:                   DisplayUpdate(nLinks,hwndList,pLinks, FALSE);
                    373:                return TRUE;
                    374: 
                    375:            case IDD_FREEZE:            //* cancel links
                    376:                BLOCK_BUSY(fTry);
                    377:                CancelLinks(hDlg,nLinks,hwndList,pLinks);
                    378:                UpdateLinkButtons(hDlg,nLinks,hwndList,pLinks);
                    379:                return TRUE;
                    380: 
                    381:            case IDD_UPDATE:            //* update links
                    382:                BLOCK_BUSY(fTry);
                    383:                DisplayUpdate(nLinks,hwndList,pLinks,TRUE);
                    384:                UpdateLinkButtons(hDlg,nLinks,hwndList,pLinks);
                    385:                return TRUE;
                    386: 
                    387:             case IDD_AUTO:
                    388:             case IDD_MANUAL:           //* change link update options
                    389:                BLOCK_BUSY(fTry);
                    390:                if (!SendMessage(GetDlgItem(hDlg,wParam),BM_GETCHECK, 0, 0L))
                    391:                {
                    392:                   CheckRadioButton(hDlg, IDD_AUTO ,IDD_MANUAL ,wParam);
                    393:                   ChangeUpdateOptions(hDlg,nLinks,hwndList,pLinks, 
                    394:                      (wParam == IDD_AUTO ? oleupdate_always : oleupdate_oncall));
                    395:                   UpdateLinkButtons(hDlg,nLinks,hwndList,pLinks);
                    396:                }
                    397:                return TRUE;
                    398: 
                    399:            case IDD_LINKNAME:          
                    400:                if (HIWORD(lParam) == LBN_SELCHANGE)
                    401:                   UpdateLinkButtons(hDlg,nLinks,hwndList,pLinks);
                    402:                return TRUE;
                    403: 
                    404:             case IDCANCEL:
                    405:                BLOCK_BUSY(fTry);
                    406:                UndoObjects();
                    407:                END_PROP_DLG(hDlg,pLinks);
                    408:                return TRUE;  
                    409: 
                    410:             case IDOK:
                    411:                BLOCK_BUSY(fTry);
                    412:                DelUndoObjects(FALSE);
                    413:                END_PROP_DLG(hDlg,pLinks);
                    414:                return TRUE;  
                    415:          }  
                    416:       }
                    417:    }   
                    418:    return FALSE;
                    419: }
                    420: 
                    421: 
                    422: /****************************************************************************
                    423:  * InitLinkDlg();
                    424:  *
                    425:  * Initialize the list box of links.
                    426:  ***************************************************************************/
                    427: 
                    428: static BOOL InitLinkDlg (              //* ENTRY:
                    429:    HWND           hDlg,                //* dialog box handle
                    430:    INT            *nLinks,             //* pointer to number of links
                    431:    HWND           hwndList,            //* listbox handle
                    432:    APPITEMPTR     **pLinks             //* list of window handles of links 
                    433: ){                                     //* LOCAL
                    434:    APPITEMPTR     pItem;               //* application item pointer
                    435:    LPSTR          lpstrData = NULL;    //* pointer to link data
                    436:    CHAR           szFull[CBMESSAGEMAX * 4];//* list box entry string
                    437:    CHAR           pLinkData[OBJECT_LINK_MAX];//* holder of link data
                    438:    BOOL           fSelect = FALSE;     //* item selected flag
                    439:    HANDLE         hWork;               //* working memory handle
                    440:    APPITEMPTR     pTop;                //* pointer to the top object
                    441: 
                    442:    if (!(*pLinks = (APPITEMPTR *)LocalLock(LocalAlloc(LHND,sizeof(APPITEMPTR)*10))))
                    443:    {  
                    444:       ErrorMessage(E_FAILED_TO_ALLOC); 
                    445:       return NULL;
                    446:    }   
                    447:    *nLinks = 0;
                    448:                                        //* set tabs
                    449:    SendMessage(hwndList,WM_SETREDRAW,FALSE,0L);
                    450:                                        //* enumerate child windows
                    451:    for (pTop = pItem = GetTopItem(); pItem; pItem = GetNextItem(pItem))
                    452:    {
                    453:       if (pItem->otObject == OT_LINK && pItem->fVisible) 
                    454:       {
                    455:          *(*pLinks + *nLinks) = pItem; 
                    456:          if (!((*nLinks += 1)%10))
                    457:          {                             //* add blocks of ten
                    458:             hWork = LocalHandle((LPSTR)(*pLinks));
                    459:             LocalUnlock(hWork);
                    460:             if (!(hWork = LocalReAlloc(hWork,(*nLinks+10)*sizeof(APPITEMPTR),NULL)))
                    461:             {
                    462:                ErrorMessage(E_FAILED_TO_ALLOC);
                    463:                return FALSE;           //* ERROR return
                    464:             }
                    465:             *pLinks = (APPITEMPTR *)LocalLock(hWork);
                    466:          }
                    467: 
                    468:          if (pTop == pItem)
                    469:             fSelect = TRUE;
                    470: 
                    471:          if (!ObjGetData(pItem, pLinkData))
                    472:             continue;
                    473:                                        //* make listbox entry
                    474:          MakeListBoxString(pLinkData, szFull, pItem->uoObject);
                    475:                                        //* add listbox entry
                    476:          SendMessage(hwndList, LB_ADDSTRING, 0, (LONG)(LPSTR)szFull);
                    477:       }
                    478:    }
                    479: 
                    480:    if (fSelect)
                    481:       SendMessage(hwndList, LB_SETSEL, 1, 0L);
                    482:    
                    483:    SendMessage(hwndList,WM_SETREDRAW,TRUE,0L);
                    484:    UpdateWindow(hwndList);            
                    485: 
                    486:    return TRUE;                        //* SUCCESS return
                    487:                                        
                    488: }
                    489: 
                    490: /****************************************************************************
                    491:  * MakeListBoxString()
                    492:  *
                    493:  * build an listbox entry string
                    494:  ***************************************************************************/
                    495: 
                    496: static VOID MakeListBoxString(         //* ENTRY:
                    497:    LPSTR          lpLinkData,          //* pointer to link data
                    498:    LPSTR          lpBoxData,           //* return string
                    499:    OLEOPT_UPDATE  oleopt_update        //* OLE update option
                    500: ){                                     //* LOCAL:
                    501:    CHAR           szType[CBMESSAGEMAX];//* holds update option string
                    502:    LPSTR          lpTemp;              //* working string pointer
                    503:    INT            i;                   //* index
                    504:    
                    505:                                        //* get classname
                    506:    RegGetClassId(lpBoxData, lpLinkData);
                    507:    lstrcat(lpBoxData, " - ");           //* ads tab
                    508:       
                    509:    while (*lpLinkData++);              //* skip to document name
                    510: 
                    511:    lpTemp = lpLinkData;
                    512:    while (*lpTemp)                     //* copy document name;
                    513:    {                                   //* strip drive an directory
                    514:       if (*lpTemp == '\\' || *lpTemp == ':')
                    515:          lpLinkData = lpTemp + 1;
                    516:       lpTemp = AnsiNext(lpTemp);
                    517:    }
                    518:    lstrcat(lpBoxData, lpLinkData);
                    519:    lstrcat(lpBoxData, " - ");
                    520:  
                    521:    while (*lpLinkData++);              //* copy item data
                    522:    lstrcat(lpBoxData, lpLinkData);
                    523:    lstrcat(lpBoxData, " - ");
                    524:                                        //* add update option string
                    525:    switch (oleopt_update)
                    526:    {
                    527:       case oleupdate_always: i = SZAUTO; break;
                    528:       case oleupdate_oncall: i = SZMANUAL; break;
                    529:       default: i = SZFROZEN;
                    530:    }
                    531:    LoadString(hInst, i, szType, CBMESSAGEMAX);
                    532:    lstrcat(lpBoxData, szType);
                    533: 
                    534: }                                      //* SUCCESS return
                    535: 
                    536: /***************************************************************************
                    537:  * UpdateLinkButtons()
                    538:  *
                    539:  * Keep link buttons active as appropriate.  This routine is called after
                    540:  * a selection is made so the buttons reflect the selected items.
                    541:  **************************************************************************/
                    542: 
                    543: static VOID UpdateLinkButtons(         //* ENTRY:
                    544:    HWND           hDlg,                //* dialog box handle
                    545:    INT            nLinks,              //* number of links
                    546:    HWND           hwndList,            //* listbox handle
                    547:    APPITEMPTR     *pLinks              //* pointer to link's window handles
                    548: ){                                     //* LOCAL:
                    549:    ATOM           aCurName=0;          //* atom of current doc
                    550:    BOOL           fChangeLink = TRUE;  //* enable/disable changelink button
                    551:    INT            iAuto,iManual,i;     //* count of manual and auto links
                    552:    APPITEMPTR     pItem;               //* application item pointer
                    553:    INT            iStatic;
                    554: 
                    555:    iStatic = iAuto = iManual = 0;
                    556: 
                    557:    for (i = 0; i < nLinks; i++)        //* enum selected links    
                    558:    {
                    559:       if (SendMessage(hwndList, LB_GETSEL, i, 0L))
                    560:       {
                    561:          pItem = *(pLinks+i);
                    562:          if (pItem->otObject == OT_STATIC)
                    563:             iStatic++;
                    564:          else
                    565:          {
                    566:             switch(pItem->uoObject) 
                    567:             {                          //* count number of manual and 
                    568:                case oleupdate_always:  //* automatic links selected
                    569:                   iAuto++;
                    570:                   break;
                    571:                case oleupdate_oncall:
                    572:                   iManual++;
                    573:                   break;
                    574:             }
                    575:                                        //* check if all selected links are
                    576:             if (!aCurName)             //* linked to same file
                    577:                aCurName = pItem->aLinkName;
                    578:             else if (aCurName != pItem->aLinkName)
                    579:                fChangeLink = FALSE;
                    580:          }
                    581:       }
                    582:    }
                    583: 
                    584:    if (!(iAuto || iManual || iStatic)  //* if no links disable all buttons
                    585:       || (!iAuto && !iManual && iStatic))
                    586:    {
                    587:       EnableWindow(GetDlgItem(hDlg, IDD_FREEZE), FALSE );
                    588:       EnableWindow(GetDlgItem(hDlg, IDD_CHANGE), FALSE );
                    589:       EnableWindow(GetDlgItem(hDlg, IDD_UPDATE), FALSE );
                    590:       CheckDlgButton(hDlg, IDD_AUTO, FALSE);
                    591:       EnableWindow(GetDlgItem(hDlg, IDD_AUTO),FALSE);
                    592:       CheckDlgButton(hDlg, IDD_MANUAL, FALSE);
                    593:       EnableWindow(GetDlgItem(hDlg, IDD_MANUAL),FALSE);
                    594:    }
                    595:    else
                    596:    { 
                    597:       EnableWindow(GetDlgItem(hDlg, IDD_UPDATE), TRUE );
                    598:       EnableWindow(GetDlgItem(hDlg, IDD_FREEZE), TRUE );
                    599: 
                    600:       if (iAuto && iManual || !(iAuto || iManual))
                    601:       {                                //* Set update buttons 
                    602:          CheckDlgButton(hDlg, IDD_AUTO, FALSE);
                    603:          EnableWindow(GetDlgItem(hDlg, IDD_AUTO),FALSE);
                    604:          CheckDlgButton(hDlg, IDD_MANUAL, FALSE);
                    605:          EnableWindow(GetDlgItem(hDlg, IDD_MANUAL),FALSE);
                    606:       }
                    607:       else 
                    608:       {
                    609:          EnableWindow(GetDlgItem(hDlg, IDD_MANUAL), TRUE);
                    610:          EnableWindow(GetDlgItem(hDlg, IDD_AUTO), TRUE);
                    611:          if (iAuto)
                    612:          {  
                    613:             CheckDlgButton(hDlg, IDD_AUTO, TRUE);
                    614:             CheckDlgButton(hDlg, IDD_MANUAL, FALSE);
                    615:          }
                    616:          else
                    617:          {
                    618:             CheckDlgButton(hDlg, IDD_AUTO, FALSE);
                    619:             CheckDlgButton(hDlg, IDD_MANUAL, TRUE);
                    620:          }
                    621:       }
                    622:    } 
                    623: 
                    624:    EnableWindow(GetDlgItem(hDlg, IDD_CHANGE),fChangeLink && aCurName);
                    625: 
                    626: }
                    627: 
                    628: /****************************************************************************
                    629:  * ChangeLinks()
                    630:  *
                    631:  * This routine changes the linked data if the user chooses a new file to
                    632:  * replace the old document data portion of the linked date.  The routine
                    633:  * does nothing if the user cancels.
                    634:  *
                    635:  * returns TRUE - if data changed FALSE if user cancel or err.
                    636:  ***************************************************************************/
                    637: 
                    638: static BOOL ChangeLinks(               //* ENTRY:
                    639:    HWND           hDlg,                //* dialog handle
                    640:    INT            nLinks,              //* number of links in listbox
                    641:    HWND           hwndList,            //* listbox
                    642:    APPITEMPTR     *pLinks              //* list of application link handles
                    643: ){                                     //* LOCAL
                    644:    INT            i;                   //* general index
                    645:    HANDLE         hWork;               //* work
                    646:    APPITEMPTR     pItem;               //* application item
                    647:    LPSTR          lpNewDoc = NULL;     //* new document
                    648:    ATOM           aOldDoc;             //* atom of old doc. name
                    649:    ATOM           aCurDoc = NULL;      //* atom of change-to doc. name
                    650:    BOOL           fMessage = FALSE;    //* error message flag
                    651:    LPSTR          lpLinkData;          //* pointer to link data
                    652:    
                    653:    lpLinkData = NULL;
                    654:                                        //* This loop finds all selected links
                    655:    for (i = 0; i < nLinks; i++)        //* and updates them
                    656:    {
                    657:       if (SendMessage(hwndList, LB_GETSEL, i, 0L))
                    658:       {
                    659:          pItem = *(pLinks+i);
                    660:          CHECK_IF_STATIC(pItem);
                    661: 
                    662:          pItem->lpLinkData = lpLinkData;
                    663:          if (!ObjGetData(pItem,NULL))
                    664:             continue;
                    665: 
                    666:          if (!lpNewDoc)
                    667:          {
                    668:             if (!(lpNewDoc = OfnGetNewLinkName(hDlg, pItem->lpLinkData)))
                    669:               return FALSE;            //* ERROR jump
                    670:             aOldDoc = pItem->aLinkName;
                    671:             aCurDoc = AddAtom(lpNewDoc);
                    672:             SendMessage(hwndList,WM_SETREDRAW,FALSE,0L);
                    673:          }
                    674: 
                    675:          ObjSaveUndo(pItem);  
                    676:          ObjChangeLinkData(pItem,lpNewDoc);
                    677:          pItem->aLinkName = aCurDoc;
                    678:          lpLinkData = pItem->lpLinkData;
                    679: 
                    680:          CHANGE_LISTBOX_STRING(hwndList, i, pItem, pItem->lpLinkData);
                    681: 
                    682:          pItem->lpLinkData = NULL;
                    683:       }
                    684:    }                                   
                    685: 
                    686:    /*************************************************************************
                    687:    * now deal with non-selected links and look for a match...
                    688:    *************************************************************************/
                    689: 
                    690:                                        //* this loop finds non-selected links
                    691:    for (i = 0; i < nLinks; i++)        //* and asks the user to update these?
                    692:    {
                    693:       if (!SendMessage(hwndList, LB_GETSEL, i, 0L))
                    694:       {
                    695:          pItem = *(pLinks+i);
                    696:          if (pItem->otObject == OT_STATIC)
                    697:             continue;
                    698:          
                    699:          if (!ObjGetData(pItem,NULL))
                    700:             continue;
                    701: 
                    702:          if (pItem->aLinkName == aOldDoc)
                    703:          {
                    704:             if (!fMessage)
                    705:             {
                    706:                CHAR szMessage[2*CBMESSAGEMAX+3*CBPATHMAX];
                    707:                CHAR szRename[2*CBMESSAGEMAX];
                    708:                CHAR szOldDoc[CBMESSAGEMAX];
                    709:                LPSTR pOldDoc;
                    710:             
                    711:                GetAtomName(aOldDoc,szOldDoc,CBMESSAGEMAX);
                    712:                pOldDoc =(LPSTR)UnqualifyPath(szOldDoc); 
                    713:                LoadString(hInst, IDS_RENAME, szRename, 2*CBMESSAGEMAX);
                    714:                wsprintf(
                    715:                      szMessage,
                    716:                      szRename,
                    717:                      pOldDoc,
                    718:                      (LPSTR)UnqualifyPath(szFileName),
                    719:                      pOldDoc
                    720:                );
                    721: 
                    722:                if (MessageBox(hDlg, szMessage, 
                    723:                   szAppName, MB_YESNO | MB_ICONEXCLAMATION) == IDNO) 
                    724:                   break;
                    725:                fMessage = TRUE;
                    726:             }
                    727: 
                    728:             ObjSaveUndo(pItem);  
                    729:             ObjChangeLinkData(pItem,lpNewDoc);
                    730:             CHANGE_LISTBOX_STRING(hwndList, i, pItem, pItem->lpLinkData);
                    731:   
                    732:             pItem->aLinkName = aCurDoc;
                    733:          }
                    734:       }
                    735:    } 
                    736: 
                    737:    if(lpNewDoc)
                    738:    {
                    739:       hWork = GlobalHandle(lpNewDoc);
                    740:       GlobalUnlock(hWork);
                    741:       GlobalFree(hWork);
                    742:    }
                    743: 
                    744:    if (lpLinkData)
                    745:       FreeLinkData(lpLinkData);
                    746: 
                    747:    SendMessage(hwndList,WM_SETREDRAW,TRUE,0L);
                    748:    InvalidateRect(hwndList,NULL,TRUE);
                    749:    UpdateWindow(hwndList);
                    750: 
                    751:    WaitForAllObjects();
                    752: 
                    753:    if (aCurDoc)
                    754:       DeleteAtom(aCurDoc);
                    755: 
                    756:    return(TRUE);
                    757: }
                    758: 
                    759: /****************************************************************************
                    760:  * DisplayUpdate()
                    761:  *
                    762:  * Get the most up to date rendering information and show it.  
                    763:  ***************************************************************************/
                    764: 
                    765: static VOID DisplayUpdate(             //* ENTRY:
                    766:    INT            nLinks,              //* number of links in listbox
                    767:    HWND           hwndList,            //* listbox
                    768:    APPITEMPTR     *pLinks,             //* list of application link handles
                    769:    BOOL           fSaveUndo            //* save undo objects
                    770: ){                                     //* LOCAL:
                    771:    INT            i;                   //* index
                    772:    APPITEMPTR     pItem;               //* temporary item pointer
                    773:  
                    774: 
                    775:    for (i = 0; i < nLinks; i++) 
                    776:       if (SendMessage(hwndList, LB_GETSEL, i, 0L))
                    777:       {
                    778:          pItem = *(pLinks+i);
                    779:          CHECK_IF_STATIC(pItem);
                    780:          if (fSaveUndo)
                    781:             ObjSaveUndo(pItem);
                    782:          Error(OleUpdate(pItem->lpObject));
                    783:       }
                    784: 
                    785:    WaitForAllObjects();
                    786: 
                    787: }
                    788: 
                    789: /****************************************************************************
                    790:  * UndoObjects()
                    791:  *
                    792:  * Bring objects back to their original state.
                    793:  ***************************************************************************/
                    794: 
                    795: static VOID UndoObjects()
                    796: {                                     
                    797:    APPITEMPTR     pItem;               //* application item pointer
                    798:                                        //* enum objects
                    799:    for (pItem = GetTopItem(); pItem; pItem = GetNextItem(pItem))
                    800:       if (pItem->lpObjectUndo) 
                    801:          ObjUndo(pItem);
                    802:    
                    803:    WaitForAllObjects();
                    804: 
                    805: }
                    806: 
                    807: 
                    808: /****************************************************************************
                    809:  * DelUndoObjects()
                    810:  *
                    811:  * remove all objects created for undo operation.
                    812:  ***************************************************************************/
                    813: 
                    814: static VOID DelUndoObjects(            //* ENTRY:
                    815:    BOOL           fPrompt              //* prompt user?
                    816: ){                                     //* LOCAL:
                    817:    APPITEMPTR     pItem;               //* application item pointer
                    818:    BOOL           fPrompted = FALSE;   //* prompted user?
                    819:  
                    820:    for (pItem = GetTopItem(); pItem; pItem = GetNextItem(pItem))
                    821:    {
                    822:       if (pItem->lpObjectUndo) 
                    823:       {
                    824:          if (fPrompt && !fPrompted)    //* prompt user in activation case
                    825:          {
                    826:             CHAR szPrompt[CBMESSAGEMAX];
                    827: 
                    828:             LoadString(hInst, IDS_SAVE_CHANGES, szPrompt, CBMESSAGEMAX);
                    829: 
                    830:             if (MessageBox(hwndFrame, szPrompt, 
                    831:                   szAppName, MB_YESNO | MB_ICONEXCLAMATION) == IDNO)
                    832:             {
                    833:                UndoObjects(); 
                    834:                return;                 //* user canceled operation
                    835:             }
                    836:             fPrompted = TRUE;
                    837:          }
                    838:         ObjDelUndo(pItem);             //* delete udo object
                    839:       }
                    840:    }
                    841: 
                    842:    WaitForAllObjects();
                    843: 
                    844: }                                      //* SUCCESS return
                    845: 
                    846: /****************************************************************************
                    847:  * CancelLinks()
                    848:  ***************************************************************************/
                    849: 
                    850: static VOID CancelLinks(               //* ENTRY:
                    851:    HWND           hDlg,                //* calling dialog
                    852:    INT            nLinks,              //* number of links in listbox
                    853:    HWND           hwndList,            //* listbox
                    854:    APPITEMPTR     *pLinks              //* list of application link handles
                    855: ){                                     //* LOCAL:
                    856:    APPITEMPTR     pItem;               //* application item pointer
                    857:    INT            i;                   //* index
                    858:    CHAR           pLinkData[OBJECT_LINK_MAX];//* holder of link data
                    859: 
                    860:    SendMessage(hwndList,WM_SETREDRAW,FALSE,0L);
                    861:    for (i = 0; i < nLinks; i++) 
                    862:       if (SendMessage(hwndList, LB_GETSEL, i, 0L))
                    863:       {
                    864:          pItem = *(pLinks+i);
                    865:          CHECK_IF_STATIC(pItem);
                    866:          ObjGetData(pItem,pLinkData);
                    867:          ObjSaveUndo(pItem);
                    868:          ObjFreeze(pItem);
                    869: 
                    870:          CHANGE_LISTBOX_STRING(hwndList, i, pItem, pLinkData);
                    871:       }
                    872: 
                    873:    SendMessage(hwndList,WM_SETREDRAW,TRUE,0L);
                    874:    InvalidateRect(hwndList,NULL,TRUE);
                    875:    UpdateWindow(hwndList);
                    876: 
                    877: }
                    878:          
                    879: 
                    880: /****************************************************************************
                    881:  * ChangeUpdateOptions()
                    882:  *
                    883:  * Change the update options for all selected objects.
                    884:  ***************************************************************************/
                    885: 
                    886: static VOID ChangeUpdateOptions(       //* ENTRY:
                    887:    HWND           hDlg,                //* calling dialog
                    888:    INT            nLinks,              //* number of links in listbox
                    889:    HWND           hwndList,            //* listbox
                    890:    APPITEMPTR     *pLinks,             //* list of application link handles
                    891:    OLEOPT_UPDATE  lUpdate              //* update option
                    892: ){                                     //* LOCAL:
                    893:    APPITEMPTR     pItem;               //* application item
                    894:    INT            i;                   //* index
                    895:    CHAR           pLinkData[OBJECT_LINK_MAX];
                    896: 
                    897:    SendMessage(hwndList,WM_SETREDRAW,FALSE,0L);
                    898:    
                    899:    for (i = 0; i < nLinks; i++)        //* enum selected objects
                    900:    {
                    901:       if (SendMessage(hwndList, LB_GETSEL, i, 0L))
                    902:       {
                    903:          pItem = *(pLinks+i);
                    904:          CHECK_IF_STATIC(pItem);
                    905:          ObjGetData(pItem,pLinkData);
                    906:          ObjSaveUndo(pItem);
                    907:          if (Error(OleSetLinkUpdateOptions(pItem->lpObject,lUpdate)))
                    908:             continue;
                    909:          pItem->uoObject = lUpdate;
                    910: 
                    911:          CHANGE_LISTBOX_STRING(hwndList, i, pItem, pLinkData);
                    912:       }
                    913:    }
                    914: 
                    915:    SendMessage(hwndList,WM_SETREDRAW,TRUE,0L);
                    916:    InvalidateRect(hwndList,NULL,TRUE);
                    917:    UpdateWindow(hwndList);
                    918:    WaitForAllObjects();
                    919: 
                    920: }
                    921: /****************************************************************************
                    922:  * InvalidLink()
                    923:  *
                    924:  * Deal with letting the user know that the program has inadvertently come
                    925:  * across an invalid link.
                    926:  * 
                    927:  * Global fPropBoxActive - flag to determine whether or not the link dialog 
                    928:  *                         box is active.  If it is not active we give the
                    929:  *                         user an opportunity to enter the links property
                    930:  *                         dialog directly from here.
                    931:  ***************************************************************************/
                    932: 
                    933: VOID FAR InvalidLink()
                    934: {   
                    935: 
                    936:    if (!hwndProp)
                    937:       DialogBox(hInst, "InvalidLink", hwndFrame, (DLGPROC)fnInvalidLink);
                    938:    else
                    939:       ErrorMessage(E_FAILED_TO_CONNECT);
                    940: 
                    941: }
                    942: 
                    943: /****************************************************************************
                    944:  *  fnABout()
                    945:  *
                    946:  *  About box dialog box procedure.
                    947:  ***************************************************************************/
                    948: 
                    949: BOOL  APIENTRY fnInvalidLink(        //* ENTRY: 
                    950:    HWND           hDlg,              //* standard windows dialog box
                    951:    UINT           message, 
                    952:    DWORD          wParam, 
                    953:    LONG           lParam 
                    954: ){
                    955: 
                    956:    switch (message) 
                    957:    {
                    958:       case WM_INITDIALOG:
                    959:          return (TRUE);
                    960: 
                    961:       case WM_COMMAND:
                    962:          if (LOWORD(wParam) == IDD_CHANGE)
                    963:             LinkProperties();   
                    964:          EndDialog(hDlg, TRUE);
                    965:          return (TRUE);
                    966:     }
                    967:     return (FALSE);
                    968: 
                    969: }
                    970: 
                    971: /****************************************************************************
                    972:  *  AboutBox()
                    973:  *
                    974:  *  Show the About Box dialog.
                    975:  ***************************************************************************/
                    976: 
                    977: VOID FAR AboutBox()            
                    978: {     
                    979: 
                    980:    DialogBox(hInst, "AboutBox", hwndFrame, (DLGPROC)fnAbout);
                    981: 
                    982: }
                    983: 
                    984: /****************************************************************************
                    985:  *  fnABout()
                    986:  *
                    987:  *  About box dialog box procedure.
                    988:  ***************************************************************************/
                    989: 
                    990: BOOL  APIENTRY fnAbout(               //* ENTRY: 
                    991:    HWND         hDlg,                 //* standard windows dialog box
                    992:    UINT         message, 
                    993:    DWORD        wParam, 
                    994:    LONG         lParam 
                    995: ){
                    996: 
                    997:    switch (message) 
                    998:    {
                    999:       case WM_INITDIALOG:
                   1000:          return (TRUE);
                   1001: 
                   1002:       case WM_COMMAND:
                   1003:       {
                   1004:          WORD wID = LOWORD(wParam);
                   1005:    
                   1006:          if (wID == IDOK || wID == IDCANCEL) 
                   1007:          {
                   1008:             EndDialog(hDlg, TRUE);
                   1009:             return (TRUE);
                   1010:          }
                   1011:          break;
                   1012:       }
                   1013:     }
                   1014:     return (FALSE);
                   1015: 
                   1016: }
                   1017: 
                   1018: 
                   1019:  
                   1020: /***************************************************************************
                   1021:  * RetryMessage()
                   1022:  *
                   1023:  * give the user the chance to abort when a server is in retry case.
                   1024:  *
                   1025:  * Returns BOOL - TRUE if user chooses to cancel
                   1026:  **************************************************************************/
                   1027: 
                   1028: VOID FAR RetryMessage (                //* ENTRY:
                   1029:    APPITEMPTR     paItem,              //* application item pointer
                   1030:    LONG lParam
                   1031: ){ 
                   1032:    RETRYPTR    pRetry;
                   1033:    LONG        objectType;
                   1034:    HANDLE      hData;
                   1035:    static CHAR szServerName[KEYNAMESIZE];
                   1036:    HWND        hwnd;                   //* window handle
                   1037: 
                   1038:    if (IsWindow(hwndProp))
                   1039:       hwnd = hwndProp;
                   1040:    else if (IsWindow(hwndFrame))
                   1041:       hwnd = hwndFrame; 
                   1042:    else
                   1043:       return;                          //* should not happen
                   1044:                                        //* get the busy servers name
                   1045:    lstrcpy(szServerName, "server application");
                   1046: 
                   1047:    if (paItem)
                   1048:    {
                   1049:       if (!paItem->aServer)
                   1050:       {
                   1051:          OleQueryType(paItem->lpObject, &objectType );
                   1052:          if (OLE_OK == OleGetData(paItem->lpObject, (OLECLIPFORMAT) (objectType == OT_LINK ? vcfLink : vcfOwnerLink), &hData ))
                   1053:          {
                   1054:             RegGetClassId(szServerName, GlobalLock(hData));
                   1055:             paItem->aServer = AddAtom(szServerName);
                   1056:             GlobalUnlock( hData );
                   1057:          }  
                   1058:       }
                   1059:       else
                   1060:          GetAtomName(paItem->aServer,szServerName,KEYNAMESIZE);
                   1061:          
                   1062:    }
                   1063: 
                   1064:    hData = LocalAlloc(LHND,sizeof(RETRYSTRUCT));
                   1065:    if(!(pRetry = (RETRYPTR)LocalLock(hData)))
                   1066:      return;
                   1067: 
                   1068:    pRetry->lpserver = (LPSTR)szServerName;
                   1069:    pRetry->bCancel  = (BOOL)(lParam & RD_CANCEL);
                   1070:    pRetry->paItem   = paItem;
                   1071: 
                   1072:    DialogBoxParam(hInst, "RetryBox", hwnd, (DLGPROC)fnRetry, (LONG)pRetry );
                   1073: 
                   1074:    LocalUnlock(hData);
                   1075:    LocalFree(hData);
                   1076: 
                   1077:    hRetry = NULL;
                   1078: 
                   1079: }
                   1080: 
                   1081: /****************************************************************************
                   1082:  *  fnRetry()
                   1083:  *
                   1084:  * Retry message box nothing to tricky; however, when a server becomes 
                   1085:  * unbusy a message is posted to automatically get rid of this dialog.
                   1086:  * I send a no.
                   1087:  ***************************************************************************/
                   1088: 
                   1089: BOOL  APIENTRY fnRetry(               //* ENTRY
                   1090:    HWND   hDlg,                       //* standard dialog entry
                   1091:    UINT   message, 
                   1092:    DWORD  wParam, 
                   1093:    LONG   lParam
                   1094: ){
                   1095:    static RETRYPTR   pRetry;
                   1096: 
                   1097:    switch (message) 
                   1098:    {
                   1099:       case WM_COMMAND:
                   1100:       {
                   1101:          WORD wID = LOWORD(wParam);
                   1102: 
                   1103:          switch (wParam) 
                   1104:          {
                   1105:                case IDD_SWITCH:
                   1106:                   DefWindowProc( hDlg, WM_SYSCOMMAND, SC_TASKLIST, NULL);
                   1107:                   break;
                   1108: 
                   1109:                case IDCANCEL:
                   1110:                   if (pRetry->paItem)
                   1111:                      pRetry->paItem->fRetry = FALSE;
                   1112:                   EndDialog(hDlg, TRUE);
                   1113:                   return TRUE;
                   1114: 
                   1115:                default:
                   1116:                    break;
                   1117:          }
                   1118:          break;
                   1119:       }
                   1120: 
                   1121:       case WM_INITDIALOG:
                   1122:       {
                   1123:           CHAR       szBuffer[CBMESSAGEMAX];
                   1124:           CHAR       szText[2*CBMESSAGEMAX];
                   1125:           
                   1126:           pRetry = (RETRYPTR)lParam;
                   1127:           hRetry = hDlg;
                   1128:        
                   1129:           LoadString(hInst, IDS_RETRY_TEXT1, szBuffer, CBMESSAGEMAX);
                   1130:           wsprintf(szText, szBuffer, pRetry->lpserver);
                   1131:           SetWindowText (GetDlgItem(hDlg, IDD_RETRY_TEXT1), szText);
                   1132: 
                   1133:           LoadString(hInst, IDS_RETRY_TEXT2, szBuffer, CBMESSAGEMAX);
                   1134:           wsprintf(szText, szBuffer, pRetry->lpserver);
                   1135:           SetWindowText (GetDlgItem(hDlg, IDD_RETRY_TEXT2), szText);
                   1136:        
                   1137:           EnableWindow (GetDlgItem(hDlg, IDCANCEL), pRetry->bCancel);
                   1138: 
                   1139:           return TRUE; 
                   1140:       }
                   1141:        
                   1142:       default:
                   1143:            break;
                   1144:    }
                   1145: 
                   1146:    return FALSE;
                   1147: }
                   1148: 

unix.superglobalmegacorp.com

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