Jump to content
Fivewin Brasil

Função alternativa a GetSysMetric() - xHarbour


Anderson.OL

Recommended Posts

Ola Winners... preciso de uma função alternativa a função GetSysMetric() ou de uma dica para faze-la funcionar..

Para quem nao conhece esta função, esta serve para pegar a configuração de video, tipo, 800 x 600 ou 1024 x 768.

Antecipadamente agradeço.

Abraços ;)

Anderson.OL

Skype: andersonolid=green>

FW(2.6) | Clpp (5.3) | Quebrando tudo!id=red>

myif9.gif

Link to comment
Share on other sites

Ola Winners... preciso de uma função alternativa a função GetSysMetric() ou de uma dica para faze-la funcionar..

Para quem nao conhece esta função, esta serve para pegar a configuração de video, tipo, 800 x 600 ou 1024 x 768.

Antecipadamente agradeço.

Abraços ;)

Anderson.OL

Skype: andersonolid=green>

FW(2.6) | Clpp (5.3) | Quebrando tudo!id=red>

myif9.gif

Link to comment
Share on other sites

olá Anderson,

qual o problema com a Getsysmetric() ?

ou melhor, oq vc tá precisando ?

Yury Marcelino Al

Viman Sistemas

vimansca@vimansca.com.br

yury030575@yahoo.com.br

skype: yury.marcelino.al

Leme / SP

FW 2.6 / [x]Harbour 99.50 / WS / xDev 0.65

Link to comment
Share on other sites

vê se te serve:


Func Main()

local aRet := DisplayDevMode(), aMode := {}, i ,nMode //para verificar resolução de tela

public Mudou_Video:=.f.

********************************************************************************

* Verificar e mudar resolução de tela

for i := 1 to len( aRet ) step 3

if empty( aRet )

exit

endif

aadd( aMode, nTrim( aRet ) + ' x ' + nTrim( aRet[i + 1] ) + ' - ' + nTrim( aRet[i + 2] ) + ' Colors' )

next

aRet := DisplayCurrentMode()

nMode := ascan( aMode, nTrim( aRet[1] ) + ' x ' + nTrim( aRet[2] ) + ' - ' + nTrim( aRet[3] ) )

if aret[1] <> 800 .and. aret[2] <> 600

if msgyesno("Posso mudar sua configuração de vídeo para 800x600 ?"+CRLF+"Isto poderá bagunçar os ícones no seu desktop","ATENÇÃO")

nMode1 := ascan( aMode, '800 x 600 - ' + nTrim( aRet[3] ) )

ChangeDisplayMode( nMode1 )

Mudou_Video:=.t.

endif

endif

DEFINE window ...

Activate window oWnd

if Mudou_Video = .t.

ChangeDisplayMode(nMode)

endif

return(nil)

#pragma BEGINDUMP

#define HB_OS_WIN_32_USED // mudar video

#define _WIN32_WINNT 0x0400 // mudar video

#include // mudar video

#include "hbapi.h" // mudar video

#include "hbapiitm.h" // mudar video

// inicio funções mudar video

HB_FUNC( DISPLAYDEVMODE )

{

int i = 0;

int j = 1;

DEVMODE lpDevMode;

hb_reta( 609 );

while (EnumDisplaySettings(NULL, i++, &lpDevMode))

{

hb_storni( lpDevMode.dmPelsWidth, -1, j++ );

hb_storni( lpDevMode.dmPelsHeight, -1, j++ );

hb_storni( lpDevMode.dmBitsPerPel, -1, j++ );

}

}

HB_FUNC( DISPLAYCURRENTMODE )

{

DEVMODE lpDevMode;

hb_reta( 3 );

if (EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &lpDevMode))

{

hb_storni( lpDevMode.dmPelsWidth, -1, 1 );

hb_storni( lpDevMode.dmPelsHeight, -1, 2 );

hb_storni( lpDevMode.dmBitsPerPel, -1, 3 );

}

}

HB_FUNC( CHANGEDISPLAYMODE )

{

DEVMODE dm;

dm.dmSize = sizeof(dm);

EnumDisplaySettings(NULL, hb_parni(1)-1, &dm);

dm.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL | DM_DISPLAYFREQUENCY;

if (ChangeDisplaySettings(&dm, CDS_UPDATEREGISTRY) != DISP_CHANGE_SUCCESSFUL)

MessageBox(GetActiveWindow(), "Wrong Change Display Settings!", "Error", MB_OK | MB_ICONERROR);

SendMessage(HWND_BROADCAST,

WM_DISPLAYCHANGE,

SPI_SETNONCLIENTMETRICS,

0);

}

// fim funções mudar video

#pragma ENDDUMP

id=code>id=code>

clipper - vasculhando fivewin e o xharbour

Link to comment
Share on other sites

Anderson,

Se for para ajustar um JPG da vida ou simplesmente saber:


WIMAGEM:="IMAGEM.JPG"

DEFINE WINDOW oWnd FROM 0,0 TO 36,100 ....

nreshoriz:=ownd:nhorzres()

nresvert:= ownd:nvertres()

