编辑框

char temp[]="123456"; pPosInfo->Hhandle[0] = CreateWindow ("sledit","", WS_CHILD |SS_NOTIFY |WS_BORDER | SS_LEFT | WS_VISIBLE,(DWORD)logfontgb[1],IDC_MLEDIT, 100, 130, 125,25 , hWnd, 0); //设置文本上限 SendMessage(pPosInfo->Hhandle[0],EM_LIMITTEXT,16,0L); SetFocus (pPosInfo->Hhandle[0]); //设置编辑框中的文本内容 SetWindowText(pPosInfo->Hhandle[0],temp); //设置插入符位置 SendMessage(pPosInfo->Hhandle[0],EM_SETCARETPOS,0,7L); int i,line_pos,char_pos; //获取文本的长度,以字节为单位 i = GetWindowTextLength(pPosInfo->Hhandle[0]); //获取插入符位置 SendMessage (pPosInfo->Hhandle[0], EM_GETCARETPOS, (WPARAM) &line_pos, (LPARAM) &char_pos); printf("the lenth is [%d]/n",i); printf("the line_pos is [%d] the char_pos is [%d]/n",line_pos,char_pos);

你可能感兴趣的:(border)