xHarbour para Harbour

Projeto [x]Harbour - Compilador de código aberto compatível com o Clipper.

Moderador: Moderadores

Minduim
Usuário Nível 2
Usuário Nível 2
Mensagens: 59
Registrado em: 06 Abr 2011 13:02
Localização: Santo andré - SP

xHarbour para Harbour

Mensagem por Minduim »

Colegas;

após ler alguns comentários dos colegas, revolvi migrar de xHarbour para Harbour 3.2 + mingw (Harbour-migtly-win);

dados arquivo .HBP em Harbour:
-lxhb
-lhbcomm
-lhbwin
-lhbct
-lgtwvg
-oexecutavel
-inc
-workdir=d:\temp
*.prg

utilizando as mesmas rotinas, observei:
- executável Harbour maior que o executável xHarbour em 42%;
- uma aplicação em Harbour executou a mesma aplicação em xharbor, 30% mais rápido;
- a compilação Harbour encontrou erros de programação que a compilação XHarbour não encontrou;
entendo que o ganho em velocidade justifica a migração;

mas encontrei 2 problemas que ainda não consegui resolver:

problema 1: ao chamar o executável, uma janela em branco do dos aparece por trás e se fechá-la a aplicação também fecha;

problema 2: utilizo alguns fragmentos das rotinas publicadas do Vailton para conexão com outros terminais e em Harbour na
compilação aparece um erro de rotina WNETOPENENUM não encontrada:

me perdoem, mas não sei como postar uma rotina como os colegas;

agradeço qualquer ajuda;

rotina do Vailton: TCP/IP e Network com Win32 API - NetOpenenumApp

Código: Selecionar todos

-----------------------------------------------------------------------------------------------
 * This example illustrates an how enumerates the resources on a network using
 * Win32 API with Harbour/xHarbour.
 *
 * COMPILE WITH: hbmk2 -run NetOpenEnumApp.hbp
 *
 * 03/03/2011 - 14:25:12 - [vailtom]
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 */
#include "common.ch"
#include "simpleio.ch"

/* Scope of the enumeration (from winnetwk.h) */
#define RESOURCE_CONNECTED          0x00000001
#define RESOURCE_GLOBALNET          0x00000002
#define RESOURCE_REMEMBERED         0x00000003
#define RESOURCE_RECENT             0x00000004
#define RESOURCE_CONTEXT            0x00000005

/* Resource types to be enumerated (from winnetwk.h) */
#define RESOURCETYPE_ANY            0x00000000
#define RESOURCETYPE_DISK           0x00000001
#define RESOURCETYPE_PRINT          0x00000002

/* Resource usage type to be enumerated */
#define RESOURCEUSAGE_CONNECTABLE   0x00000001
#define RESOURCEUSAGE_CONTAINER     0x00000002
#define RESOURCEUSAGE_ALL           0

/* ... */
#define RESOURCEDISPLAYTYPE_GENERIC        0x00000000
#define RESOURCEDISPLAYTYPE_DOMAIN         0x00000001
#define RESOURCEDISPLAYTYPE_SERVER         0x00000002
#define RESOURCEDISPLAYTYPE_SHARE          0x00000003
#define RESOURCEDISPLAYTYPE_FILE           0x00000004
#define RESOURCEDISPLAYTYPE_GROUP          0x00000005
#define RESOURCEDISPLAYTYPE_NETWORK        0x00000006
#define RESOURCEDISPLAYTYPE_ROOT           0x00000007
#define RESOURCEDISPLAYTYPE_SHAREADMIN     0x00000008
#define RESOURCEDISPLAYTYPE_DIRECTORY      0x00000009
#define RESOURCEDISPLAYTYPE_TREE           0x0000000A
#define RESOURCEDISPLAYTYPE_NDSCONTAINER   0x0000000B

/* Error codes */
#define ERROR_NOT_CONTAINER              1207
#define ERROR_INVALID_PARAMETER            87
#define ERROR_NO_NETWORK                 1222
#define ERROR_EXTENDED_ERROR             1208
#define ERROR_INVALID_ADDRESS             487

