|
|
1.1 ! root 1: CDTEST consists of a number of dialog boxes that allow you to edit ! 2: the values of each of the common dialog creation structure members. ! 3: This will allow you to create nearly any type of common dialog box ! 4: on the fly. ! 5: ! 6: Here are some things that you need to know about how it works: ! 7: ! 8: ! 9: For ALL the CDTEST dialogs: ! 10: *************************** ! 11: ! 12: 1. CDTEST does not create any type of dialog on its own besides ! 13: a default one. If you want to create your own type of common dialog, ! 14: you have to edit the structure element fields. For instance, if ! 15: you want to hide the network button in the GetOpenFileName() ! 16: dialog, you have to "OR" the value for OFN_NONETWORKBUTTON in ! 17: "Flags" structure element field. To get the values for the ! 18: common dialog flags, look in the commdlg.h header file. ! 19: ! 20: ! 21: 2. There are some check boxes in each dialog that need some explanation: ! 22: ! 23: A. The "NULL Structure" box. ! 24: ! 25: If you check this box, CDTEST will send a NULL value for the common ! 26: dialog creation structure to the common dialog function. The common ! 27: dialog should fail at startup, and the common dialog function should ! 28: return FALSE and set the correct CommDlgExtendedError(). ! 29: ! 30: B. The "Preloaded Template" box(es). ! 31: ! 32: If this box is marked, CDTEST will preload a custom template ! 33: resource and put the value of the handle to the resource ! 34: in the hInstance member of the common dialog structure (or in ! 35: the hPrintTemplate / hSetupTemplate if you are in the PrintDlg() ! 36: dialog). BUT, CDTEST will not create a custom template dialog ! 37: with this preloaded custom template unless you also put the ! 38: XXX_ENABLETEMPLATEHANDLE flag in the "Flags" box. So to create ! 39: a GetOpenFileName() dialog with a multiple selection files list box ! 40: and a preloaded custom dialog template: ! 41: ! 42: 1. Put (OFN_ENABLETEMPLATEHANDLE | OFN_ALLOWMULTISELECT) ! 43: in the "Flags" edit box. ! 44: ! 45: 2. Check the "Preloaded Template" box. ! 46: ! 47: 3. Click OK. ! 48: ! 49: * Note: Be sure you are in the right "number mode". If you are ! 50: in "Decimal Mode" and you enter hex values into the structure ! 51: you will get unexpected results. Choose Hex Mode or Decimal ! 52: mode from the main menu. ! 53: ! 54: ! 55: 3. The RESET Button will set all the values for the common dialog ! 56: creation structure back to CDTEST's defaults. ! 57: ! 58: 4. "Add" and "Clear" buttons. These are used to edit arrays that ! 59: might be needed in common dialog box creation. "Clear" clears ! 60: the whole array and "Add" adds what you have typed into the ! 61: edit control part of the combo box to the left of these buttons. ! 62: ! 63: 5. "MultiThread" buttons. These will create dialogs in exactly the ! 64: same way that CDTEST always does, but it will create two threads ! 65: and two dialogs. ! 66: ! 67: *Note: The modeless-ness of the find and replace dialogs causes ! 68: some problems with multithreading them, so multithreading ! 69: for FindText() and ReplaceText() has not been implemented. ! 70: ! 71: ! 72: ! 73: ! 74: Information specific to only some of the CDTEST dialogs: ! 75: ******************************************************** ! 76: ! 77: ChooseFont: ! 78: ----------- ! 79: ! 80: 1. When you open the choosefont dialog you see a list of ChooseFont() ! 81: flags and fonts on the right of the vertical dividing line. These ! 82: do not affect the choosefont dialog creation at all. These only exist ! 83: to allow the user to compare the fonts found by Choosefont() with a ! 84: list of fonts found independently of ChooseFont(). The lists should ! 85: be indentical. So, if you want to see a list of only the ! 86: scalable screen fonts, mark the "CF_SCALABLEONLY" and "CF_SCREENFONTS" ! 87: boxes. If you create a ChooseFont() dialog with the flags of ! 88: (CF_SCREENFONTS | CF_SCALABLEONLY) you should get the same list of ! 89: fonts. ! 90: ! 91: 2. NOTE: The ChooseFont() dialog will give you a "No fonts found" ! 92: error if you don't include the CF_SCREENFONTS or the CF_PRINTERFONTS ! 93: flag as part of the value in the "Flags" edit box. This is by common ! 94: dialog design. ! 95: ! 96: 3. If you want printer fonts to be listed in the ChooseFont() dialog, you ! 97: have to mark the "Printer" radio button in the "HDC Type" group. ! 98: ! 99: Example: ! 100: ! 101: To create a ChooseFont() dialog containing only the scalable screen ! 102: fonts that exist on the current printer: ! 103: ! 104: A. Put the value for (CF_PRINTERFONTS | CF_SCALABLEONLY) in the "Flags" ! 105: edit box. ! 106: ! 107: B. Mark the "Printer" option in the "HDC Type" group. ! 108: ! 109: C. Click OK. ! 110: ! 111: ! 112: ! 113: Open/Save: ! 114: ---------- ! 115: ! 116: 1. If you want to create a custom template Open or Save dialog with ! 117: the OFN_ENABLETEMPLATE flag, you need to specify the name of the ! 118: template in the "lpTemplateName" structure field. The names are: ! 119: ! 120: opentemp1 -- single selection files list box dialog template. ! 121: ! 122: opentemp2 -- multiple selection files list box dialog template. ! 123: ! 124: ! 125: Find/Replace: ! 126: ------------- ! 127: ! 128: 1. If you want to create a custom template Find or Replace dialog with ! 129: the FR_ENABLETEMPLATE flag, you need to specify the name of the ! 130: template in the "lpTemplateName" structure field. The names are: ! 131: ! 132: frtemp1 -- find template. ! 133: ! 134: frtemp2 -- replace template. ! 135: ! 136: ! 137: ! 138: Final Notes: ! 139: ************ ! 140: ! 141: ! 142: * There is no way to create a NULL pointer as a value to be used for one of ! 143: the dialog elements that requires a string pointer such as the "lpstrFile" ! 144: element of the GetOpenFileName() structure. If you leave this field blank, ! 145: CDTEST will call GetOpenFileName with a valid pointer to a string containing ! 146: a NULL character as its first value. ! 147: ! 148: ! 149: * If you click the multithreading button, the two dialogs that are created ! 150: are positioned in exactly the same spot on the screen so it looks like only ! 151: one was created. ! 152: ! 153: ! 154: * It is best to click the "Reset" button after you return to CDTEST from ! 155: a common dialog because CDTEST fills the current structure-editing fields ! 156: with the values contained in the common dialog creation structure AFTER ! 157: the common dialog function has returned. These values may not be what ! 158: you expect. ! 159: ! 160: An example of when this would cause a problem would be the following: ! 161: ! 162: 1. Go to Dialogs, GetOpenFileName. ! 163: ! 164: 2. Click OK to create the default GetOpenFileName dialog. ! 165: ! 166: 3. Cancel the GetOpenFileName dialog. ! 167: ! 168: 4. Put the value for OFN_ENABLEHOOK in the "Fields" edit box, and click ! 169: OK. This will fail because if you call GetOpenFileName() without ! 170: OFN_ENABLEHOOK, it sets the value for OPENFILENAME.lpfnHook to ! 171: NULL - by common dialog design. So when you returned from the first ! 172: GetOpenFileName() dialog, the NULL value for OPENFILENAME.lpfnHook was ! 173: put in the "lpfnHook" edit box, and when you tried to call the function ! 174: again with the OFN_ENABLEHOOK flag, you get a failure because the ! 175: address for your hook proc is NULL.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.