Page 15 of 21

Re: HMG 3.1.5 (Test)

Posted: Sat Nov 02, 2013 5:19 am
by andyglezl
con MsgInfo( STR( VolSerial( "C:" ) ) obtengo "2696837951".
Entonces no me queda claro porque HDGETSERIAL me da otro
numero diferente ???. Creo que tendre que cambiar de todos modos.

Gracias
-------------------------------------------------------------------
with MsgInfo( STR (VolSerial("C:") ) I get "2696837951".
So I'm not clear because HDGETSERIAL gives me another
different number???. I think I'll have to change anyway.

thanks

Re: HMG 3.1.5 (Test)

Posted: Sat Nov 02, 2013 8:37 am
by esgici
andyglezl wrote: with MsgInfo( STR (VolSerial("C:") ) I get "2696837951".
So I'm not clear because HDGETSERIAL gives me another
different number???. I think I'll have to change anyway.
It's impossible to know why it gives a different number, without seeing source code of HDGETSERIAL :(

Happy HMG'ing :D

Re: HMG 3.1.5 (Test)

Posted: Sat Nov 02, 2013 9:47 am
by danielmaximiliano
andyglezl wrote:con MsgInfo( STR( VolSerial( "C:" ) ) obtengo "2696837951".
Entonces no me queda claro porque HDGETSERIAL me da otro
numero diferente ???. Creo que tendre que cambiar de todos modos.

Gracias
-------------------------------------------------------------------
with MsgInfo( STR (VolSerial("C:") ) I get "2696837951".
So I'm not clear because HDGETSERIAL gives me another
different number???. I think I'll have to change anyway.

thanks
Andy :
probaste con el ejemplo que indique anteriormente ?
getserial.png
getserial.png (97.75 KiB) Viewed 4196 times
Getserial.rar
(7.63 KiB) Downloaded 274 times

Re: HMG 3.1.5 (Test)

Posted: Sun Nov 03, 2013 4:20 am
by andyglezl
OK, Ya me funciona el ejecutable. ( quite la funcion MAKELAYER )
La funcion HDGETSERIAL("c:\") la he estado utilizando desde hace años pero no recuerdo
de donde la obtuve, ademas esta en C y siempre despliega el "warning" al compilar.
---------------------------------------------------------------------------------------
OK, I already runs the executable. (Remove the function MAKELAYER)
The function HDGETSERIAL ("c: \") I've been using for years but can not remember
where I got it, also is in C and always displays the "warning" to compile.
---------------------------------------------------------------------------------------
Harbour 3.2.0dev (r1307180024)
Copyright (c) 1999-2013, http ://harbour-project.org/
conad.prg: In function 'HB_FUN_HDGETSERIAL':
conad.prg:8007:5: warning: passing argument 1 of 'Get_SerialNumber' discards 'const' qualifier from pointer target type [enabled by default]
conad.prg:7998:19: note: expected 'char *' but argument is of type 'const char *'

conad.prg: In function 'HB_FUN_MAKELAYER':
conad.prg:8239:9: warning: implicit declaration of function 'SetLayeredWindowAttributes' [-Wimplicit-function-declaration]
Warning: resolving _SetLayeredWindowAttributes by linking to _SetLayeredWindowAttributes@16
Use --enable-stdcall-fixup to disable these warnings
Use --disable-stdcall-fixup to disable these fixups

-----------------------------------------------------------------------
resumiendo.
summarizing.

Code: Select all

----------------------------------------------------------
HDGETSERIAL()                              // -1598129345
----------------------------------------------------------
VOL en D.O.S.                                        // A0BE7B3F
NTOC (VolSerial ("C:"), 16)                          // A0BE7B3F
STR( VolSerial( "C:" ) )                            // 2696837951
NTOC( 2696837951, 16 ) )                             // A0BE7B3F
NumToHex( VolSerial( "C:" ) )                     // A0BE7B3F
NumToHex( HDGETSERIAL("c:\") )                    // FFFFFFFFA0BE7B3F
----------------------------------------------------------
Las pruebas anteriores indican que:    A0BE7B3F = 2696837951 = -1598129345
Previous tests indicated that:         
A fin de cuentas, llegue al mismo resultado. Gracias.
After all, reach the same result.Thanks.

Ahora me falta resolver la funcion MAKELAYER()
Now I need to solve MAKELAYER() function

Re: HMG 3.1.5 (Test)

Posted: Sun Nov 03, 2013 10:08 am
by danielmaximiliano
andyglezl wrote: Ahora me falta resolver la funcion MAKELAYER()
Now I need to solve MAKELAYER() function
Que hace esa funcion Andy ?.

Re: HMG 3.1.5 (Test)

Posted: Sun Nov 03, 2013 10:47 am
by esgici
Hola Andres
andyglezl wrote:Previous tests indicate that: A0BE7B3F = 2696837951 = -1598129345
I'm not a mathematician, but I know :

A0BE7B3F = 2696837951

is correct, but

2696837951 = -1598129345

not !

If your function(s) are in binary format ( .lib or anything else ) it's difficult to help you, I think :(

Saludos

Re: HMG 3.1.5 (Test)

Posted: Sun Nov 03, 2013 2:32 pm
by srvet_claudio
andyglezl wrote:OK, Ya me funciona el ejecutable. ( quite la funcion MAKELAYER )
La funcion HDGETSERIAL("c:\") la he estado utilizando desde hace años pero no recuerdo
de donde la obtuve, ademas esta en C y siempre despliega el "warning" al compilar.
---------------------------------------------------------------------------------------
OK, I already runs the executable. (Remove the function MAKELAYER)
The function HDGETSERIAL ("c: \") I've been using for years but can not remember
where I got it, also is in C and always displays the "warning" to compile.
---------------------------------------------------------------------------------------
Harbour 3.2.0dev (r1307180024)
Copyright (c) 1999-2013, http ://harbour-project.org/
conad.prg: In function 'HB_FUN_HDGETSERIAL':
conad.prg:8007:5: warning: passing argument 1 of 'Get_SerialNumber' discards 'const' qualifier from pointer target type [enabled by default]
conad.prg:7998:19: note: expected 'char *' but argument is of type 'const char *'

conad.prg: In function 'HB_FUN_MAKELAYER':
conad.prg:8239:9: warning: implicit declaration of function 'SetLayeredWindowAttributes' [-Wimplicit-function-declaration]
Warning: resolving _SetLayeredWindowAttributes by linking to _SetLayeredWindowAttributes@16
Use --enable-stdcall-fixup to disable these warnings
Use --disable-stdcall-fixup to disable these fixups

-----------------------------------------------------------------------
Ahora me falta resolver la funcion MAKELAYER()
Now I need to solve MAKELAYER() function
Hi Andres,
display lines numbers 8007, 7998 and 8239 (+/- 10 lines) of file conad.prg

Re: HMG 3.1.5 (Test)

Posted: Sun Nov 03, 2013 3:28 pm
by andyglezl
Yo reprobé matematicas, asumo que es igual en base al resutado obtenido.
I failed in mathematics, I assume it's just based on the result set obtained.
HDGETSERIAL() // -1598129345
----------------------------------------------------------
VOL en D.O.S. // A0BE7B3F
NTOC (VolSerial ("C:"), 16) // A0BE7B3F
STR( VolSerial( "C:" ) ) // 2696837951
NTOC( 2696837951, 16 ) ) // A0BE7B3F
NumToHex( VolSerial( "C:" ) ) // A0BE7B3F
NumToHex( HDGETSERIAL("c:\") ) // FFFFFFFFA0BE7B3F
-------------------------------------------------------------------
La funcion MAKELAYER() hace transparente la ventana, aqui están la rutinas en "C":
The MAKELAYER() function makes the window transparent,Here are the routines in "C":

Code: Select all

    unsigned long Get_SerialNumber(char* RootPathName)
    {
    unsigned long SerialNumber;
    GetVolumeInformation(RootPathName, NULL, 0, &SerialNumber, NULL, NULL, NULL, 0);
    return SerialNumber;
    }

    HB_FUNC( HDGETSERIAL)
    {
    hb_retnl( Get_SerialNumber(hb_parc(1)) );
    }
    ---------------------------------------------
    #define WS_EX_LAYERED 0x80000
    #define LWA_COLORKEY 1
    #define LWA_ALPHA 2

    WINUSERAPI
    BOOL
    WINAPI
    SetLayeredWindowAttributes(
        HWND hwnd,
        COLORREF crKey,
        BYTE bAlpha,
        DWORD dwFlags);

    HB_FUNC ( GETWINDOWLONG )
    {
       hb_retnl( ( LONG ) GetWindowLong( ( HWND ) hb_parnl( 1 ), hb_parni( 2 ) ) );
    }

    HB_FUNC ( SETWINDOWPOS )
    {
        HWND hwnd           = (HWND) hb_parnl(1);    // handle to window or control
        HWND hWndInsertAfter= (HWND) hb_parnl(2);    // placement-order handle
        int X               =        hb_parni(3);    // horizontal position
        int Y               =        hb_parni(4);    // vertical position
        int cx              =        hb_parni(5);    // width
        int cy              =        hb_parni(6);    // height
        UINT uFlags         = (UINT) hb_parni(7);    // window-positioning options

        hb_retl( (BOOL) SetWindowPos( hwnd, hWndInsertAfter, X, Y, cx, cy, uFlags ) );
    }

    HB_FUNC ( SETLAYEREDWINDOWATTRIBUTES )
    {

    HWND hwnd             = (HWND)     hb_parnl(1);    // handle to window or control
    COLORREF crKey        = (COLORREF) hb_parnl(2);
    BYTE bAlpha           = (BYTE)     hb_parni(3);
    DWORD dwFlags         = (DWORD)    hb_parni(4);


    hb_retl( (BOOL) SetLayeredWindowAttributes(hwnd, crKey, bAlpha,  dwFlags) );

    }
    HB_FUNC (MAKELAYER)
    {
    HWND hwnd             = (HWND)     hb_parnl(1);
    COLORREF crKey        = (COLORREF) hb_parnl(2);

        SetWindowLong (hwnd , GWL_EXSTYLE ,
        GetWindowLong (hwnd , GWL_EXSTYLE ) | WS_EX_LAYERED ) ;
        SetLayeredWindowAttributes(hwnd, 0, crKey, LWA_ALPHA);
    }
-------------------------------------------------------------------
Gracias. Thanks.

Re: HMG 3.1.5 (Test)

Posted: Sun Nov 03, 2013 5:55 pm
by esgici
esgici wrote: It's impossible to know why it gives a different number, without seeing source code of HDGETSERIAL :(
While digging my moldy archives, found two HDGETSERIAL functions :o

No any neat and useful hint but as far as I see ;

if function used by Andres is the same and
function invoked from other than current drive and
no parameter ( drive code ) specified

than it returns a negative value.
Screen shoot of comparison HD Serial number functions
Screen shoot of comparison HD Serial number functions
HDSerComp.JPG (124.21 KiB) Viewed 4133 times
HDSerComp.zip
Source files of comparison HD Serial number functions
(1.27 KiB) Downloaded 234 times
Happy HMG'ing :D

Re: HMG 3.1.5 (Test)

Posted: Sun Nov 03, 2013 6:23 pm
by srvet_claudio
Para:
andyglezl wrote: conad.prg: In function 'HB_FUN_HDGETSERIAL':
conad.prg:8007:5: warning: passing argument 1 of 'Get_SerialNumber' discards 'const' qualifier from pointer target type [enabled by default]
conad.prg:7998:19: note: expected 'char *' but argument is of type 'const char *'
cambia:
andyglezl wrote: 
HB_FUNC( HDGETSERIAL)
    {
    hb_retnl( Get_SerialNumber(hb_parc(1)) );
    }
por:

Code: Select all

HB_FUNC( HDGETSERIAL)
    {
    hb_retnl( Get_SerialNumber((char *) hb_parc(1)) );
    }
Para el error:
andyglezl wrote:conad.prg: In function 'HB_FUN_MAKELAYER':
conad.prg:8239:9: warning: implicit declaration of function 'SetLayeredWindowAttributes' [-Wimplicit-function-declaration]
Agrega al inicio enseguida del #pragma BEGINDUMP

Code: Select all

#define _WIN32_WINNT 0x0500
Con HMG.3.1.5 para hacer una ventana transparente tenes:

Code: Select all

SET WINDOW <cFormName> TRANSPARENT TO COLOR <aColor>