* Main function demo
FUNCTION MAIN()
   LOCAL ExeName
   LOCAL Choice := '*'

   ExeName := Substr( hb_ArgV(0), Rat( "\", hb_ArgV(0) ) +1 )
   ExeName := Substr( ExeName, 1, LEN( ExeName ) -4 )

  ?? ExeName, 'by Vailton Renato <vailtom@gmail.com>'
   ? '--------------------------------------------------------'
   ? 'This example illustrates an how enumerates the resources'
   ? 'on a network using Win32 API with Harbour/xHarbour.'
   
   DO WHILE Choice != '0'
   
      ? '--------------------------------------------------------'
      ?
      ? '1. Enumerates all resources on network'
      ? '2. Enumerates all computers and containers'
      ? '3. Enumerates all printers'
      ? '4. Enumerates all shares'
      ? '0. Exit'
      ?
      ? 'ENTER your choice: '

      Choice := CHR( Inkey(0) )

      ?? Choice
      
      SWITCH Choice
      CASE '1'
         ?
         ? 'Searching resources on network (press any key to abort)'
         ?
         WNetOpenEnum( {|aInfo| DisplayInfo(aInfo), .T. }, RESOURCE_GLOBALNET, RESOURCETYPE_ANY, RESOURCEUSAGE_ALL )
         EXIT
      CASE '2'
         ?
         ? 'Searching computers or containers (press any key to abort)'
         ?
         WNetOpenEnum( {|aInfo| PrintComputers(aInfo) }, RESOURCE_GLOBALNET, RESOURCETYPE_ANY, RESOURCEUSAGE_ALL )
         EXIT
      CASE '3'
         ?
         ? 'Searching printers (press any key to abort)'
         ?
         WNetOpenEnum( {|aInfo| PrintPrinters(aInfo) }, RESOURCE_GLOBALNET, RESOURCETYPE_ANY, RESOURCEUSAGE_ALL )
         EXIT
      CASE '4'
         ?
         ? 'Searching all shares (press any key to abort)'
         ?
         WNetOpenEnum( {|aInfo| PrintShares(aInfo) }, RESOURCE_GLOBALNET, RESOURCETYPE_ANY, RESOURCEUSAGE_ALL )
         EXIT
      END
      
    * To clear keyboard buffer...
      Inkey(.5)
   ENDDO
   RETURN nil

* Filters only computers
FUNCTION PrintComputers( aInfo )
   IF ( aInfo[4] >= RESOURCEUSAGE_CONTAINER) .AND. (Left( aInfo[6], 2 ) == '\\' )
      DisplayInfo( aInfo )
   ELSE
      ?? '.'
   ENDIF       ]
   RETURN (NextKey() == 00)

* Filters only printers
FUNCTION PrintPrinters( aInfo )
   IF ( aInfo[2] == RESOURCETYPE_PRINT )
      DisplayInfo( aInfo )
   ELSE
      ?? '.'
   ENDIF       ]
   RETURN (NextKey() == 00)

* Filters all shared resources
FUNCTION PrintShares( aInfo )
   IF ( aInfo[2] == RESOURCETYPE_DISK )
      DisplayInfo( aInfo )
   ELSE
      ?? '.'
   ENDIF       ]
   RETURN (NextKey() == 00)

/*
 * Print all info about this network resource
 * 04/03/2011 - 10:13:36 - [vailtom]
 */
PROCEDURE DisplayInfo( aInfo )
   ? "Scope: "
   
   SWITCH (aInfo[1])
   CASE (RESOURCE_CONNECTED)
     ?? "connected"
     EXIT
   CASE (RESOURCE_GLOBALNET)
     ?? "all resources"
     EXIT
   CASE (RESOURCE_REMEMBERED)
     ?? "remembered"
     EXIT
   OTHERWISE
     ?? "unknown scope", aInfo[1]
     EXIT
   END

   ? "Type: "

   SWITCH (aInfo[2])
   CASE (RESOURCETYPE_ANY)
     ?? "any"
     EXIT
   CASE (RESOURCETYPE_DISK)
     ?? "disk"
     EXIT
   CASE (RESOURCETYPE_PRINT)
     ?? "print"
     EXIT
   OTHERWISE
     ?? "unknown type %d\n", aInfo[2]
     EXIT
   END

   ? "DisplayType: "
   
   SWITCH (aInfo[3])
   CASE (RESOURCEDISPLAYTYPE_GENERIC)
     ?? "generic"
     EXIT
   CASE (RESOURCEDISPLAYTYPE_DOMAIN)
     ?? "domain"
     EXIT
   CASE (RESOURCEDISPLAYTYPE_SERVER)
     ?? "server"
     EXIT
   CASE (RESOURCEDISPLAYTYPE_SHARE)
     ?? "share"
     EXIT
   CASE (RESOURCEDISPLAYTYPE_FILE)
     ?? "file"
     EXIT
   CASE (RESOURCEDISPLAYTYPE_GROUP)
     ?? "group"
     EXIT
   CASE (RESOURCEDISPLAYTYPE_NETWORK)
     ?? "network"
     EXIT
   CASE (RESOURCEDISPLAYTYPE_ROOT)
      ?? "root for the entire network"
      EXIT
   CASE (RESOURCEDISPLAYTYPE_SHAREADMIN)
      ?? "administrative share"
      EXIT
   CASE (RESOURCEDISPLAYTYPE_DIRECTORY)
      ?? "directory"
      EXIT
   CASE (RESOURCEDISPLAYTYPE_TREE)
      ?? "NetWare Directory Service (NDS) tree"
      EXIT
   CASE (RESOURCEDISPLAYTYPE_NDSCONTAINER)
      ?? "Netware Directory Service container"
      EXIT
   OTHERWISE
     ?? "unknown display type", aInfo[3]
     EXIT
   END

   ? "Usage: "
   IF (aInfo[4] >= RESOURCEUSAGE_CONTAINER)
     ?? "container "
     aInfo[4] -= RESOURCEUSAGE_CONTAINER
   ENDIF

   IF (aInfo[4] >= RESOURCEUSAGE_CONNECTABLE)
     ?? "connectable "
     aInfo[4] -= RESOURCEUSAGE_CONNECTABLE
   ENDIF

   ? 'Localname: "' + aInfo[5] + '"'
   ? 'Remotename:"' + aInfo[6] + '"'
   ? 'Comment: "'   + aInfo[7] + '"'
   ? 'Provider: "'  + aInfo[8] + '"'
   ?
   RETURN

