LPPOINT lpPoints;   // Path data points
   LPBYTE lpTypes;   // Path data types
   int i, iNumPts;
   SIZE size;   // Text size info
   float fXScale, fYScale;   // Scaling values
   int iTopInd, iBotInd;   // Guide array indices   // Set to transparent so we dont get an outline around the text string
   SetBkMode(hDC, TRANSPARENT);
      
   // Output the text into a path
   BeginPath(hDC);
   TextOut(hDC, 0, 0, szText, strlen(szText));
   EndPath(hDC);    
      
   // How many points are in the path
   // How many points are in the path
 iNumPts = GetPath(hDC, NULL, NULL, 0);。   if (iNumPts == -1)
   return FALSE;
   
   // Allocate room for the points
   lpPoints = (LPPOINT)GlobalAlloc(GPTR, sizeof(POINT) * iNumPts);
   if (!lpPoints) return FALSE;   // Allocate room for the point types
   lpTypes = GlobalAlloc(GPTR, iNumPts);
   
   
   if (!lpTypes) {
     GlobalFree(lpPoints);
    return FALSE;
   }
   
   // Get the points and types from the current path
   iNumPts = GetPath(hDC, lpPoints, lpTypes, iNumPts);
     // Even more error checking
   if (iNumPts == -1) {
     GlobalFree(lpTypes);
     GlobalFree(lpPoints);
 return FALSE;
   }
   
   //Get extents of the text string for scaling purposes  
   GetTextExtentPoint32(hDC, szText, strlen(szText), &size);
   
   // Relocate the points in the path based on the guide lines
   for (i=0; i < iNumPts; i++) {
     // How far along is this point on the x-axis
     fXScale = (float)lpPoints[i].x / (float)size.cx;     // What point on the top guide does this coorespond to
     iTopInd = (int)(fXScale * (dwTopPts-1));
 // What point on the bottom guide does this coorespond to
     iBotInd = (int)(fXScale * (dwBotPts-1));     // How far along is this point on the y-axis
     fYScale = (float)lpPoints[i].y / (float)size.cy;     // Scale the points to their new locations
     lpPoints[i].x = (int)((lpBot[iBotInd].x * fYScale) + (lpTop[iTopInd].x * (1.0f-fYScale)));
     lpPoints[i].y = (int)((lpBot[iBotInd].y * fYScale) + (lpTop[iTopInd].y * (1.0f-fYScale)));
   }   // Draw the new path 
   RenderPathPoints(hDC, lpPoints, lpTypes, iNumPts, bOutlineOnly);
   
   GlobalFree(lpPoints);
   GlobalFree(lpTypes);

解决方案 »

  1.   

    我是菜鸟一个,如果问题太简单,请大家不要笑我。
    第一个;LPBYTE lpTypes;这样定义为什么编译时不会报错。为什么我自己这么写就不行呢?
      

  2.   

    ??
    LPBYTE lpTypes;本来这样定义就是对的呀你这样定义出错了??报什么错呢
      

  3.   

    typedef BYTE far *LPBYTE;LPBYTE是 BYTE型的指针在windows中是已经帮你这样定义好了的类型啊,呵呵
      

  4.   

    LPBYTE             Pointer to a BYTE
    这是win32的类型怎么会出错呢?你是指什么?
      

  5.   

    typedef BYTE far            *LPBYTE;你可以右键点击LPBYTE,然后选择GO TO DEFINE OF LYBYTE,就可以看到相应得定义了。
      

  6.   

    LPBYTE是执行BYTE类型数据的指针,如果你编译有问题可能需要
    include "windows.h"
    如果是运行出问题可能是你没有为之分配内存,它只是个指针
      

  7.   

    这么多高手啊!先谢谢了.
    编译的结果是这样的.
    C2275: 'LPBYTE' : illegal use of this type as an expression
            C:\Program Files\Microsoft Platform SDK for Windows XP SP2\include\windef.h(150) : see declaration of 'LPBYTE'
    textfx.c(441) : error C2146: syntax error : missing ';' before identifier 'lpTypes'
    textfx.c(441) : error C2065: 'lpTypes' : undeclared identifier因为我是在看MSDN里的一个程序的源代码,所以看到不会的我就想自己试着模仿一下,所以我自己在人家的源程序上加了一个自己的菜单.可是在这里面我只是写了一行LPBYTE lpTypes;我也想过是指针问题,但具体我也不太知道该怎么办.
      

  8.   

    还有一点,关于路径,getpath里的第三个参数关于顶点指的是什么,是字的顶点吗?
    lpTypes = GlobalAlloc(GPTR, iNumPts);为什么要这样呢?