CAMBIO RESOLUCION PANTALLA

User avatar
Armando
Posts: 2479
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México
Contact:

Post by Armando »

Manuel:

:oops: No tengo xHarbour 99.61 para hacer la prueba, me olvide mencionar que uso Windows XP SP2

Saludos
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Manuel Valdenebro
Posts: 706
Joined: Thu Oct 06, 2005 9:57 pm
Location: Málaga-España

Post by Manuel Valdenebro »

Yo lo estoy usando tambien en XP SP2
Un saludo

Manuel
User avatar
ADBLANCO
Posts: 299
Joined: Mon Oct 22, 2007 3:03 pm
Location: Valencia - Venezuela

Post by ADBLANCO »

Tambien me manda el error de windows;



Xh .997 y Fw 7.9
User avatar
Maggiro
Posts: 76
Joined: Thu Oct 14, 2010 3:26 am
Location: LIMA - PERU
Contact:

Re: CAMBIO RESOLUCION PANTALLA

Post by Maggiro »

hola manuel:
tu "ya está solucionado" realmente si funciona!!!
usando tu ejemplo, he creado esta rutina:

#include 'fivewin.ch'
#Include "dll.ch"
#Include "Struct.ch"

FUNCTION MAIN()
LOCAL nResoAncho := GetSysMetrics(0)
IF nResoAncho > 800
CamReso ( 800, 600)
MSGINFO('HECHO. AQUI PUEDES INICIAR TU PROGRAMA ELABORADO PARA 800 X 600')
ENDI
RETU nil

Function CamReso(nAncho, nAlto)
Local DM_PELSWIDTH := nHex("80000")
Local DM_PELSHEIGHT := nHex("100000")
Local oDevMode
Local lPosible
Local cBuffer
Local lCamReso := .f.
DEFAULT nAncho := GetSysMetrics(0), ;
nAlto := GetSysMetrics(1)

STRUCT oDevMode
MEMBER cDevName AS STRING LEN 32
MEMBER nSpecVer AS WORD
MEMBER nDrvVer AS WORD
MEMBER nSize AS WORD
MEMBER nDrvExtra AS WORD
MEMBER nFields AS DWORD
MEMBER nOrientat AS WORD
MEMBER nPaperSiz AS WORD
MEMBER nPaperLen AS WORD
MEMBER nPaperWid AS WORD
MEMBER nScale AS WORD
MEMBER nCopies AS WORD
MEMBER nDefSrc AS WORD
MEMBER nPrnQlty AS WORD
MEMBER nColor AS WORD
MEMBER nDuplex AS WORD
MEMBER nYResolut AS WORD
MEMBER nTTOpt AS WORD
MEMBER nCollate AS WORD
MEMBER cFormName AS STRING LEN 32
MEMBER nUnusePad AS WORD
MEMBER nBitsPPel AS DWORD
MEMBER nPelWidth AS DWORD
MEMBER nPelHeigh AS DWORD
MEMBER nDisFlags AS DWORD
MEMBER nDisFreq AS DWORD
ENDSTRUCT

cBuffer := oDevMode:cBuffer
lPosible := EnumDisplaySettings(0, 0, @cBuffer)
IF lPosible
oDevMode:nFields := nOr(DM_PELSWIDTH, DM_PELSHEIGHT )
oDevMode:nPelWidth := nAncho
oDevMode:nPelHeigh := nAlto
cBuffer:=oDevMode:cBuffer
TRY
ChangeDisplaySettings(@cBuffer, 4)
lCamReso := .T.
CATCH
MsgAlert("Modo no soportado", "Error" )
END
else
MsgAlert("Modo no soportado", "Error" )
endif
return lCamReso

DLL32 FUNCTION EnumDisplaySettings(lpszDeviceName AS DWORD,;
iModeNum AS DWORD, ;
@lpDevMode AS LPSTR) AS BOOL PASCAL;
FROM "EnumDisplaySettingsA" LIB "User32.dll"