#pragma begindump

#define _WIN32_IE 0x0500
#define HB_OS_WIN_32_USED
#ifdef __POCC__
#define _WIN32_WINNT 0x0500
#else
#define _WIN32_WINNT 0x0400
#endif

#ifndef UNICODE
   #define UNICODE
#endif

#include <windows.h>
#include <stdio.h>
#include <winnetwk.h>
#include "hbapi.h"
#include "hbapiitm.h"

#define BUFF_SIZE 512

typedef struct {
   DWORD dwScope;             // Scope of the enumeration
   DWORD dwType;              // Resource types to be enumerated
   DWORD dwUsage;             // Resource usage type to be enumerated
   BOOL  bAborted;            // Abort process?
   char  Buffer[BUFF_SIZE+1]; // Buffer temporario para conversoes
   PHB_ITEM pBlock;
} ENUM_INFO, * PENUM_INFO;

static void ConvToArrAsStdStr( PHB_ITEM pArray, ULONG ulIndex, PENUM_INFO pEnumInfo,
                                 LPCWSTR Buffer )
{
   pEnumInfo->Buffer[0] = '\0';
   
   WideCharToMultiByte( CP_UTF8, 0, Buffer, -1,
                           pEnumInfo->Buffer, BUFF_SIZE, NULL, NULL );

   hb_arraySetC( pArray, ulIndex, pEnumInfo->Buffer );
}
/*
 *
 *
 * 03/03/2011 - 17:23:37 - [vailtom]
 */
static void ExecuteEnumCallBack(int i, PENUM_INFO pEnumInfo, LPNETRESOURCE lpnrLocal)
{
   PHB_ITEM pArray = hb_itemArrayNew( 8 );
   PHB_ITEM pRet;
   int iFlags;

   hb_arraySetNL( pArray, 1, (long) (lpnrLocal->dwScope) );
   hb_arraySetNL( pArray, 2, (long) (lpnrLocal->dwType) );
   hb_arraySetNL( pArray, 3, (long) (lpnrLocal->dwDisplayType) );

   iFlags = 0;
   
   if (lpnrLocal->dwUsage & RESOURCEUSAGE_CONNECTABLE)
     iFlags += 1;
     
   if (lpnrLocal->dwUsage & RESOURCEUSAGE_CONTAINER)
     iFlags += 2;

   hb_arraySetNI( pArray, 4, iFlags );
   
   ConvToArrAsStdStr( pArray, 5, pEnumInfo, lpnrLocal->lpLocalName );
   ConvToArrAsStdStr( pArray, 6, pEnumInfo, lpnrLocal->lpRemoteName );
   ConvToArrAsStdStr( pArray, 7, pEnumInfo, lpnrLocal->lpComment );
   ConvToArrAsStdStr( pArray, 8, pEnumInfo, lpnrLocal->lpProvider );

   if( pEnumInfo->pBlock )
   {
      pRet = hb_itemDo( pEnumInfo->pBlock, 1, pArray );

      if (pRet)
      {
         pEnumInfo->bAborted = !hb_itemGetL( pRet );
         hb_itemRelease( pRet );
      }
   }
   hb_itemRelease( pArray );
}

