Instead of
SM_CXSCREEN Screen breath in pixel 640
SM_CYSCREEN Screen height in pixel 480
the output is something like this
SM_CXSCREEN Screen height in pixel |||
SM_CYSCREEN Screen height in pixel ||
.
.
.
and so on.
and sometime other kinds of symbols
here's the modified code
(underlined portion is the portion i modified)
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
static int cxChar, cxCaps, cyChar ;
HDC hdc ;
int i ;
PAINTSTRUCT ps ;
TCHAR szBuffer [10] ;
TEXTMETRIC tm ;
int iLength;
switch (message)
{
case WM_CREATE:
hdc = GetDC (hwnd) ;
GetTextMetrics (hdc, &tm) ;
cxChar = tm.tmAveCharWidth ;
cxCaps = (tm.tmPitchAndFamily & 1 ? 3 : 2) * cxChar / 2 ;
cyChar = tm.tmHeight + tm.tmExternalLeading ;
ReleaseDC (hwnd, hdc) ;
return 0 ;
case WM_PAINT :
hdc = BeginPaint (hwnd, &ps) ;
for (i = 0 ; i < NUMLINES ; i++)
{
TextOut (hdc, 0, cyChar * i,
sysmetrics[i].szLabel,
lstrlen (sysmetrics[i].szLabel)) ;
TextOut (hdc, 22 * cxCaps, cyChar * i,
sysmetrics[i].szDesc,
lstrlen (sysmetrics[i].szDesc)) ;
SetTextAlign (hdc, TA_RIGHT | TA_TOP) ;
[COLOR="Red"][U] std::stringstream stream;
stream<<GetSystemMetrics (sysmetrics[i].iIndex);
std::string string=stream.str();
iLength=string.length(); [/U][/COLOR]
TextOut (hdc, 22 * cxCaps + 40 * cxChar, cyChar * i, szBuffer,iLength);
//wsprintf (szBuffer, TEXT ("%5d"),
//GetSystemMetrics (sysmetrics[i].iIndex))) ;
SetTextAlign (hdc, TA_LEFT | TA_TOP) ;
}
EndPaint (hwnd, &ps) ;
return 0 ;
case WM_DESTROY :
PostQuitMessage (0) ;
return 0 ;
}
return DefWindowProc (hwnd, message, wParam, lParam) ;
}
can you tell where i am going wrong.I have attached a screeshot you can take a look.
And another thing is that i am planning to learn asm language can anybody suggest me a good book .
Thank You:irritated:


Sign In
Create Account



Back to top









