Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Help me about find screen Resolution in Borland C++ 4.0

59 views
Skip to first unread message

Mhdi Ebrahimi

unread,
Oct 7, 2001, 3:44:52 AM10/7/01
to
Hi ,
How can I obtain current screen DPI setting( resolution ) with simple
programming in Borland C++ 4.0 .
Best Rgards,
Mehdi Ebrahimi


Giuliano

unread,
Oct 7, 2001, 6:03:21 AM10/7/01
to
On Sun, 07 Oct 2001 11:14:52 +0330, Mhdi Ebrahimi <ebra...@jsis.neda.net.ir>
wrote:

Try:

int GetDPI( void )
{
HDC hDC( GetDC( 0 ) );
const int Ret( GetDeviceCaps( hDC, LOGPIXELSX ) );
ReleaseDC( 0, hDC );
return Ret;
}

also...

#include <memory>

int GetDPI( void )
{
std::auto_ptr<TCanvas> C( new TCanvas );
C->Handle = GetDC( 0 );
return GetDeviceCaps( C->Handle, LOGPIXELSX );
}

or, in a function body of a class that's inherited from TCustomForm:

const int DPI( GetDeviceCaps( Canvas->Handle, LOGPIXELSX ) );

HTH

Ciao!

Giuliano

Vesty

unread,
Oct 7, 2001, 6:06:58 AM10/7/01
to
Screen->Width and Screen->Height will give you the current width and height
of the screen.

hth
Vesty.


Mhdi Ebrahimi

unread,
Oct 7, 2001, 5:59:03 AM10/7/01
to
Dear Mr.Giuliano
Thank you for helping me.
Best regards,
Mehdi Ebrahimi
0 new messages