#include "fivewin.ch"
#include "xbrowse.ch"
Function Main()
Local oDlg, oBrw, aValues:={}, nC
DEFINE DIALOG oDlg SIZE 300, 200
@ 0, 0 XBROWSE oBrw OF oDlg ARRAY { { "one","two","three" } } AUTOCOLS
oBrw:CreateFromCode()
ACTIVATE DIALOG oDlg CENTER ON INIT ( oDlg:oClient := oBrw, oDlg:Resize(), aValues:=NonClient (25,25,20,20) )
For nC:=1 to len (avalues)
msginfo (avalues[nc])
next
Return (nil)
#pragma BEGINDUMP
#include "windows.h"
#include "hbapi.h"
#include "hbcomp.h"
HB_FUNC ( NONCLIENT )
{
NONCLIENTMETRICS mi;
memset( ( char * ) &mi, 0, sizeof( NONCLIENTMETRICS ) );
mi.cbSize = sizeof( NONCLIENTMETRICS );
SystemParametersInfo( SPI_GETNONCLIENTMETRICS, 0, &mi, 0);
// Devuelvo un array con los valores antes de cambiarlos
hb_reta(4);
hb_storvni(mi.iScrollWidth, -1, 1);
hb_storvni(mi.iScrollHeight,-1, 2);
hb_storvni(mi.iCaptionHeight, -1, 3);
hb_storvni(mi.iMenuHeight, -1, 4);
// Grabar el valor
mi.iScrollWidth = hb_parnl( 1 );
mi.iScrollHeight = hb_parnl( 2 );
mi.iCaptionHeight = hb_parnl ( 3 );
mi.iMenuHeight = hb_parnl ( 4 );
SystemParametersInfo( SPI_SETNONCLIENTMETRICS, sizeof( mi ), &mi, 0 ); //SPIF_SENDCHANGE); // Update Win.ini
}
#pragma ENDDUMP
typedef struct tagNONCLIENTMETRICS {
UINT cbSize;
int iBorderWidth;
int iScrollWidth;
int iScrollHeight;
int iCaptionWidth;
int iCaptionHeight;
LOGFONT lfCaptionFont;
int iSmCaptionWidth;
int iSmCaptionHeight;
LOGFONT lfSmCaptionFont;
int iMenuWidth;
int iMenuHeight;
LOGFONT lfMenuFont;
LOGFONT lfStatusFont;
LOGFONT lfMessageFont;
#if (WINVER >= 0x0600)
int iPaddedBorderWidth;
#endif
} NONCLIENTMETRICS, *PNONCLIENTMETRICS, *LPNONCLIENTMETRICS;
hb_reta(4);
hb_storvni(mi.iScrollWidth, -1, 1);
hb_storvni(mi.iScrollHeight,-1, 2);
hb_storvni(mi.iCaptionHeight, -1, 3);
hb_storvni(mi.iMenuHeight, -1, 4);
#pragma BEGINDUMP
#include "windows.h"
#include "hbapi.h"
#include "hbcomp.h"
HB_FUNC ( NONCLIENTGET )
{
NONCLIENTMETRICS mi;
memset( ( char * ) &mi, 0, sizeof( NONCLIENTMETRICS ) );
mi.cbSize = sizeof( NONCLIENTMETRICS );
SystemParametersInfo( SPI_GETNONCLIENTMETRICS, 0, &mi, 0);
// Devuelvo un array con los valores antes de cambiarlos
hb_reta(4);
hb_storvni(mi.iScrollWidth, -1, 1);
hb_storvni(mi.iScrollHeight,-1, 2);
hb_storvni(mi.iCaptionHeight, -1, 3);
hb_storvni(mi.iMenuHeight, -1, 4);
}
HB_FUNC ( NONCLIENTSET )
{
NONCLIENTMETRICS mi;
memset( ( char * ) &mi, 0, sizeof( NONCLIENTMETRICS ) );
mi.cbSize = sizeof( NONCLIENTMETRICS );
SystemParametersInfo( SPI_GETNONCLIENTMETRICS, 0, &mi, 0);
// Grabar el valor
mi.iScrollWidth = hb_parnl( 1 );
mi.iScrollHeight = hb_parnl( 2 );
mi.iCaptionHeight = hb_parnl ( 3 );
mi.iMenuHeight = hb_parnl ( 4 );
SystemParametersInfo( SPI_SETNONCLIENTMETRICS, sizeof( mi ), &mi, 0 ); //SPIF_SENDCHANGE); // Update Win.ini
}
#pragma ENDDUMP
#include "fivewin.ch"
#include "xbrowse.ch"
Function Main()
Local oDlg, oBrw, aValues:={}, nC
DEFINE DIALOG oDlg SIZE 300, 200 TITLE "Probando redimensión de scroll y captions"
@ 0, 0 XBROWSE oBrw OF oDlg ARRAY { { "one","two","three" } } AUTOCOLS
oBrw:CreateFromCode()
ACTIVATE DIALOG oDlg CENTER ON INIT ( oDlg:oClient := oBrw, oDlg:Resize(), aValues:=NonClientGet (), NonClientSet (30,30,50,50) )
NonClientSet (aValues[1],aValues[2],aValues[3],aValues[4])
Return (nil)
#pragma BEGINDUMP
#include "windows.h"
#include "hbapi.h"
#include "hbcomp.h"
#pragma BEGINDUMP
#include "windows.h"
#include "hbapi.h"
#include "hbcomp.h"
HB_FUNC ( NONCLIENTGET )
{
NONCLIENTMETRICS mi;
memset( ( char * ) &mi, 0, sizeof( NONCLIENTMETRICS ) );
mi.cbSize = sizeof( NONCLIENTMETRICS );
SystemParametersInfo( SPI_GETNONCLIENTMETRICS, 0, &mi, 0);
// Devuelvo un array con los valores antes de cambiarlos
hb_reta(4);
hb_storvni(mi.iScrollWidth, -1, 1);
hb_storvni(mi.iScrollHeight,-1, 2);
hb_storvni(mi.iCaptionHeight, -1, 3);
hb_storvni(mi.iMenuHeight, -1, 4);
}
HB_FUNC ( NONCLIENTSET )
{
NONCLIENTMETRICS mi;
memset( ( char * ) &mi, 0, sizeof( NONCLIENTMETRICS ) );
mi.cbSize = sizeof( NONCLIENTMETRICS );
SystemParametersInfo( SPI_GETNONCLIENTMETRICS, 0, &mi, 0);
// Grabar el valor
mi.iScrollWidth = hb_parnl( 1 );
mi.iScrollHeight = hb_parnl( 2 );
mi.iCaptionHeight = hb_parnl ( 3 );
mi.iMenuHeight = hb_parnl ( 4 );
SystemParametersInfo( SPI_SETNONCLIENTMETRICS, sizeof( mi ), &mi, 0 ); //SPIF_SENDCHANGE); // Update Win.ini
}
#pragma ENDDUMP
// Algo asi
#ifdef _WIN64
LONG nPos = hb_parnll( 1 );
#else
LONG nPos = hb_parnl( 1 );
#endif
NONCLIENTMETRICS mi;
memset( ( char * ) &mi, 0, sizeof( NONCLIENTMETRICS ) );
mi.cbSize = sizeof( NONCLIENTMETRICS );
SystemParametersInfo( SPI_GETNONCLIENTMETRICS, 0, &mi, 0);
switch( nPos )
{
case 1:
hb_retni( mi.iBorderWidth );
break;
case 2:
hb_retni( mi.iScrollWidth );
case 3:
hb_retni( mi.iScrollHeight );
case 4:
hb_retni( mi.iCaptionWidth );
case 5:
hb_retni( mi.iCaptionHeight );
case 6:
hb_retni( mi.iSmCaptionWidth );
case 7:
hb_retni( mi.iSmCaptionHeight );
case 8:
hb_retni( mi.iMenuWidth );
case 9:
hb_retni( mi.iMenuHeight );
}
hb_reta(3);
hb_storvc (mi.lfCaptionFont.lfFaceName, -1, 1);
hb_storvni (mi.lfCaptionFont.lfHeight, -1, 2);
hb_storvni (mi.lfCaptionFont.lfWidth, -1, 3);
break;
//----------------------------------------------------------------------------//
HB_FUNC ( NONCLIENT )
{
NONCLIENTMETRICS mi;
memset( ( char * ) &mi, 0, sizeof( NONCLIENTMETRICS ) );
mi.cbSize = sizeof( NONCLIENTMETRICS );
SystemParametersInfo( SPI_GETNONCLIENTMETRICS, 0, &mi, 0);
#if (WINVER >= 0x0600)
hb_reta(10);
#else
hb_reta(9);
#endif
hb_storvni(mi.iBorderWidth, -1, 1); // 5
hb_storvni(mi.iScrollWidth, -1, 2); //17
hb_storvni(mi.iScrollHeight,-1, 3); //17
hb_storvni(mi.iCaptionWidth, -1, 4); //36
hb_storvni(mi.iCaptionHeight, -1, 5); //22
hb_storvni(mi.iSmCaptionWidth, -1, 6); //22
hb_storvni(mi.iSmCaptionHeight, -1, 7); //22
hb_storvni(mi.iMenuWidth, -1, 8); //19
hb_storvni(mi.iMenuHeight, -1, 9); //19
#if (WINVER >= 0x0600)
hb_storvni(mi.iPaddedBorderWidth, -1, 10); // 0
#endif
}
//----------------------------------------------------------------------------//
HB_FUNC ( GETNONCLIENT ) // nPos
{
INT nPos = hb_parni( 1 );
INT nVal;
NONCLIENTMETRICS mi;
memset( ( char * ) &mi, 0, sizeof( NONCLIENTMETRICS ) );
mi.cbSize = sizeof( NONCLIENTMETRICS );
SystemParametersInfo( SPI_GETNONCLIENTMETRICS, 0, &mi, 0);
switch( nPos )
{
case 1:
nVal = mi.iBorderWidth;
break;
case 2:
nVal = mi.iScrollWidth;
break;
case 3:
nVal = mi.iScrollHeight;
break;
case 4:
nVal = mi.iCaptionWidth;
break;
case 5:
nVal = mi.iCaptionHeight;
break;
case 6:
nVal = mi.iSmCaptionWidth;
break;
case 7:
nVal = mi.iSmCaptionHeight;
break;
case 8:
nVal = mi.iMenuWidth;
break;
case 9:
nVal = mi.iMenuHeight;
break;
}
hb_retni( nVal );
}
//----------------------------------------------------------------------------//
HB_FUNC ( SETNONCLIENT ) // nPos , uVal, ActWinIni
{
INT nPos = hb_parni( 1 );
INT nVal = hb_parni( 2 );
BOOL bActIni = hb_parl( 3 );
NONCLIENTMETRICS mi;
memset( ( char * ) &mi, 0, sizeof( NONCLIENTMETRICS ) );
mi.cbSize = sizeof( NONCLIENTMETRICS );
SystemParametersInfo( SPI_GETNONCLIENTMETRICS, 0, &mi, 0);
switch( nPos )
{
case 0: // Actualizar todo
//mi.iBorderWidth = nVal;
mi.iScrollWidth = nVal+12;
mi.iScrollHeight = nVal+12;
mi.iCaptionWidth = nVal+21;
mi.iCaptionHeight = nVal+17;
mi.iSmCaptionWidth = nVal+17;
mi.iSmCaptionHeight = nVal+17;
mi.iMenuWidth = nVal+12;
mi.iMenuHeight = nVal+12;
break;
case 1:
mi.iBorderWidth = nVal;
break;
case 2:
mi.iScrollWidth = nVal;
break;
case 3:
mi.iScrollHeight = nVal;
break;
case 4:
mi.iCaptionWidth = nVal;
break;
case 5:
mi.iCaptionHeight = nVal;
break;
case 6:
mi.iSmCaptionWidth = nVal;
break;
case 7:
mi.iSmCaptionHeight = nVal;
break;
case 8:
mi.iMenuWidth = nVal;
break;
case 9:
mi.iMenuHeight = nVal;
break;
}
if ( bActIni )
SystemParametersInfo( SPI_SETNONCLIENTMETRICS, sizeof( mi ), &mi, SPIF_SENDCHANGE); // Update Win.ini
else
SystemParametersInfo( SPI_SETNONCLIENTMETRICS, sizeof( mi ), &mi, 0 ); // NO Update Win.ini
}
//----------------------------------------------------------------------------//
AngelSalom wrote:Bien, no es complicado modificar el tipo de letra ahora que ya tenemos a estructura. Esto devuelve un array con algunos datos de la fuente actual :
Por cierto, ¿cómo le paso un array desde harbour a la función en C? ... de este modo para ajustar la fuente se le podría pasar NonClientPutOptions ( [nOpcion], nValor, {"Fuente",nAlto,nAncho}) ... ¿qué os parece?
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: FiveWiDi, Google [Bot] and 50 guests