static DWORD WINAPI EnumerateFunc(LPNETRESOURCE lpnr, PENUM_INFO pEnumInfo )
{
    DWORD dwResult, dwResultEnum;
    HANDLE hEnum;
    DWORD cbBuffer = 16384;     // 16K is a good size
    DWORD cEntries = -1;        // enumerate all possible entries
    LPNETRESOURCE lpnrLocal;    // pointer to enumerated structures
    DWORD i;

    dwResult = WNetOpenEnum( pEnumInfo->dwScope,   // all network resources
                             pEnumInfo->dwType ,   // all resources
                             pEnumInfo->dwUsage,   // enumerate all resources
                            lpnr,                  // NULL first time the function is called
                            &hEnum);               // handle to the resource

    if (dwResult != NO_ERROR)
        return dwResult;

    lpnrLocal = (LPNETRESOURCE) GlobalAlloc(GPTR, cbBuffer);
    
    if (!lpnrLocal)
        return dwResult;

    do {
        ZeroMemory(lpnrLocal, cbBuffer);

        dwResultEnum = WNetEnumResource( hEnum,         // resource handle
                                        &cEntries,      // defined locally as -1
                                        lpnrLocal,      // LPNETRESOURCE
                                        &cbBuffer);     // buffer size
        if (dwResultEnum == NO_ERROR)
        {
            for (i = 0; i < cEntries && !pEnumInfo->bAborted; i++)
            {
                ExecuteEnumCallBack(i, pEnumInfo, &lpnrLocal[i]);
                
                if (!pEnumInfo->bAborted &&
                   ( RESOURCEUSAGE_CONTAINER == (lpnrLocal[i].dwUsage
                                                   & RESOURCEUSAGE_CONTAINER) ))
                       EnumerateFunc(&lpnrLocal[i],pEnumInfo);
            }
        }

        else if (dwResultEnum != ERROR_NO_MORE_ITEMS)
        {
            // printf("WNetEnumResource failed with error %d (ERROR_NO_MORE_ITEMS)\n", dwResultEnum);
            break;
        }
    }
    while (dwResultEnum != ERROR_NO_MORE_ITEMS);
    
    GlobalFree((HGLOBAL) lpnrLocal);

    return WNetCloseEnum(hEnum);
}

/*
 * The WNetOpenEnum() starts an enumeration of network resources or existing
 * connections. Use as:
 *
 *  WNetOpenEnum( bEvalBlock, nScope, nType, nUsage )
 *
 * For more info, look:
 *  http://msdn.microsoft.com/en-us/library ... 78(v=vs.85).aspx
 *
 * 04/03/2011 - 10:26:04 - [vailtom]
 */
HB_FUNC( [b]WNETOPENENUM[/b] )
{
   LPNETRESOURCE lpnr = NULL;
   ENUM_INFO EnumInfo;

   EnumInfo.pBlock  = hb_param( 1, HB_IT_BLOCK );
   EnumInfo.dwScope = (DWORD) hb_parnl(2);
   EnumInfo.dwType  = (DWORD) hb_parnl(3);
   EnumInfo.dwUsage = (DWORD) hb_parnl(4);
   EnumInfo.bAborted= FALSE;

   if( EnumInfo.pBlock )
      hb_retl( (( EnumerateFunc(lpnr,&EnumInfo) == NO_ERROR)) );
}

#pragma enddump
Editado pela última vez por Toledo em 07 Mar 2014 21:23, em um total de 1 vez.
Razão: Mensagem editada para colocar a tag [ code ]<br>Veja como utilizar esta tag: http://www.pctoledo.com.br/forum/faq.php?mode=bbcode#f2r1
Avatar do usuário
Itamar M. Lins Jr.
Administrador
Administrador
Mensagens: 7929
Registrado em: 30 Mai 2007 11:31
Localização: Ilheus Bahia
Curtiu: 1 vez

xHarbour para Harbour

Mensagem por Itamar M. Lins Jr. »

Ola!
A tela console que abre, é uma configuração que eu não lembro mais.
Poste o inicio da sua rotina main que chama a tela.
E essas rotinas do Vailton, são desnecessárias.
Para saber o nome do executável tem uma função p/ isso.
hb_ProgName()
hb_FNameExt()
hb_FNameName()
hb_FNameNameExt()
hb_FNameDir()
hb_DirBase()
...
Saudações,
Itamar M. Lins Jr.
Saudações,
Itamar M. Lins Jr.
Avatar do usuário
Toledo
Administrador
Administrador
Mensagens: 3133
Registrado em: 22 Jul 2003 18:39
Localização: Araçatuba - SP
Contato:

xHarbour para Harbour

Mensagem por Toledo »

Itamar M. Lins Jr. escreveu:A tela console que abre, é uma configuração que eu não lembro mais.
Tente incluir o comando -gui no arquivo HBP.

Abraços,
Toledo - Clipper On Line
toledo@pctoledo.com.br
Harbour 3.2/MiniGui/HwGui
Faça uma doação para o fórum, clique neste link: http://www.pctoledo.com.br/doacao
Minduim
Usuário Nível 2
Usuário Nível 2
Mensagens: 59
Registrado em: 06 Abr 2011 13:02
Localização: Santo andré - SP

