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
hth
Vesty.