Click here to Skip to main content
15,894,106 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
Is there any function to get the maximum number of rows and cols of the output window.

Regards,
Kiran
Posted

1 solution

Windows GUI doesn't provide such a information, because it supports proportional fonts. Only if you have a monospaced font then you may compute rows and cols values using functions like GetWindowRect[^] and, for instance, GetTextExtentPoint32[^].
 
Share this answer
 
Comments
[no name] 3-Aug-11 3:43am    
i have been trying like below but even then it is not working.

case WM_CHAR:
iMaxRows = LOWORD( lParam );
iMaxCols = HIWORD( lParam );
hdc = GetDC( hwnd );
szBuffer[0] = wParam;
SelectObject (hdc, CreateFont (0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, FIXED_PITCH, NULL)) ;
TextOut( hdc, ixChar * x++, iyChar * y, szBuffer, lstrlen( szBuffer ) );
if( x == iMaxRows )
{
x = 0;
y++;
}

ReleaseDC( hwnd, hdc );
CPallini 3-Aug-11 3:49am    
Why is it supposed to work? I mean lParam of WM_CHAR message does NOT contain the info you are trying to extract from.
[no name] 3-Aug-11 3:58am    
i read in some blogs which say like LOWORD of lparam gives max cols and hiword of lparam gives max rows. :(
Sergey Alexandrovich Kryukov 3-Aug-11 19:01pm    
Probably somebody lied to you :<
--SA
CPallini 4-Aug-11 10:29am    
Please stop reading blogs, read the documentation instead.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900