xHarbour para Harbour

Mensagem por Minduim »

Toledo,
agradeço sua colaboração;
agradeço pela ajuda quando a postagem de rotinas;
problema 1- perfeito, resolveu o problema, parabéns e obrigado.

Itamar,
agradeço sua colaboração;
problema 1 - o colega Toledo já me ajudou;
problema 2 - analisando as funções sugeridas por você, noto que elas praticamente tem a mesma aplicação, mas não
tem aplicação junto a rotina do Vaiton;
gostaria muito de trocar estas rotinas em c++ por rotinas em Harbour, pois entendo que as funções em Harbour
deveriam suprir todas as nossas necessidade, mas não tenho conhecimento em c++ pra poder modificá-las;
verifico também, que o erro na compilação ocorre na função "HB_FUNC( WNetOpenENum )" que esta
dentro de um laço "#PRAMA BEGINDUMP";
tenho outros fragmentos de rotinas derivadas do Vailton e todas apresentam erro na compilação com a mesma
caracteristica (compilação de uma rotina "HB_FUNC( xxxx )" dentro de um laço "#PRAMA BEGINDUMP");
Avatar do usuário
Itamar M. Lins Jr.
Administrador
Administrador
Mensagens: 7929
Registrado em: 30 Mai 2007 11:31
Localização: Ilheus Bahia
Curtiu: 1 vez

xHarbour para Harbour

Mensagem por Itamar M. Lins Jr. »

Pelo que entendi, uma das funções do Vailton retorna as impressoras em rede

win_printerlist() faz isso.

Código: Selecionar todos

#require "hbwin"

PROCEDURE Main( cPar1 )

   LOCAL nPrn := 1
   LOCAL cBMPFile := Space( 40 )
   LOCAL GetList := {}

   LOCAL aPrn := win_printerList()

   IF Empty( aPrn )
      Alert( "No printers installed - Cannot continue" )
   ELSE
      DO WHILE nPrn != 0
         CLS
         @ 0, 0 SAY "win_Prn() Class test program. Choose a printer to test"
         @ 1, 0 SAY "Bitmap file name:" GET cBMPFile PICTURE "@K"
         READ
         @ 2, 0 TO MaxRow(), MaxCol()
         nPrn := AChoice( 3, 1, MaxRow() - 1, MaxCol() - 1, aPrn, .T.,, nPrn )
         IF nPrn != 0
            PrnTest( aPrn[ nPrn ], cBMPFile, iif( HB_ISSTRING( cPar1 ) .AND. Lower( cPar1 ) == "ask", .T., NIL ) )
         ENDIF
      ENDDO
   ENDIF

   RETURN
As outras, vc poderia me explicar melhor o uso.

Saudações,
Itamar M. Lins Jr.
Saudações,
Itamar M. Lins Jr.
Avatar do usuário
Itamar M. Lins Jr.
Administrador
Administrador
Mensagens: 7929
Registrado em: 30 Mai 2007 11:31
Localização: Ilheus Bahia
Curtiu: 1 vez

xHarbour para Harbour

Mensagem por Itamar M. Lins Jr. »

Dá uma olhada nesses exemplos, muito mais simples de entender e funcionando 100%
Retorna, nome do OS, Dispositivos de armazenamentos, inclusive pen drive, placa de rede, e outros "bagulhos"

Código: Selecionar todos

/* Originally posted by Bernard Mouille
   https://groups.google.com/d/msg/harbour-users/mI2ehYbLOI8/fw3j75z_RU4J */

/* Complete docs: https://msdn.microsoft.com/en-us/library/aa394554(v=vs.85).aspx */

#include "simpleio.ch"