DLL32 STATIC FUNCTION ChangeDisplaySettings(@lpDevMode AS LPSTR,;
dwFlags AS DWORD) AS DWORD PASCAL;
FROM "ChangeDisplaySettingsA" LIB "User32.dll"

DLL32 FUNCTION ExitWindowsEx(uFlags AS DWORD,;
dwReserved AS DWORD) AS DWORD PASCAL;
LIB "user32.dll"

ahora puedo usar en cualquier plataforma una resolucion unica de 800 x 600

Muchos Saludos a los que realmente se esfuerzan por darle valor agregado a Fivewin!!!
Julio César Góme Cortéz
Analista Programador
QuiLiff Perú Software Development
Lima
User avatar
FranciscoA
Posts: 1964
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: CAMBIO RESOLUCION PANTALLA

Post by FranciscoA »

Maggiro.
Realmente funciona!!!
Veremos mas adelante su comportamiento.
Gracias a todos los que lo hicieron posible.
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh1204-MySql-TMySql
User avatar
Manuel Valdenebro
Posts: 706
Joined: Thu Oct 06, 2005 9:57 pm
Location: Málaga-España

Re: CAMBIO RESOLUCION PANTALLA

Post by Manuel Valdenebro »

Maggiro wrote:hola manuel:
tu "ya está solucionado" realmente si funciona!!!
Hola Julio César,

Me alegro que una rutina hecha hace 6 años, te haya servido. Ya ni me acordaba.
Un saludo

Manuel
User avatar
José Vicente Beltrán
Posts: 279
Joined: Mon Oct 10, 2005 8:55 am
Location: Algeciras, España
Contact:

Re: CAMBIO RESOLUCION PANTALLA

Post by José Vicente Beltrán »

Pues tengo que decir que para mi ha sido todo un descubrimiento, muy muy util :)

Muchas gracias una vez mas :shock:
User avatar
José Vicente Beltrán
Posts: 279
Joined: Mon Oct 10, 2005 8:55 am
Location: Algeciras, España
Contact:

Re: CAMBIO RESOLUCION PANTALLA

Post by José Vicente Beltrán »

¿Sabe alguien como se pueden conocer las resoluciones que admite una pantalla determinada?
no soy capaz de encontrar la función adecuada.

P.e mi monitor admite las siguientes resoluciones 1920x1080, 1600x900, 1280x720 y 800x600

Me gustaria poder saber las resoluciones en tiempo real para recomendar al usuario la mas adecuada a la hora de ejecutar la aplicación.

Gracias anticipadas :shock:
User avatar
karinha
Posts: 4882
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: CAMBIO RESOLUCION PANTALLA

Post by karinha »

João Santos - São Paulo - Brasil
User avatar
José Vicente Beltrán
Posts: 279
Joined: Mon Oct 10, 2005 8:55 am
Location: Algeciras, España
Contact:

Re: CAMBIO RESOLUCION PANTALLA

Post by José Vicente Beltrán »

Gracias karinha por contestar,

Pero lo que busco es algo parecido (si es que existe) a una funcion que devuelva un array con las distintas resoluciones que admite el monitor en uso.
De forma manual es lo que se hace en windows cuando pulsas en el menu contextual del boton derecho la opción 'resolución de pantalla' y el S.O. te indica las resoluciones que admite el monitor que se está usando.

Gracias de nuevo :shock:
User avatar
karinha
Posts: 4882
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: CAMBIO RESOLUCION PANTALLA

Post by karinha »

// Origen:

http://forums.fivetechsupport.com/viewt ... BEMLocator

Code: Select all

# include "fivewin.ch"

