Annotation of mstools/samples/ddeml/server/dialog.c, revision 1.1

1.1     ! root        1: #include <string.h>
        !             2: #include <stdio.h>
        !             3: #include "server.h"
        !             4: #include "huge.h"
        !             5: 
        !             6: /****************************************************************************
        !             7:  *                                                                          *
        !             8:  *  FUNCTION   : DoDialog()                                                 *
        !             9:  *                                                                          *
        !            10:  *  PURPOSE    : Generic dialog invocation routine.  Handles procInstance   *
        !            11:  *               stuff, focus management and param passing.                 *                                                                   
        !            12:  *  RETURNS    : result of dialog procedure.                                *
        !            13:  *                                                                          *
        !            14:  ****************************************************************************/
        !            15: INT FAR DoDialog(
        !            16: LPSTR lpTemplateName,
        !            17: FARPROC lpDlgProc,
        !            18: DWORD param,
        !            19: BOOL fRememberFocus)
        !            20: {
        !            21:     WORD wRet;
        !            22:     HWND hwndFocus;
        !            23:     WORD cRunawayT;
        !            24: 
        !            25:     cRunawayT = cRunaway;
        !            26:     cRunaway = 0;           // turn off runaway during dialogs.
        !            27:     
        !            28:     if (fRememberFocus)
        !            29:         hwndFocus = GetFocus();
        !            30:     lpDlgProc = MakeProcInstance(lpDlgProc, hInst);
        !            31:     wRet = DialogBoxParam(hInst, lpTemplateName, hwndServer, lpDlgProc, param);
        !            32:     FreeProcInstance(lpDlgProc);
        !            33:     if (fRememberFocus)
        !            34:         SetFocus(hwndFocus);
        !            35: 
        !            36:     cRunaway = cRunawayT;   // restore runaway state.
        !            37:     return wRet;
        !            38: }
        !            39: 
        !            40: 
        !            41: /****************************************************************************
        !            42: 
        !            43:     FUNCTION: About(HWND, unsigned, WORD, LONG)
        !            44: 
        !            45:     PURPOSE:  Processes messages for "About" dialog box
        !            46: 
        !            47:     MESSAGES:
        !            48: 
        !            49:         WM_INITDIALOG - initialize dialog box
        !            50:         WM_COMMAND    - Input received
        !            51: 
        !            52:     COMMENTS:
        !            53: 
        !            54:         No initialization is needed for this particular dialog box, but TRUE
        !            55:         must be returned to Windows.
        !            56: 
        !            57:         Wait for user to click on "Ok" button, then close the dialog box.
        !            58: 
        !            59: ****************************************************************************/
        !            60: 
        !            61: BOOL  APIENTRY About(hDlg, message, wParam, lParam)
        !            62: HWND hDlg;                                /* window handle of the dialog box */
        !            63: UINT message;                         /* type of message                 */
        !            64: WPARAM wParam;                              /* message-specific information    */
        !            65: LONG lParam;
        !            66: {
        !            67:     switch (message) {
        !            68:         case WM_INITDIALOG:                /* message: initialize dialog box */
        !            69:             return (TRUE);
        !            70: 
        !            71:         case WM_COMMAND:                      /* message: received a command */
        !            72:             if (GET_WM_COMMAND_ID(wParam, lParam) == IDOK                /* "OK" box selected?          */
        !            73:                 || GET_WM_COMMAND_ID(wParam, lParam) == IDCANCEL) {      /* System menu close command? */
        !            74:                 EndDialog(hDlg, TRUE);        /* Exits the dialog box        */
        !            75:                 return (TRUE);
        !            76:             }
        !            77:             break;
        !            78:     }
        !            79:     return (FALSE);                           /* Didn't process a message    */
        !            80: }
        !            81: 
        !            82: 
        !            83: 
        !            84: 
        !            85: BOOL  APIENTRY RenderDelayDlgProc(
        !            86: HWND          hwnd,
        !            87: register UINT msg,
        !            88: register WPARAM wParam,
        !            89: LONG          lParam)
        !            90: {
        !            91:     switch (msg){
        !            92:     case WM_INITDIALOG:
        !            93:         SetWindowText(hwnd, "Data Render Delay");
        !            94:         SetDlgItemInt(hwnd, IDEF_VALUE, RenderDelay, FALSE);
        !            95:         SetDlgItemText(hwnd, IDTX_VALUE, "Delay in milliseconds:");
        !            96:         return(1);
        !            97:         break;
        !            98: 
        !            99:     case WM_COMMAND:
        !           100:         switch (GET_WM_COMMAND_ID(wParam, lParam)) {
        !           101:         case IDOK:
        !           102:             RenderDelay = GetDlgItemInt(hwnd, IDEF_VALUE, NULL, FALSE);
        !           103:             // fall through 
        !           104:         case IDCANCEL:
        !           105:             EndDialog(hwnd, 0);
        !           106:             break;
        !           107: 
        !           108:         default:
        !           109:             return(FALSE);
        !           110:         }
        !           111:         break;
        !           112:     }
        !           113:     return(FALSE);
        !           114: }
        !           115: 
        !           116: 
        !           117: 
        !           118: 
        !           119: BOOL  APIENTRY SetTopicDlgProc(
        !           120: HWND          hwnd,
        !           121: register UINT msg,
        !           122: register WPARAM wParam,
        !           123: LONG          lParam)
        !           124: {
        !           125:     CHAR szT[MAX_TOPIC + 10];
        !           126:     
        !           127:     switch (msg){
        !           128:     case WM_INITDIALOG:
        !           129:         SetWindowText(hwnd, "Set Topic Dialog");
        !           130:         SetDlgItemText(hwnd, IDEF_VALUE, szTopic);
        !           131:         SetDlgItemText(hwnd, IDTX_VALUE, "Topic:");
        !           132:         return(1);
        !           133:         break;
        !           134: 
        !           135:     case WM_COMMAND:
        !           136:         switch (GET_WM_COMMAND_ID(wParam, lParam)) {
        !           137:         case IDOK:
        !           138:             DdeFreeStringHandle(idInst, topicList[1].hszTopic);
        !           139:             GetDlgItemText(hwnd, IDEF_VALUE, szTopic, MAX_TOPIC);
        !           140:             topicList[1].hszTopic = DdeCreateStringHandle(idInst, szTopic, 0);
        !           141:             strcpy(szT, szServer);
        !           142:             strcat(szT, " | ");
        !           143:             strcat(szT, szTopic);
        !           144:             SetWindowText(hwndServer, szT);
        !           145:             // fall through 
        !           146:         case IDCANCEL:
        !           147:             EndDialog(hwnd, 0);
        !           148:             break;
        !           149: 
        !           150:         default:
        !           151:             return(FALSE);
        !           152:         }
        !           153:         break;
        !           154:     }
        !           155:     return(FALSE);
        !           156: }
        !           157: 
        !           158: 
        !           159: BOOL  APIENTRY SetServerDlgProc(
        !           160: HWND          hwnd,
        !           161: register UINT msg,
        !           162: register WPARAM wParam,
        !           163: LONG          lParam)
        !           164: {
        !           165:     CHAR szT[MAX_TOPIC + 10];
        !           166:     
        !           167:     switch (msg){
        !           168:     case WM_INITDIALOG:
        !           169:         SetWindowText(hwnd, "Set Server Name Dialog");
        !           170:         SetDlgItemText(hwnd, IDEF_VALUE, szServer);
        !           171:         SetDlgItemText(hwnd, IDTX_VALUE, "Server:");
        !           172:         return(1);
        !           173:         break;
        !           174: 
        !           175:     case WM_COMMAND:
        !           176:         switch (GET_WM_COMMAND_ID(wParam, lParam)) {
        !           177:         case IDOK:
        !           178:             GetDlgItemText(hwnd, IDEF_VALUE, szServer, MAX_TOPIC);
        !           179:             DdeNameService(idInst, hszAppName, 0, DNS_UNREGISTER);
        !           180:             DdeFreeStringHandle(idInst, hszAppName);
        !           181:             hszAppName = DdeCreateStringHandle(idInst, szServer, 0);
        !           182:             DdeNameService(idInst, hszAppName, 0, DNS_REGISTER);
        !           183:             strcpy(szT, szServer);
        !           184:             strcat(szT, " | ");
        !           185:             strcat(szT, szTopic);
        !           186:             SetWindowText(hwndServer, szT);
        !           187:             // fall through 
        !           188:         case IDCANCEL:
        !           189:             EndDialog(hwnd, 0);
        !           190:             break;
        !           191: 
        !           192:         default:
        !           193:             return(FALSE);
        !           194:         }
        !           195:         break;
        !           196:     }
        !           197:     return(FALSE);
        !           198: }
        !           199: 
        !           200: 
        !           201: 
        !           202: 
        !           203: BOOL  APIENTRY ContextDlgProc(
        !           204: HWND          hwnd,
        !           205: register UINT msg,
        !           206: register WPARAM wParam,
        !           207: LONG          lParam)
        !           208: {
        !           209:     BOOL fSuccess;
        !           210:     
        !           211:     switch (msg){
        !           212:     case WM_INITDIALOG:
        !           213:         SetDlgItemInt(hwnd, IDEF_FLAGS, CCFilter.wFlags, FALSE);
        !           214:         SetDlgItemInt(hwnd, IDEF_COUNTRY, CCFilter.wCountryID, FALSE);
        !           215:         SetDlgItemInt(hwnd, IDEF_CODEPAGE, CCFilter.iCodePage, TRUE);
        !           216:         SetDlgItemInt(hwnd, IDEF_LANG, LOWORD(CCFilter.dwLangID), FALSE);
        !           217:         SetDlgItemInt(hwnd, IDEF_SECURITY, LOWORD(CCFilter.dwSecurity), FALSE);
        !           218:         return(1);
        !           219:         break;
        !           220: 
        !           221:     case WM_COMMAND:
        !           222:         switch (GET_WM_COMMAND_ID(wParam, lParam)) {
        !           223:         case IDOK:
        !           224:             CCFilter.wFlags = GetDlgItemInt(hwnd, IDEF_FLAGS, &fSuccess, FALSE);
        !           225:             if (!fSuccess) return(0);
        !           226:             CCFilter.wCountryID = GetDlgItemInt(hwnd, IDEF_COUNTRY, &fSuccess, FALSE);
        !           227:             if (!fSuccess) return(0);
        !           228:             CCFilter.iCodePage = GetDlgItemInt(hwnd, IDEF_CODEPAGE, &fSuccess, TRUE);
        !           229:             if (!fSuccess) return(0);
        !           230:             CCFilter.dwLangID = (DWORD)GetDlgItemInt(hwnd, IDEF_LANG, &fSuccess, FALSE);
        !           231:             if (!fSuccess) return(0);
        !           232:             CCFilter.dwSecurity = (DWORD)GetDlgItemInt(hwnd, IDEF_SECURITY, &fSuccess, FALSE);
        !           233:             if (!fSuccess) return(0);
        !           234:             
        !           235:             // fall through 
        !           236:         case IDCANCEL:
        !           237:             EndDialog(hwnd, 0);
        !           238:             break;
        !           239: 
        !           240:         default:
        !           241:             return(FALSE);
        !           242:         }
        !           243:         break;
        !           244:     }
        !           245:     return(FALSE);
        !           246: }

unix.superglobalmegacorp.com

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