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