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

text.c

Go to the documentation of this file.
00001 /****************************** Module Header ******************************\ 00002 * Module Name: text.c 00003 * 00004 * Copyright (c) 1985 - 1999, Microsoft Corporation 00005 * 00006 * This module contains the MessageBox API and related functions. 00007 * 00008 * History: 00009 * 10-01-90 EricK Created. 00010 * 11-20-90 DarrinM Merged in User text APIs. 00011 * 02-07-91 DarrinM Removed TextOut, ExtTextOut, and GetTextExtentPoint stubs. 00012 \***************************************************************************/ 00013 00014 00015 /***************************************************************************\ 00016 * PSMGetTextExtent 00017 * 00018 * NOTE: This routine should only be called with the system font since having 00019 * to realize a new font would cause memory to move... 00020 * 00021 * LATER: Can't this be eliminated altogether? Nothing should be moving 00022 * anymore. 00023 * 00024 * History: 00025 * 11-13-90 JimA Ported. 00026 \***************************************************************************/ 00027 00028 #ifdef _USERK_ 00029 00030 BOOL xxxPSMGetTextExtent( 00031 HDC hdc, 00032 LPWSTR lpstr, 00033 int cch, 00034 PSIZE psize) 00035 { 00036 int result; 00037 WCHAR szTemp[255], *pchOut; 00038 PTHREADINFO ptiCurrent = PtiCurrentShared(); 00039 TL tl; 00040 00041 if (cch > sizeof(szTemp)/sizeof(WCHAR)) { 00042 pchOut = (WCHAR*)UserAllocPool((cch+1) * sizeof(WCHAR), TAG_RTL); 00043 if (pchOut == NULL) 00044 return FALSE; 00045 ThreadLockPool(ptiCurrent, pchOut, &tl); 00046 } else { 00047 pchOut = szTemp; 00048 } 00049 00050 result = HIWORD(GetPrefixCount(lpstr, cch, pchOut, cch)); 00051 00052 if (result) { 00053 lpstr = pchOut; 00054 cch -= result; 00055 } 00056 if (CALL_LPK(ptiCurrent)) { 00057 xxxClientGetTextExtentPointW(hdc, lpstr, cch, psize); 00058 } else { 00059 UserGetTextExtentPointW(hdc, lpstr, cch, psize); 00060 } 00061 if (pchOut != szTemp) 00062 ThreadUnlockAndFreePool(ptiCurrent, &tl); 00063 00064 /* 00065 * IanJa everyone seems to ignore the ret val 00066 */ 00067 return TRUE; 00068 } 00069 00070 #else 00071 00072 BOOL PSMGetTextExtent( 00073 HDC hdc, 00074 LPCWSTR lpstr, 00075 int cch, 00076 PSIZE psize) 00077 { 00078 int result; 00079 WCHAR szTemp[255], *pchOut; 00080 00081 if (cch > sizeof(szTemp)/sizeof(WCHAR)) { 00082 pchOut = (WCHAR*)UserLocalAlloc(0, (cch+1) * sizeof(WCHAR)); 00083 if (pchOut == NULL) 00084 return FALSE; 00085 } else { 00086 pchOut = szTemp; 00087 } 00088 00089 result = HIWORD(GetPrefixCount(lpstr, cch, pchOut, cch)); 00090 00091 if (result) { 00092 lpstr = pchOut; 00093 cch -= result; 00094 } 00095 00096 UserGetTextExtentPointW(hdc, lpstr, cch, psize); 00097 00098 if (pchOut != szTemp) 00099 UserLocalFree(pchOut); 00100 00101 /* 00102 * IanJa everyone seems to ignore the ret val 00103 */ 00104 return TRUE; 00105 } 00106 00107 #endif // _USERK_

Generated on Sat May 15 19:41:57 2004 for test by doxygen 1.3.7