PROCEDURE Main()

   LOCAL oLocator := win_oleCreateObject( "WbemScripting.SWbemLocator" )
   LOCAL oWMI := oLocator:ConnectServer( ".", "root\cimv2" )
   LOCAL i, nIndex
   LOCAL tmp

   ? "Win_OperatingSystem"
   FOR EACH i IN oWMI:ExecQuery( "SELECT * FROM Win32_OperatingSystem" )
      ? i:SerialNumber
   NEXT
   ?

   ? "Win_LogicalDisk"
   FOR EACH i IN oWMI:ExecQuery( "SELECT * FROM Win32_LogicalDisk" )
      IF HB_ISSTRING( i:VolumeSerialNumber )
         ? i:VolumeSerialNumber, i:Description
      ENDIF
   NEXT
   ?

   ? "Win_NetworkAdapter"
   FOR EACH i IN oWMI:ExecQuery( "SELECT * FROM Win32_NetworkAdapter" )
      IF HB_ISSTRING( i:MACAddress )
         ? i:MACAddress, i:Description
      ENDIF
   NEXT
   ?

   nIndex := 1
   FOR EACH i IN oWMI:ExecQuery( "SELECT * FROM Win32_Bios" )

      ? "Win_Bios #" + hb_ntos( nIndex++ )

      ? "BiosCharacteristics . :", TypeAndValue( i:BiosCharacteristics )
      IF HB_ISARRAY( i:BiosCharacteristics )
         FOR EACH tmp IN i:BiosCharacteristics
            ? Space( 27 ), Str( tmp, 2 ), "->", WMI_Bios_BiosCharacteristics( tmp )
         NEXT
      ENDIF

      ? "BIOSVersion ......... :", TypeAndValue( i:BIOSVersion )
      IF HB_ISARRAY( i:BIOSVersion )
         FOR EACH tmp IN i:BIOSVersion
            ? Space( 27 ), tmp
         NEXT
      ENDIF

      ? "BuildNumber ......... :", TypeAndValue( i:BuildNumber )
      ? "Caption ............. :", TypeAndValue( i:Caption )
      ? "CodeSet ............. :", TypeAndValue( i:CodeSet )
      ? "CurrentLanguage ..... :", TypeAndValue( i:CurrentLanguage )
      ? "Description ......... :", TypeAndValue( i:Description )
      ? "IdentificationCode .. :", TypeAndValue( i:IdentificationCode )
      ? "InstallableLanguages  :", TypeAndValue( i:InstallableLanguages )
      ? "InstallDate ......... :", TypeAndValue( i:InstallDate )
      ? "LanguageEdition ..... :", TypeAndValue( i:LanguageEdition )

      ? "ListOfLanguages ..... :", TypeAndValue( i:ListOfLanguages )
      IF HB_ISARRAY( i:ListOfLanguages )
         FOR EACH tmp IN i:ListOfLanguages
            ? Space( 27 ), tmp
         NEXT
      ENDIF

      ? "Manufacturer ........ :", TypeAndValue( i:Manufacturer )
      ? "Name ................ :", TypeAndValue( i:Name )
      ? "OtherTargetOS ....... :", TypeAndValue( i:OtherTargetOS )
      ? "PrimaryBIOS ......... :", TypeAndValue( i:PrimaryBIOS )
      ? "ReleaseDate ......... :", TypeAndValue( i:ReleaseDate )
      ? "SerialNumber ........ :", TypeAndValue( i:SerialNumber )
      ? "SMBIOSBIOSVersion ... :", TypeAndValue( i:SMBIOSBIOSVersion )
      ? "SMBIOSMajorVersion .. :", TypeAndValue( i:SMBIOSMajorVersion )
      ? "SMBIOSMinorVersion .. :", TypeAndValue( i:SMBIOSMinorVersion )
      ? "SMBIOSPresent ....... :", TypeAndValue( i:SMBIOSPresent )
      ? "SoftwareElementID ... :", TypeAndValue( i:SoftwareElementID )

      ? "SoftwareElementState  :", TypeAndValue( i:SoftwareElementState )
      IF HB_ISNUMERIC( i:SoftwareElementState )
         ? Space( 27 ), Str( i:SoftwareElementState, 2 ), "->", WMI_Bios_SoftwareElementState( i:SoftwareElementState )
      ENDIF

      ? "Status .............. :", TypeAndValue( i:Status )
      ? "TargetOperatingSystem :", TypeAndValue( i:TargetOperatingSystem )

      IF HB_ISNUMERIC( i:TargetOperatingSystem )
         ? Space( 27 ), Str( i:TargetOperatingSystem, 2 ), "->", WMI_Bios_TargetOperatingSystem( i:TargetOperatingSystem )
      ENDIF

      ? "Version ............. :", TypeAndValue( i:Version )
   NEXT

   ?

   RETURN

STATIC FUNCTION TypeAndValue( x )
   RETURN ValType( x ) + " : " + hb_ValToExp( x )

