Hi. Im simply trying to use TextOut() to Display two strings.
One constant, and one which may vary.
I use a TEXTMETRIC field to keep track on where to begin the secound TextOut(). The problem is that the cxChar(which should contain the character width, have a far too low value. And YES, I am using SYSTEM_FIXED_FONT
Here is a little of my code:
Code:
#define INPUTBUFFER_SIZE 100
#include <windows.h>
const char* Ip_Enter = "Enter IP:";
TCHAR buffer[INPUTBUFFER_SIZE];
//////////////////////////////////////////////////////
case WM_CREATE :
hdc=GetDC(hwnd);
SelectObject(hdc,GetStockObject(SYSTEM_FIXED_FONT));
GetTextMetrics(hdc,&tm);
cxChar=tm.tmMaxCharWidth;
ReleaseDC(hwnd, hdc);
return 0;
case WM_PAINT :
hdc = BeginPaint (hwnd, &ps) ;
SelectObject(hdc,GetStockObject(SYSTEM_FIXED_FONT));
if(connectStat==STATE_ENTER_IP) {
TextOut(hdc,0,0,Ip_Enter,lstrlen(Ip_Enter));
TextOut(hdc,cxChar*(lstrlen(Ip_Enter)),0,buffer,lstrlen(buffer));
}
EndPaint (hwnd, &ps) ;
return 0;
Where does my stupidity show off in code-form this time
Anyone can help me figure out the error(s)?