IF nReshoriz=1024 .and. nresvert=768

IF ISWINXP()

@ 0,0 IMAGE oImage SIZE 1024,668 of oWnd ADJUST

oImage:Progress( .f. )

oImage:Loadbmp( wimagem )

ELSE

@ 0,0 IMAGE oImage SIZE 1024,678 of oWnd ADJUST

oImage:Progress( .f. )

oImage:Loadbmp( wimagem )

ENDIF

ELSE

IF ISWINXP()

@ 0,0 IMAGE oImage SIZE 800,500 of oWnd ADJUST

oImage:Progress( .f. )

oImage:Loadbmp( wimagem )

ELSE

@ 0,0 IMAGE oImage SIZE 800,510 of oWnd ADJUST

oImage:Progress( .f. )

oImage:Loadbmp( wimagem )

ENDIF

ENDIF

.....

.....

ACTIVATE WINDOW oWnd MAXIMIZED on paint oImage:refresh()

id=code>id=code>

assinatpaulo.jpg

Link to comment
Share on other sites

citação:

Anderson,

Se for para ajustar um JPG da vida ou simplesmente saber:


WIMAGEM:="IMAGEM.JPG"

DEFINE WINDOW oWnd FROM 0,0 TO 36,100 ....

nreshoriz:=ownd:nhorzres()

nresvert:= ownd:nvertres()

IF nReshoriz=1024 .and. nresvert=768

IF ISWINXP()

@ 0,0 IMAGE oImage SIZE 1024,668 of oWnd ADJUST

oImage:Progress( .f. )

oImage:Loadbmp( wimagem )

ELSE

@ 0,0 IMAGE oImage SIZE 1024,678 of oWnd ADJUST

oImage:Progress( .f. )

oImage:Loadbmp( wimagem )

ENDIF

ELSE

IF ISWINXP()

@ 0,0 IMAGE oImage SIZE 800,500 of oWnd ADJUST

oImage:Progress( .f. )

oImage:Loadbmp( wimagem )

ELSE

@ 0,0 IMAGE oImage SIZE 800,510 of oWnd ADJUST

oImage:Progress( .f. )

oImage:Loadbmp( wimagem )

ENDIF

ENDIF

.....

.....

ACTIVATE WINDOW oWnd MAXIMIZED on paint oImage:refresh()

id=code>id=code>

assinatpaulo.jpg


id=quote>id=quote>

Como agradecer eh um obrigação... deixo aqui meu muito obrigado a todos...

E para ajudar aos proximos, digo que estou agora utilizando a dica do amigo Paulo Araujo.

Abraços icon_smile_wink.gif

Anderson.OL

Skype: andersonolid=green>

FW(2.6) | Clpp (5.3) | Quebrando tudo!id=red>

myif9.gif

Link to comment
Share on other sites

Não entendo porque vocês fazem o ajuste do Jpg desta forma!

Acho muito mais interessante ele se ajustar ao tamanho da window.

O meu ajusta ao tamanho da window, se eu diminuir a mesma com o mouse o jpg vai diminuindo juntamente com a mesma.

Marcelo Gomes

elitenet@terra.com.br

(32) 3728-1288

Muriae - MG

FW 2.3C/FWH 2.6/CLIPPER 5.X/XHARBOUR/C/C++/JAVA/DELPHI/XMATE/MD/MYSQL/FIREBIRD/INTERBASE

Link to comment
Share on other sites

citação:

Não entendo porque vocês fazem o ajuste do Jpg desta forma!

Acho muito mais interessante ele se ajustar ao tamanho da window.

O meu ajusta ao tamanho da window, se eu diminuir a mesma com o mouse o jpg vai diminuindo juntamente com a mesma.

Marcelo Gomes

elitenet@terra.com.br

(32) 3728-1288

Muriae - MG

FW 2.3C/FWH 2.6/CLIPPER 5.X/XHARBOUR/C/C++/JAVA/DELPHI/XMATE/MD/MYSQL/FIREBIRD/INTERBASE


id=quote>id=quote>

Jah tentei isto mas nao consegui.. compatilhe conosco seu metodo.. plz

Anderson.OL

Skype: andersonolid=green>

FW(2.6) | Clpp (5.3) | Quebrando tudo!id=red>

myif9.gif

Link to comment
Share on other sites

Ai vai

Para definir a imagem faça assim:

@ 002, 000 Image ObBmpFundo Size oWindow:nRight, ( oWindow:oMsgBar:nTop - 1 ) Of oWindow Adjust No Border Update

Para ativar a window faça assim:

Activate Window oWindow On Resize MoveSay() On Paint ( ObBmpFundo:Refresh(.F.))

Static Procedure MoveSay()

ObBmpFundo:Move( 002, 000, oWindow:nRight, ( oWindow:oMsgBar:nTop - 1 ), .t. )

Return

Marcelo Gomes

elitenet@terra.com.br

(32) 3728-1288

Muriae - MG

FW 2.3C/FWH 2.6/CLIPPER 5.X/XHARBOUR/C/C++/JAVA/DELPHI/XMATE/MD/MYSQL/FIREBIRD/INTERBASE

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...