STATIC FUNCTION WMI_Bios_BiosCharacteristics( nValue )

   DO CASE
   CASE nValue >= 40 .AND. nValue <= 47 ; RETURN "Reserved for BIOS vendor"
   CASE nValue >= 48 .AND. nValue <= 63 ; RETURN "Reserved for system vendor"
   ENDCASE

   SWITCH nValue
   CASE 0  ; RETURN "Reserved"
   CASE 1  ; RETURN "Reserved"
   CASE 2  ; RETURN "Unknown"
   CASE 3  ; RETURN "BIOS Characteristics Not Supported"
   CASE 4  ; RETURN "ISA is supported"
   CASE 5  ; RETURN "MCA is supported"
   CASE 6  ; RETURN "EISA is supported"
   CASE 7  ; RETURN "PCI is supported"
   CASE 8  ; RETURN "PC Card (PCMCIA) is supported"
   CASE 9  ; RETURN "Plug and Play is supported"
   CASE 10 ; RETURN "APM is supported"
   CASE 11 ; RETURN "BIOS is Upgradable (Flash)"
   CASE 12 ; RETURN "BIOS shadowing is allowed"
   CASE 13 ; RETURN "VL-VESA is supported"
   CASE 14 ; RETURN "ESCD support is available"
   CASE 15 ; RETURN "Boot from CD is supported"
   CASE 16 ; RETURN "Selectable Boot is supported"
   CASE 17 ; RETURN "BIOS ROM is socketed"
   CASE 18 ; RETURN "Boot From PC Card (PCMCIA) is supported"
   CASE 19 ; RETURN "EDD (Enhanced Disk Drive) Specification is supported"
   CASE 20 ; RETURN "Int 13h - Japanese Floppy for NEC 9800 1.2mb (3.5, 1k Bytes/Sector, 360 RPM) is supported"
   CASE 21 ; RETURN "Int 13h - Japanese Floppy for Toshiba 1.2mb (3.5, 360 RPM) is supported"
   CASE 22 ; RETURN "Int 13h - 5.25 / 360 KB Floppy Services are supported"
   CASE 23 ; RETURN "Int 13h - 5.25 /1.2MB Floppy Services are supported"
   CASE 24 ; RETURN "Int 13h - 3.5 / 720 KB Floppy Services are supported"
   CASE 25 ; RETURN "Int 13h - 3.5 / 2.88 MB Floppy Services are supported"
   CASE 26 ; RETURN "Int 5h, Print Screen Service is supported"
   CASE 27 ; RETURN "Int 9h, 8042 Keyboard services are supported"
   CASE 28 ; RETURN "Int 14h, Serial Services are supported"
   CASE 29 ; RETURN "Int 17h, printer services are supported"
   CASE 30 ; RETURN "Int 10h, CGA/Mono Video Services are supported"
   CASE 31 ; RETURN "NEC PC-98"
   CASE 32 ; RETURN "ACPI is supported"
   CASE 33 ; RETURN "USB Legacy is supported"
   CASE 34 ; RETURN "AGP is supported"
   CASE 35 ; RETURN "I2O boot is supported"
   CASE 36 ; RETURN "LS-120 boot is supported"
   CASE 37 ; RETURN "ATAPI ZIP Drive boot is supported"
   CASE 38 ; RETURN "1394 boot is supported"
   CASE 39 ; RETURN "Smart Battery is supported"
   ENDSWITCH

   RETURN "(unknown)"

STATIC FUNCTION WMI_Bios_SoftwareElementState( nValue )

   SWITCH nValue
   CASE 0 ; RETURN "Deployable"
   CASE 1 ; RETURN "Installable"
   CASE 2 ; RETURN "Executable"
   CASE 3 ; RETURN "Running"
   ENDSWITCH

   RETURN "(unknown)"

STATIC FUNCTION WMI_Bios_TargetOperatingSystem( nValue )

   SWITCH nValue
   CASE 0  ; RETURN "Unknown"
   CASE 1  ; RETURN "Other"
   CASE 2  ; RETURN "Mac OS"
   CASE 3  ; RETURN "ATTUNIX"
   CASE 4  ; RETURN "DGUX"
   CASE 5  ; RETURN "DECNT"
   CASE 6  ; RETURN "Digital Unix"
   CASE 7  ; RETURN "OpenVMS"
   CASE 8  ; RETURN "HPUX"
   CASE 9  ; RETURN "AIX"
   CASE 10 ; RETURN "MVS"
   CASE 11 ; RETURN "OS400"
   CASE 12 ; RETURN "OS/2"
   CASE 13 ; RETURN "JavaVM"
   CASE 14 ; RETURN "MS-DOS"
   CASE 15 ; RETURN "Win3x"
   CASE 16 ; RETURN "Win95"
   CASE 17 ; RETURN "Win98"
   CASE 18 ; RETURN "WinNT"
   CASE 19 ; RETURN "WinCE"
   CASE 20 ; RETURN "NCR3000"
   CASE 21 ; RETURN "NetWare"
   CASE 22 ; RETURN "OSF"
   CASE 23 ; RETURN "DC/OS"
   CASE 24 ; RETURN "Reliant UNIX"
   CASE 25 ; RETURN "SCO UnixWare"
   CASE 26 ; RETURN "SCO OpenServer"
   CASE 27 ; RETURN "Sequent"
   CASE 28 ; RETURN "IRIX"
   CASE 29 ; RETURN "Solaris"
   CASE 30 ; RETURN "SunOS"
   CASE 31 ; RETURN "U6000"
   CASE 32 ; RETURN "ASERIES"
   CASE 33 ; RETURN "TandemNSK"
   CASE 34 ; RETURN "TandemNT"
   CASE 35 ; RETURN "BS2000"
   CASE 36 ; RETURN "Linux"
   CASE 37 ; RETURN "Lynx"
   CASE 38 ; RETURN "XENIX"
   CASE 39 ; RETURN "VM/ESA"
   CASE 40 ; RETURN "Interactive UNIX"
   CASE 41 ; RETURN "BSD UNIX"
   CASE 42 ; RETURN "FreeBSD"
   CASE 43 ; RETURN "NetBSD"
   CASE 44 ; RETURN "GNU Hurd"
   CASE 45 ; RETURN "OS9"
   CASE 46 ; RETURN "MACH Kernel"
   CASE 47 ; RETURN "Inferno"
   CASE 48 ; RETURN "QNX"
   CASE 49 ; RETURN "EPOC"
   CASE 50 ; RETURN "IxWorks"
   CASE 51 ; RETURN "VxWorks"
   CASE 52 ; RETURN "MiNT"
   CASE 53 ; RETURN "BeOS"
   CASE 54 ; RETURN "HP MPE"
   CASE 55 ; RETURN "NextStep"
   CASE 56 ; RETURN "PalmPilot"
   CASE 57 ; RETURN "Rhapsody"
   CASE 58 ; RETURN "Windows 2000"
   CASE 59 ; RETURN "Dedicated"
   CASE 60 ; RETURN "VSE"
   CASE 61 ; RETURN "TPF"
   ENDSWITCH

   RETURN "(unknown)"
