Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

edmlonce.c

Go to the documentation of this file.
00001 /****************************************************************************\ 00002 * edmlonce.c 00003 * 00004 * Copyright (c) 1985 - 1999, Microsoft Corporation 00005 * 00006 * dec 1990 mikeke from win30 00007 \****************************************************************************/ 00008 00009 #include "precomp.h" 00010 #pragma hdrstop 00011 00012 /***************************************************************************\ 00013 * MLCreate AorW 00014 * 00015 * Creates the edit control for the window hwnd by allocating memory 00016 * as required from the application's heap. Notifies parent if no memory 00017 * error (after cleaning up if needed). Returns TRUE if no error else return s 00018 * -1. 00019 * 00020 * History: 00021 \***************************************************************************/ 00022 00023 LONG MLCreate( 00024 PED ped, 00025 LPCREATESTRUCT lpCreateStruct) 00026 { 00027 LONG windowStyle; 00028 LPWSTR lpszName; 00029 00030 /* 00031 * Get values from the window instance data structure and put them in the 00032 * ped so that we can access them easier 00033 */ 00034 windowStyle = ped->pwnd->style; 00035 00036 /* 00037 * Do the standard creation stuff 00038 */ 00039 if (!ECCreate(ped, windowStyle)) { 00040 return (-1); 00041 } 00042 00043 /* 00044 * Allocate line start array in local heap and lock it down 00045 */ 00046 ped->chLines = (LPICH)LocalAlloc(LPTR, 2 * sizeof(int)); 00047 if (ped->chLines == NULL) { 00048 return (-1); 00049 } 00050 00051 /* 00052 * Call it one line of text... 00053 */ 00054 ped->cLines = 1; 00055 00056 /* 00057 * If app wants WS_VSCROLL or WS_HSCROLL, it automatically gets AutoVScroll 00058 * or AutoHScroll. 00059 */ 00060 if ((windowStyle & ES_AUTOVSCROLL) || (windowStyle & WS_VSCROLL)) { 00061 ped->fAutoVScroll = 1; 00062 } 00063 00064 if (ped->format != ES_LEFT) 00065 { 00066 /* 00067 * If user wants right or center justified text, then we turn off 00068 * AUTOHSCROLL and WS_HSCROLL since non-left styles don't make sense 00069 * otherwise. 00070 */ 00071 windowStyle &= ~WS_HSCROLL; 00072 ClearWindowState(ped->pwnd, WFHSCROLL); 00073 ped->fAutoHScroll = FALSE; 00074 } 00075 else if (windowStyle & WS_HSCROLL) { 00076 ped->fAutoHScroll = TRUE; 00077 } 00078 00079 ped->fWrap = (!ped->fAutoHScroll && !(windowStyle & WS_HSCROLL)); 00080 00081 /* 00082 * Max # chars we will allow user to enter 00083 */ 00084 ped->cchTextMax = MAXTEXT; 00085 00086 /* 00087 * Set the default font to be the system font. 00088 */ 00089 ECSetFont(ped, NULL, FALSE) ; 00090 00091 /* 00092 * Set the window text if needed and notify parent if not enough memory to 00093 * set the initial text. 00094 */ 00095 if ((ULONG_PTR)lpCreateStruct->lpszName > gHighestUserAddress) 00096 lpszName = REBASEPTR(ped->pwnd, (PVOID)lpCreateStruct->lpszName); 00097 else 00098 lpszName = (LPWSTR)lpCreateStruct->lpszName; 00099 if (!ECSetText(ped, (LPSTR)lpszName)) 00100 return (-1); 00101 00102 return (TRUE); 00103 }

Generated on Sat May 15 19:39:49 2004 for test by doxygen 1.3.7