Function W_Main_Info ()

   Local oDatos, oSrv, oJob, i, sMensaje := ""
   Local oLoc := CreateObject ( "wbemScripting.SwbemLocator" )
   Local objWMI
   Local oResolucion, nResoIni, nResoFin

   TRY

      objWMI := oLoc:ConnectServer () && Aquí esta la configuración del Sistema

   CATCH

      TRY
         objWMI := oLoc:ConnectServer ( "192.168.2.20" ) && 0.0.0.0

         MsgInfo ( "IP OK" )

      CATCH

         MsgInfo ( "Error. Validando el servidor" )

         CLOSE ALL

         Return Nil

      END

   END

   oResolucion := objWMI:ExecQuery ( "Select * from Win32_DesktopMonitor" )

   sMensaje += CRLF + "Resolución de Pantalla:" + CRLF
 
   FOR Each oDatos in oResolucion

      sMensaje += "Alto: " + cValToChar ( oDatos:ScreenHeight ) + " * " + ;
      "Ancho: " + cValToChar ( oDatos:ScreenWidth ) + CRLF

       // aqui usted hace el controle
       nResoIni := cValToChar ( oDatos:ScreenHeight )
       nResoFin := cValToChar ( oDatos:ScreenWidth )

   NEXT

   MsgInfo ( sMensaje, "Información" )

RETURN NIL
 
João Santos - São Paulo - Brasil
User avatar
José Vicente Beltrán
Posts: 279
Joined: Mon Oct 10, 2005 8:55 am
Location: Algeciras, España
Contact:

Re: CAMBIO RESOLUCION PANTALLA

Post by José Vicente Beltrán »

Gracias karinha,
voy a investigar en esa dirección. :shock:
User avatar
cnavarro
Posts: 5792
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: CAMBIO RESOLUCION PANTALLA

Post by cnavarro »

Puedes probar asi:

Code: Select all

#include "Fivewin.ch"
#Include "dll.ch"
#Include "Struct.ch"

Function Main()
    Local aAllRes    := {}

    aAllRes := AllRes()
    if !empty( aAllRes )
       XBrowse( aAllRes )
    endif

Return nil

#define ENUM_CURRENT_SETTINGS   -1
#define ENUM_REGISTRY_SETTINGS  -2

Function AllRes()
Local aAllRes := {}
Local oDevmode
Local oModos
Local i 

STRUCT oDevMode
MEMBER cDevName AS STRING LEN 32 
MEMBER nSpecVer AS WORD
MEMBER nDrvVer AS WORD
MEMBER nSize AS WORD
MEMBER nDrvExtra AS WORD
MEMBER nFields AS DWORD
MEMBER nOrientat AS WORD
MEMBER nPaperSiz AS WORD
MEMBER nPaperLen AS WORD
MEMBER nPaperWid AS WORD
MEMBER nScale AS WORD
MEMBER nCopies AS WORD
MEMBER nDefSrc AS WORD
MEMBER nPrnQlty AS WORD
MEMBER nColor AS WORD
MEMBER nDuplex AS WORD
MEMBER nYResolut AS WORD
MEMBER nTTOpt AS WORD
MEMBER nCollate AS WORD
MEMBER cFormName AS STRING LEN 32
MEMBER nUnusePad AS WORD
MEMBER nBitsPPel AS DWORD
MEMBER nPelWidth AS DWORD
MEMBER nPelHeigh AS DWORD
MEMBER nDisFlags AS DWORD
MEMBER nDisFreq AS DWORD
ENDSTRUCT

    oModos := oDevMode:cBuffer 
    i := 0 
    do while .T.
       if (EnumDisplaySettings(0, i, @oModos ))   
       AAdd( aAllRes, { oDevMode:nPelWidth, oDevMode:nPelHeigh, ;
                        oDevMode:nBitsPPel, oDevMode:nDisFreq } )
       i++
       else
         exit
       endif
    Enddo 

    //? Len( aAllRes )

Return aAllRes

DLL32 FUNCTION EnumDisplaySettings(lpszDeviceName AS DWORD, iModeNum AS DWORD, ;
@lpDevMode AS LPSTR) AS BOOL PASCAL FROM "EnumDisplaySettingsA" LIB "User32.dll"


 
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
User avatar
José Vicente Beltrán
Posts: 279
Joined: Mon Oct 10, 2005 8:55 am
Location: Algeciras, España
Contact:

Re: CAMBIO RESOLUCION PANTALLA

Post by José Vicente Beltrán »

Cristobal,
Es exactamente lo que buscaba, lo tenia delante de las narices y no he sido capaz de verlo
Muchas gracias :shock:
Post Reply