Saudações,
Itamar M. Lins Jr.
Saudações,
Itamar M. Lins Jr.
Minduim
Usuário Nível 2
Usuário Nível 2
Mensagens: 59
Registrado em: 06 Abr 2011 13:02
Localização: Santo andré - SP

xHarbour para Harbour

Mensagem por Minduim »

bom dia Itamar;
agradeço sua atenção;
numa primeira impressão, entendo que estes exemplos poderão solucionar minhas necessidades;
vou dar uma olhada nesta documentação e depois retorno;
Minduim
Usuário Nível 2
Usuário Nível 2
Mensagens: 59
Registrado em: 06 Abr 2011 13:02
Localização: Santo andré - SP

xHarbour para Harbour

Mensagem por Minduim »

bom dia Itamar;
perdoe a demora;
a sua ajuda me ajudou em quase todas as minhas necessidades;
esta faltando apenas um comando/rotina que capture os nomes e ips dos terminais conectados;
você pode me ajudar?
Avatar do usuário
Itamar M. Lins Jr.
Administrador
Administrador
Mensagens: 7929
Registrado em: 30 Mai 2007 11:31
Localização: Ilheus Bahia
Curtiu: 1 vez

xHarbour para Harbour

Mensagem por Itamar M. Lins Jr. »

Oi!
Olhando via hbmk2:

Código: Selecionar todos

hbmk2 -find socket
hbssl.hbc (instalado):
   BIO_new_socket()
xhb.hbc (instalado):
   inetIsSocket()
N├║cleo Harbour (instalado):
   hb_inetIsSocket()
   hb_socketAccept()
   hb_socketBind()
   hb_socketClose()
   hb_socketConnect()
   hb_socketErrorString()
   hb_socketGetError()
   hb_socketGetFD()
   hb_socketGetHostName()
   hb_socketGetHosts()
   hb_socketGetIFaces()
   hb_socketGetOSError()
   hb_socketGetPeerName()
   hb_socketGetRcvBufSize()
   hb_socketGetSndBufSize()
   hb_socketGetSockName()
   hb_socketListen()
   hb_socketOpen()
   hb_socketRecv()
   hb_socketRecvFrom()
   hb_socketResolveAddr()
   hb_socketResolveINetAddr()
   hb_socketSelect()
   hb_socketSelectRead()
   hb_socketSelectWrite()
   hb_socketSelectWriteEx()
   hb_socketSend()
   hb_socketSendTo()
   hb_socketSetBlockingIO()
   hb_socketSetBroadcast()
   hb_socketSetExclusiveAddr()
   hb_socketSetKeepAlive()
   hb_socketSetMulticast()
   hb_socketSetNoDelay()
   hb_socketSetRcvBufSize()
   hb_socketSetReuseAddr()
   hb_socketSetSndBufSize()
   hb_socketShutdown()

Código: Selecionar todos

Function Main
? hb_valtoexp(hb_socketgehosts("www.google.com.br"))
? hb_valtoexp(hb_socketgeifaces("www.google.com.br"))
Saudações,
Itamar M. Lins Jr.
Saudações,
Itamar M. Lins Jr.
Responder