تشکر میکنم ، از یه جا گیر آوردم و دوباره نویسی اش کردم.
case WM_PAINT:
WCHAR str[10];
wcscpy(str,L"وحید");
int len;
len = (int)wcslen(str);
HRESULT rslt;
//SCRIPT_CONTROL *psControl; //*psControl = (SCRIPT_CONTROL )NULL;
//SCRIPT_STATE *psState; //*psState = (SCRIPT_STATE )NULL;
int cMaxItems; cMaxItems = 500;
SCRIPT_ITEM items[500];
int cItems;
SCRIPT_CACHE ssc; ssc=NULL;
int mx_glyph; mx_glyph=len*2+16;
int glyph_cnt; glyph_cnt = 0;
int i;
int dx , dy; dx=0; dy=0;
rslt = ScriptItemize(str, len,cMaxItems,NULL, NULL,items, &cItems);
hdc = BeginPaint(hWnd, &ps);
// TODO: Add any drawing code here...
for(i=0;i<cItems;i++)
{
WORD *clusts; clusts = (WORD*)malloc(sizeof(WORD)*mx_glyph);
WORD *glyphs; glyphs = (WORD*)malloc(sizeof(WORD)*mx_glyph);
SCRIPT_VISATTR *sva; sva = (SCRIPT_VISATTR*)malloc(sizeof(SCRIPT_VISATTR)*mx_ glyph);
ScriptShape(hdc,&ssc,str,len,mx_glyph,&items[i].a,glyphs,clusts,sva,&glyph_cnt);
ABC abc;
int *adv;// *adv= NULL;
GOFFSET *offs;
offs = (GOFFSET*)malloc(sizeof(GOFFSET)*mx_glyph);
adv = (int*)malloc(sizeof(int)*mx_glyph);
ScriptPlace(hdc, &ssc, glyphs, glyph_cnt, sva, &items[i].a,adv, offs, &abc);
ScriptTextOut(hdc, &ssc, dx, dy, 0/*ETO_CLIPPED*/, NULL/*&lprc*/,&items[i].a, NULL, 0,glyphs, glyph_cnt, adv, NULL, //const int *piJustify
offs);
dx += abc.abcA + abc.abcB + abc.abcC;
}
EndPaint(hWnd, &ps);
break;