Página 2 de 4
Detectar a versão do Windows
Enviado: 28 Mai 2015 15:49
por Kapiaba
Outro exemplo:
Como temos muitos "uçuários", eles não sabem nem que windows está usando. Com o comando ISWIN... do Fivewin, eu troco o botão em tempo real se for XP, para OUTLOOK EXPRESS, e obrigo a usar o OUTLOOK EXPRESS, ou muda para WINDOWS LIVE MAIL, se a versão do windows obrigar a usar o WINDOWS LIVE MAIL, veja o segundo botão de envio de email, que o senhor vai entender:
Abs
Detectar a versão do Windows
Enviado: 28 Mai 2015 15:56
por Kapiaba
Internamente, posso controlar várias coisas em minhas telas:
abs.
Detectar a versão do Windows
Enviado: 28 Mai 2015 17:11
por JoséQuintas
Como eu disse, era só um exemplo.
Acaba sendo igual a outras soluções, onde a partir da função principal cria as demais.
Só que não deixando preso a xHarbour e compilador C, fica livre depois pra trocar, pelo menos no que se refere a essa parte.
E se usar o nome já existente no que vai usar depois, já facilita nem ter que mexer nos fontes.
Nota: na função que postei, usando STATIC, acaba fazendo o teste uma única vez, servindo durante toda a execução do aplicativo.
Detectar a versão do Windows
Enviado: 28 Mai 2015 17:56
por clodoaldomonteiro
José,
Já tinha tentado dessa fórmula, mas é a mania da perfeição que acho que todos temos.
Kapiaba,
Não tinha visto que você já tinha postado o link para baixar o xHarbour123, mas vi que nele falta a pasta contrib.
hoje estou usando a PDFLIB, ZIPLIB e GTWVW e tenho muitas telas e relatórios.
Caso tenha disposição, fico aguardando a pasta contrib.
Grato pela atenção.
Detectar a versão do Windows
Enviado: 28 Mai 2015 18:33
por Kapiaba
Baixe no 4shared, pois é muito grande. Está completo e revisado.
http://www.4shared.com/zip/Nn9_p1Y_ba/XHARBOUR.html
É necessário ser cadstrado no
www.4shared.com
abs.
Detectar a versão do Windows
Enviado: 28 Mai 2015 22:06
por clodoaldomonteiro
Charro Kapiaba,
Muito obrigado pela ajuda, farei bom uso dessa nova versão do xHarbour é obrigado a todos.
Detectar a versão do Windows
Enviado: 31 Mai 2015 20:09
por clodoaldomonteiro
Amigos Kapiaba e José,
Muito obrigado pela ajuda e depois de tudo, baixei o xHarbour 123, configurei o BCC 5.8.2, consegui a WHAT32.LIB, HBLIB.LIB e GTWVW.LIB, ficou tudo primeirinha, muito rápido o sistema mesmo, tá espocando na tela, hehe.
Agora, chamo a função OS() e me retorna dizendo que é Windows NT, a função OS_isWinXP() retorna .T., pensei que essa versão do xHarbour teria atualizado essas funções.
Vejão o Error.log criado pelo xHarbour, informa que a versão do S.O. é Win XP, mas garanto que estou usando Win 7, hehe.
Código: Selecionar todos
----------------------------- xHarbour Error Log ------------------------------
Date...............: 31/05/2015
Time...............: 12:17:36
Application name...: C:\SimplesInfo\SCP15H\SCP15H3.EXE
Workstation name...: CLODOALDOSM9F4E
Available memory...: 959156
Current disk.......: C
Current directory..: SimplesInfo\SCP15H
Free disk space....: 49043382272
Operating system...: Windows XP 5.1.2600 Service Pack 3
xHarbour version...: xHarbour 1.2.3 Intl. (SimpLex) (Build 20150419)
xHarbour built on..: Apr 20 2015 09:21:19
C/C++ compiler.....: Borland C++ 5.8.2 (32-bit)
Multi Threading....: NO
VM Optimization....: 2
Current Area ......:1
Quintas, estou usando a sua sugestão, mas ainda vou perseguir uma função que faça isso para xHarbour 1.2.3. Mania de perfeição mesmo, hehe.
E então, pergunto ao Kapiaba, como você consegue retornar a informação correta quanto a versão do S.O.?
É alguma .LIB para FiveWin?
Detectar a versão do Windows
Enviado: 01 Jun 2015 09:44
por Kapiaba
Sim, esta função esta em: FIVEHC.LIB mas ela vem junto com o FIVEWIN, para caso eu queira modificar para meu gosto.
Código: Selecionar todos
#include "FiveWin.ch"
#define HORZRES 8
#define VERTRES 10
#Define BITSPIXEL 12
#define PLANES 14
#define LOGPIXELSX 88
#define LOGPIXELSY 90
//----------------------------------------------------------------------------//
Function LargeFonts( nPixelX, nPixelY )
Local hDC
hDC := CreateDC( "DISPLAY", "", "" )
nPixelX := GetDeviceCaps( hDC, LOGPIXELSX )
nPixelY := GetDeviceCaps( hDC, LOGPIXELSY )
DeleteDC( hDC )
Return ( nPixelX >= 120 )
//----------------------------------------------------------------------------//
function DispFontPerSize()
local hDC, nPixelX
hDC = CreateDC( "DISPLAY", "", "" )
nPixelX = GetDeviceCaps( hDC, LOGPIXELSX )
DeleteDC( hDC )
return ( nPixelX / 96 )
//----------------------------------------------------------------------------//
function ColorsQty()
local hDC, nPlanes, nBitsPixel
hDC = CreateDC( "DISPLAY", "", "" )
nPlanes = GetDeviceCaps( hDC, PLANES )
nBitsPixel = GetDeviceCaps( hDC, BITSPIXEL )
DeleteDC( hDC )
return Int( 2 ^ ( nPlanes * nBitsPixel ) )
//----------------------------------------------------------------------------//
function ScrResolution( nWidth, nHeight )
local hDC
hDC = CreateDC( "DISPLAY", "", "" )
nWidth = GetDeviceCaps( hDC, HORZRES )
nHeight = GetDeviceCaps( hDC, VERTRES )
DeleteDC( hDC )
return { nWidth, nHeight }
//----------------------------------------------------------------------------//
#ifdef __CLIPPER__
function cWinVersion()
local cVersion := ""
If IsWin95()
cVersion = "95"
elseif IsWinNT()
if GetWinVer()[ 2 ] == 95
cVersion = "2000"
else
cVersion = "NT"
endif
endif
return cVersion
#else
#define VER_PLATFORM_WIN32s 0
#define VER_PLATFORM_WIN32_WINDOWS 1
#define VER_PLATFORM_WIN32_NT 2
function cWinVersion()
local aVersion := GetVersion()
local cVersion := ""
do case
case aVersion[ 4 ] == VER_PLATFORM_WIN32_NT
if aVersion[ 1 ] == 6
if aVersion[ 2 ] == 0
cVersion = "Vista"
elseif aVersion[ 2 ] == 1
cVersion = "7"
elseif aVersion[ 2 ] == 2
cVersion = "8"
endif
endif
if aVersion[ 1 ] == 5
if aVersion[ 2 ] == 2
cVersion = "Server 2003"
elseif aVersion[ 2 ] == 1
cVersion = "XP"
elseif aVersion[ 2 ] == 0
cVersion = "2000"
endif
endif
if aVersion[ 1 ] <= 4
cVersion = "NT"
endif
case aVersion[ 4 ] == VER_PLATFORM_WIN32_WINDOWS
if aVersion[ 1 ] == 4
if aVersion[ 2 ] == 90
cVersion = "ME"
elseif aVersion[ 2 ] == 10
cVersion = "98"
elseif aVersion[ 2 ] == 0
cVersion = "95"
endif
endif
endcase
return cVersion
#endif
//----------------------------------------------------------------------------//
function IsWinVista()
return ( "Vista" $ cWinVersion() )
//----------------------------------------------------------------------------//
function IsWinXP()
return ( "XP" $ cWinVersion() )
//----------------------------------------------------------------------------//
function IsWin2000()
return ( "2000" $ cWinVersion() )
//----------------------------------------------------------------------------//
function IsWin7()
return "7" $ cWinVersion()
//----------------------------------------------------------------------------//
function IsWin8()
return "8" == cWinVersion()
//----------------------------------------------------------------------------//
function GetSysFont()
do case
case ! IsWinNt() .and. ! IsWin95() // Win 3.1
return "System"
#ifdef __CLIPPER__ // A.L. 28/04/03, It fails with FWH/FW++
case IsWin2000() // Win2000
return "Ms Sans Serif" // "SysTahoma"
#endif
endcase
return "Ms Sans Serif" // Win NT, 9x
//----------------------------------------------------------------------------//
function BorlandVersion()
#ifdef __XHARBOUR__
local cHexVer := NumToHex( BorlandC() )
#else
local cHexVer := hb_NumToHex( BorlandC() )
#endif
return SubStr( cHexVer, 1, 1 ) + "." + SubStr( cHexVer, 2 )
//----------------------------------------------------------------------------//
function SaveDesktop( cPngFileName )
local o := TWindow()
DestroyWindow( o:hWnd )
o:hWnd = GetDesktopWindow()
o:SaveToPng( cPngFileName )
return nil
//----------------------------------------------------------------------------//
#define SM_CXFULLSCREEN 16
#define SM_CYFULLSCREEN 17
function ScreenWidth()
return GetSysMetrics( SM_CXFULLSCREEN )
function ScreenHeight()
return GetSysMetrics( SM_CYFULLSCREEN )
//----------------------------------------------------------------------------//
Abs
Detectar a versão do Windows
Enviado: 01 Jun 2015 09:46
por Kapiaba
Mostre a função modificada do xHarbour ou veja a que eu postei. Não deveria retornar WINNT(), comente a parte do WINNT(), que retornará correto a info.
abs.
Detectar a versão do Windows
Enviado: 01 Jun 2015 14:04
por clodoaldomonteiro
Então Kapiaba!
As funções os_isWinxxx() do xHarbour estão desatualizadas em todas as versões do compilador, mas a função Os_VersionInfo() está OK e trás a numeração correta da versão do Windows.
Tinha tentado também uma função em "C", mas também retorna resultado errado:
Código: Selecionar todos
HB_FUNC(_CLV)
{
DWORD dwVersion = 0;
DWORD dwMajorVersion = 0;
DWORD dwMinorVersion = 0;
DWORD dwBuild = 0;
unsigned char ret[ 100 ] ={0};
dwVersion = GetVersion();
// Get the Windows version.
dwMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion)));
dwMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion)));
// Get the build number.
if (dwVersion < 0x80000000)
dwBuild = (DWORD)(HIWORD(dwVersion));
sprintf(ret, "Version is %d.%d (%d)\n",
dwMajorVersion,
dwMinorVersion,
dwBuild);
hb_retc(ret);
}
Detectar a versão do Windows
Enviado: 01 Jun 2015 14:29
por Kapiaba
Basta modificar o exemplo da sub pasta \tests do xharbour, que funcionará. Releia as respsotas. abs
Detectar a versão do Windows
Enviado: 01 Jun 2015 16:56
por Itamar M. Lins Jr.
Com o harbour 3.4 isso é tão fácil!
Até a versão do ts pega!
Código: Selecionar todos
/* Copyright 2014 Viktor Szakats (vszakats.net/harbour) */
#require "hbwin"
PROCEDURE Main()
? OS()
?
? "CurrentVersion", win_regRead( "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CurrentVersion" )
? "CurrentBuild", win_regRead( "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CurrentBuild" )
?
? "2000OrUpper" , win_osIs2000OrUpper()
? "WinXPOrUpper", win_osIsWinXPOrUpper()
? "VistaOrUpper", win_osIsVistaOrUpper()
?
? "2000" , win_osIs2000()
? "XP" , win_osIsXP()
? "2003" , win_osIs2003()
? "Vista" , win_osIsVista()
? "7" , win_osIs7()
? "8" , win_osIs8()
? "81" , win_osIs81()
? "10" , win_osIs10()
?
? "95" , win_osIs95()
? "98" , win_osIs98()
? "9x" , win_osIs9x()
? "ME" , win_osIsME()
? "NT" , win_osIsNT()
? "NT351" , win_osIsNT351()
? "NT4" , win_osIsNT4()
? "TSClient" , win_osIsTSClient()
?
? hb_ValToExp( win_osVersionInfo() )
RETURN
Zip, PDF, QT, Letodb, tudo sem traumas e sem segredos e muito mais!
Envio email com qualquer servidor, nem precisa detectar qual OS esta em uso.
Código: Selecionar todos
/* Copyright 2009 Viktor Szakats (vszakats.net/harbour) */
#require "hbssl"
#require "hbtip"
#if ! defined( __HBSCRIPT__HBSHELL )
REQUEST __HBEXTERN__HBSSL__
#endif
#include "simpleio.ch"
PROCEDURE Main( cFrom, cPassword, cTo, cHost )
LOCAL nPort
LOCAL lSTARTTLS := .F.
IF ! tip_SSL()
? "Error: Requires SSL support"
RETURN
ENDIF
hb_default( @cFrom , "<from@example.net>" )
hb_default( @cPassword, "password" )
hb_default( @cTo , "to@example.com" )
hb_default( @cHost , "localhost" )
cHost := Lower( cHost )
/* SMTPS works with SSL/TLS on port 465 and with STARTTLS
on port 587. STARTTLS mode is fully automatic and require
that SSL/TLS be disabled at first (it will be activated
on request after STARTTLS command) */
DO CASE
CASE cHost == "apple" .OR. "@icloud.com" $ cFrom .OR. "@mac.com" $ cFrom .OR. "@me.com" $ cFrom
cHost := "smtp.mail.me.com"; lSTARTTLS := .T.
CASE cHost == "fastmail" .OR. "@fastmail.com" $ cFrom .OR. "@fastmail.fm" $ cFrom
cHost := "mail.messagingengine.com"
CASE cHost == "gmx.net" .OR. "@gmx.net" $ cFrom .OR. "@gmx.ch" $ cFrom .OR. "@gmx.de" $ cFrom
cHost := "mail.gmx.net"; lSTARTTLS := .T.
CASE cHost == "google" .OR. "@gmail.com" $ cFrom .OR. "@googlemail.com" $ cFrom
cHost := "smtp.gmail.com"
CASE cHost == "mail.ru" .OR. "@mail.ru" $ cFrom
cHost := "smtp.mail.ru"
CASE cHost == "netease" .OR. "@163.com" $ cFrom
cHost := "smtp.163.com"
CASE cHost == "office365"
cHost := "smtp.office365.com"; lSTARTTLS := .T.
CASE cHost == "outlook" .OR. "@outlook.com" $ cFrom .OR. "@hotmail.com" $ cFrom
cHost := "smtp-mail.outlook.com"; lSTARTTLS := .T.
CASE cHost == "sina" .OR. "@sina.com" $ cFrom
cHost := "smtp.vip.sina.com"
CASE cHost == "uol" .OR. "@uol.com.br" $ cFrom
cHost := "smtps.uol.com.br"
CASE cHost == "yahoo" .OR. "@yahoo.com" $ cFrom
cHost := "smtp.mail.yahoo.com"
CASE ":" $ cHost
IF TUrl():New( cHost ):nPort != -1
nPort := TUrl():New( cHost ):nPort
ENDIF
lSTARTTLS := ( nPort == 587 )
cHost := TUrl():New( cHost ):cServer
ENDCASE
hb_default( @nPort, iif( lSTARTTLS, 587, 465 ) )
? "Host:", cHost, hb_ntos( nPort ), iif( lSTARTTLS, "(STARTTLS)", "" )
? tip_MailSend( ;
cHost, ;
nPort, ;
cFrom, ;
cTo, ;
NIL /* CC */, ;
{} /* BCC */, ;
"test: body", ;
"test: subject", ;
NIL /* attachment */, ;
cFrom, ;
cPassword, ;
"", ;
NIL /* nPriority */, ;
NIL /* lRead */, ;
.T. /* lTrace */, ;
.F., ;
NIL /* lNoAuth */, ;
NIL /* nTimeOut */, ;
NIL /* cReplyTo */, ;
nPort == 465 )
RETURN
Saudações,
Itamar M. Lins Jr.
Detectar a versão do Windows
Enviado: 01 Jun 2015 17:16
por Kapiaba
Em FiveWin, nãoo preciso de nada disso, basta dizer:
Em xHarbour modo console:
Código: Selecionar todos
// C:\XHB123\TESTS\WINCHECK.PRG
PROCEDURE MAIN()
LOCAL nResult:= 0, a, x
//CLS
? 'Checking Windows Version & Platform Details'
?'Platform is: '
IF OS_ISWINNT()
?"VER_PLATFORM_WIN32_NT. i.e. NT, 2000, XP or 2003 Server"
ELSEIF OS_ISWIN9X()
?"VER_PLATFORM_WIN32_WINDOWS. i.e. 95, 98 or ME"
ELSE
?"UNKNOWN?????????"
ENDIF
? 'Release Version of Windows is: '
DO CASE
CASE OS_ISWIN95()
?"95"
CASE OS_ISWIN98()
?"98"
CASE OS_ISWINME()
?"ME"
CASE OS_ISWINNT351()
?"NT3.51"
CASE OS_ISWINNT4()
?"NT4.00"
CASE OS_ISWIN2000()
?"2000"
CASE OS_ISWINXP()
?"XP"
CASE OS_ISWIN2003()
?"2003 Server"
CASE os_IsWinVista()
? "Windows Vista"
CASE os_IsWin7()
? "Windows 7"
CASE os_IsWin8()
? "Windows 8"
OTHERWISE
?"UNKNOWN"
ENDCASE
? 'Details of version'
a:= os_versioninfo()
IF !EMPTY( a )
? " MajorVersion: ", a[ 1 ]
? " MinorVersion: ", a[ 2 ]
? " BuildNumber: ", a[ 3 ]
? " PlatformId: ", a[ 4 ]
? " ExtraData: ", a[ 5 ]
ENDIF
IF OS_ISWTSCLIENT()
? "Running as a Windows Terminal Server Client"
ELSE
? "NO Windows Terminal Server Client detected"
ENDIF
? 'Checking and setting network for Windows'
IF OS_ISWTSCLIENT() .AND. !OS_NETREGOK() // Note: If Windows Terminal Server client DONOT
// attempt to set registry.
? 'Registry on WTS server is not set correctly for networking.'
? 'Please check with System Administrator to set the registry correctly.'
ELSEIF OS_NETREGOK( .T. )
? 'Registry set OK for networking'
ELSE
? 'Failed to set registry - May need "Administrator" rights'
ENDIF
IF !OS_NETVREDIROK( @nResult )
? 'Invalid RVREDIR.VXD file installed'
IF nResult = 950
? 'You need file VREDRUPD.EXE if your vredir.vxd is dated "09:50:00"'
ELSEIF nResult == 1111
? 'You need file VRDRUPD.EXE if your vredir.vxd is dated "11:11:10"'
ENDIF
ENDIF
RETURN
Detectar a versão do Windows
Enviado: 01 Jun 2015 17:22
por Itamar M. Lins Jr.
Ola!
Isso tudo foi copiado do Harbour para o Fivewin.
Assim como muitas outras coisas, sem dar o devido crédito.
Código: Selecionar todos
2009-11-25 17:10 UTC+0100 Viktor Szakats (vszakats.net/harbour)
* contrib/hbwin/Makefile
+ contrib/hbwin/legacycv.c
* contrib/hbwin/win_os.prg
* contrib/hbwin/win_osc.c
* contrib/hbwin/win_tprn.prg
+ Added new names for win version support functions:
WIN_OSISNT() <= OS_ISWINNT()
WIN_OSISNT351() <= OS_ISWINNT351()
WIN_OSISNT4() <= OS_ISWINNT4()
WIN_OSIS2000ORUPPER() <= OS_ISWIN2000_OR_LATER()
WIN_OSIS2000() <= OS_ISWIN2000()
WIN_OSISXP() <= OS_ISWINXP()
WIN_OSIS2003() <= OS_ISWIN2003()
WIN_OSISVISTA() <= OS_ISWINVISTA()
WIN_OSIS7() <= OS_ISWIN7()
WIN_OSIS9X() <= OS_ISWIN9X()
WIN_OSIS95() <= OS_ISWIN95()
WIN_OSIS98() <= OS_ISWIN98()
WIN_OSISME() <= OS_ISWINME()
WIN_OSISTSCLIENT() <= OS_ISWTSCLIENT()
WIN_OSVERSIONINFO() <= OS_VERSIONINFO()
WIN_OSNETREGOK() <= OS_NETREGOK()
WIN_OSNETVREDIROK() <= OS_NETVREDIROK()
; Old names still work, and they are guarded with HB_WIN_LEGACY_LEVEL_OFF
macro, in case someone would like to disable them.
Please use new names, old names may disappear in the future.
! Fixed WIN_OSNETREGOK() to also consider Win7 when second parameter is .T.
* contrib/hbwin/wce_simc.c
* contrib/hbwin/wce_smsc.c
* contrib/hbwin/wce_sim.prg
+ Added new names for WinCE SMS/SIM support functions:
WCE_SIMINITIALIZE() <= SIMINITIALIZE()
WCE_SIMDEINITIALIZE() <= SIMDEINITIALIZE()
WCE_SIMPHONEBOOKSTATUS() <= SIMPHONEBOOKSTATUS()
WCE_SIMREADPHONEBOOKENTRY() <= SIMREADPHONEBOOKENTRY()
WCE_SIMWRITEPHONEBOOKENTRY() <= SIMWRITEPHONEBOOKENTRY()
WCE_SIMDELETEPHONEBOOKENTRY() <= SIMDELETEPHONEBOOKENTRY()
WCE_SMSSENDMESSAGE() <= SMSSENDMESSAGE()
; INCOMPATIBLE.
; NOTE: With these changes hbwin namespace is clean except
for legacy definitions and .dll functions. DLL functions
need a major overhaul anyway (plus there is Xbase++ and
xhb compatibility concerns there), so for now it's OK.
Saudações,
Itamar M. Lins Jr.
Detectar a versão do Windows
Enviado: 01 Jun 2015 17:27
por Kapiaba
I Like Antonio Liñares. kkkkkkkkkkkkkkkkkkk
http://pt.wikipedia.org/wiki/XHarbour
abs.