Article ID: 147647
Article Last Modified on 4/12/2004
GetTextExtentPoint(hDC, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", 32, &size);
HGLOBAL hMem;
HDC hDC;
SIZE size;
int blksize, i;
char szMsg[256];
LPSTR lpBuf;
blksize=32;
#ifdef WIN32
SetLastError(0);
#endif
hDC = GetDC(hWnd);
hMem = GlobalAlloc(GHND, blksize);
lpBuf = (LPSTR) GlobalLock(hMem);
for (i=0; i<blksize; i++)
lpBuf[i] = 't';
if (!GetTextExtentPoint(hDC, lpBuf, blksize, &size))
{
#ifdef WIN32
wsprintf(szMsg, "GetTextExtentPoint Error %d\r\n", GetLastError());
#else
wsprintf(szMsg, "GetTextExtentPoint Error\r\n);
#endif
MessageBox(NULL, szMsg, "Test", MB_OK);
}
GlobalUnlock(hMem);
#ifdef WIN32
SetLastError(0);
#endif
hMem = GlobalReAlloc(hMem, 2*blksize, GMEM_ZEROINIT);
lpBuf = (LPSTR) GlobalLock(hMem);
for (i=0; i<blksize; i++)
lpBuf[blksize+i] = 'T';
if (!GetTextExtentPoint(hDC, lpBuf, 2*blksize, &size))
{
#ifdef WIN32
wsprintf(szMsg, "GetTextExtentPoint Error %d\r\n", GetLastError());
#else
wsprintf(szMsg, "GetTextExtentPoint Error \r\n");
#endif
MessageBox(NULL, szMsg, "Test", MB_OK);
}
GlobalUnlock(hMem);
if (hMem) GlobalFree(hMem);
Additional query words: win32s gdi 1.30c 4.00 3.10 3.51
Keywords: kbgdi KB147647