New FWH 13.07 revised build

Re: New FWH 13.07 revised build

Postby Antonio Linares » Sun Aug 18, 2013 10:33 am

It seems as the right solution would be to use dynamic binding:

DLL FUNCTION GetModuleFileNameEx( nHandle AS LONG, nModule AS LONG, cFileName AS LPSTR, nSize AS LONG ) AS LONG LIB "psapi.dll"
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: New FWH 13.07 revised build

Postby lucasdebeltran » Mon Aug 19, 2013 12:04 pm

Antonio,

I am afraid it does not work.

What change did you make in FW 13.07 please?.

Can you please revert it?.

Thank you.
Muchas gracias. Many thanks.

Un saludo, Best regards,

Harbour 3.2.0dev, Borland C++ 5.82 y FWH 13.06 [producción]

Implementando MSVC 2010, FWH64 y ADO.

Abandonando uso xHarbour y SQLRDD.
User avatar
lucasdebeltran
 
Posts: 1303
Joined: Tue Jul 21, 2009 8:12 am

Re: New FWH 13.07 revised build

Postby Antonio Linares » Mon Aug 19, 2013 1:36 pm

Lucas,

We have not changed anything regarding GetTasks() in FWH 13.07

Why do you think we did a change ? thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: New FWH 13.07 revised build

Postby fgondi » Mon Aug 19, 2013 4:02 pm

Antonio,

Como que no se ha cambiado nada?
En la versión 13.06 funcionaba bien en cualquier sistema operativo.

GetTasks() devolvía un array con todas las tareas activas de windows.

Ahora tengo que redefinir GetTasks() devolviendo un array vacio para que no de error.
Func GetTasks()
return {}
Un saludo
Fernando González Diez
ALSIS Sistemas Informáticos
User avatar
fgondi
 
Posts: 694
Joined: Fri Oct 07, 2005 6:58 am
Location: Palencia, España

Re: New FWH 13.07 revised build

Postby fgondi » Mon Aug 19, 2013 4:24 pm

Buscando en el código antiguo, he encontrado como lo tenia definido antes de que la función fuera incorporada a fivewin

Lo siento, lo que no tengo es el nombre del maestro que la compartió:
Code: Select all  Expand view
 // Returns an array with the names of all the active Tasks running in Windows
    //----------------------------------------------------------------------------//
    function GetTasks()

        local hWnd   := GetWindow( GetActiveWindow(), GHW_HWNDFIRST )
        local aTasks := {}
        local cTask,oLdGetTasks:=.T.,hLib32:=0,RetByte:=0,BufTask

    // Verify if the API exist if not it's Windows 95 or Less
    // or Windows NT with SP2 or less so we will use the old technique

        if ABS(hLib32:=Loadlib32("USER32.DLL")) > 32 // Can be Windows 3.11 or Lower
          if substr(Getproc32(hLib32,"GetWindowModuleFileNameA",.T.,LONG,),1,4)<> CHR(0)+CHR(0)+CHR(0)+CHR(0)
            oLdGetTasks:=.f.
            BufTask:=space(200)
          endif
          Freelib32(hLib32)
        endif

        while hWnd != 0
          if oLdGetTasks
           #ifdef __CLIPPER__
              cTask = GetModuleFileName( GetWindowWord( hWnd, GWW_HINSTANCE ) )
           #else
              // cTask = GetModuleFileName( GetWindowLong( hWnd, GWW_HINSTANCE ) )
              cTask = GetWindowText( hWnd ) // The above does now work :-(
           #endif
          else
            Retbyte:=GetWModFileName( hWnd, BufTask, 200 )
            cTask:=left(BufTask,Retbyte)
          endif
          if ! Empty(cTask)
            if AScan( aTasks, cTask ) == 0
              AAdd( aTasks, cTask )
            endif
          endif
          hWnd = GetWindow( hWnd, GHW_HWNDNEXT )
        end

    return aTasks

    //----------------------------------------------------------------------------//
    DLL32 FUNCTION GetWModFileName(  hWnd AS LONG, cBuf AS LPSTR, nLong AS LONG ) ;
                    AS LONG PASCAL FROM "GetWindowModuleFileNameA" LIB "USER32.DLL"


Con este código funciona correctamente en windows xp.
Last edited by fgondi on Tue Aug 20, 2013 7:48 am, edited 1 time in total.
Un saludo
Fernando González Diez
ALSIS Sistemas Informáticos
User avatar
fgondi
 
Posts: 694
Joined: Fri Oct 07, 2005 6:58 am
Location: Palencia, España

Re: New FWH 13.07 revised build

Postby lucasdebeltran » Mon Aug 19, 2013 4:36 pm

Antonio,

And why it worked fine under 13.06 and not under 13.07?.

The problema happens only in XP.

Thanks.
Muchas gracias. Many thanks.

Un saludo, Best regards,

Harbour 3.2.0dev, Borland C++ 5.82 y FWH 13.06 [producción]

Implementando MSVC 2010, FWH64 y ADO.

Abandonando uso xHarbour y SQLRDD.
User avatar
lucasdebeltran
 
Posts: 1303
Joined: Tue Jul 21, 2009 8:12 am

Re: New FWH 13.07 revised build

Postby Antonio Linares » Tue Aug 20, 2013 7:47 am

Fernando,

Ese código funciona bien porque hace enlace dinámico como comenté aqui:

viewtopic.php?p=149936#p149936

Da igual que usemos un modo u otro, el caso es que se enlace en tiempo de ejecución y no al construir el EXE.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: New FWH 13.07 revised build

Postby Antonio Linares » Tue Aug 20, 2013 8:19 am

Con este cambio en gettasks.prg, ya funciona correctamente en XP, y Win8. No lo he probado aún en Win7.

No ha hecho falta usar enlace dinámico :-)

Code: Select all  Expand view
#pragma BEGINDUMP

#include <windows.h>
#include <hbapi.h>

#ifdef __GNUC__
   WINBASEAPI DWORD WINAPI GetWindowModuleFileName( HWND, LPTSTR, DWORD );
#endif

HB_FUNC( GETWINDOWMODULEFILENAME )
{
   #ifndef _WIN64
      HWND hWnd = ( HWND ) hb_parnl( 1 );
   #else  
      HWND hWnd = ( HWND ) hb_parnll( 1 );
   #endif
   
   DWORD dwLength = 0;
   char buffer[ 1024 ];

   dwLength = GetWindowModuleFileName( hWnd, buffer, dwLength );

   hb_retclen( buffer, dwLength );
}

#pragma ENDDUMP
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: New FWH 13.07 revised build

Postby fgondi » Tue Aug 20, 2013 9:58 am

Antonio,

He copiado el código en el prg principal y no funciona.

Sobre Windows 7 devuelve un array vacio
Sobre Windows 2000 sigue apareciendo el error al ejecutar la aplicación.
Un saludo
Fernando González Diez
ALSIS Sistemas Informáticos
User avatar
fgondi
 
Posts: 694
Joined: Fri Oct 07, 2005 6:58 am
Location: Palencia, España

Re: New FWH 13.07 revised build

Postby Antonio Linares » Tue Aug 20, 2013 10:36 am

Fernando,

Puedes probar esta versión de GetTasks() ? gracias

Code: Select all  Expand view
#include "FiveWin.ch"

static aTasks

//----------------------------------------------------------------------------//

function GetTasks()

   local aTask

   aTasks = {}

   EnumChildWindows( GetDesktopWindow(), { | hWnd | AddTask( hWnd ) } )

   for each aTask in aTasks
      aTask = aTask[ 1 ] + ", " + aTask[ 2 ]
   next

return ASort( aTasks )

//----------------------------------------------------------------------------//

static function AddTask( hWnd )

   local cTaskName := Space( 100 )
   
   GetWindowModuleFileName( hWnd, cTaskName, 100 )
   
   if AScan( aTasks, { | aTask | aTask[ 2 ] == cTaskName } ) == 0
      AAdd( aTasks, { GetWindowText( hWnd ), cTaskName } )
   endif
   
return nil

//----------------------------------------------------------------------------//

DLL FUNCTION GetWindowModuleFileName( hWnd AS LONG, cName AS LPSTR, nLen AS LONG ) ;
   AS LONG PASCAL FROM "GetWindowModuleFileNameA" LIB "user32.dll"
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: New FWH 13.07 revised build

Postby fgondi » Tue Aug 20, 2013 2:42 pm

Antonio,

Sobre windows 7, funciona bien
Sobre windows 2000, funciona bien (Funciona la aplicación y funciona la función con las tareas iniciadas)
Un saludo
Fernando González Diez
ALSIS Sistemas Informáticos
User avatar
fgondi
 
Posts: 694
Joined: Fri Oct 07, 2005 6:58 am
Location: Palencia, España

Re: New FWH 13.07 revised build

Postby Antonio Linares » Tue Aug 20, 2013 5:37 pm

En Windows 8 y XP tambien parece funcionar bien :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: New FWH 13.07 revised build

Postby norberto » Wed Aug 21, 2013 12:17 pm

Antonio, I have the Fwh1307 revised, i need to include this fix, any more after the release of the revised? Thank you

Norberto
norberto
 
Posts: 566
Joined: Thu Aug 30, 2007 3:40 pm
Location: BR

Re: New FWH 13.07 revised build

Postby Antonio Linares » Wed Aug 21, 2013 5:37 pm

Norberto,

This is the most recent GetTasks() code:
viewtopic.php?p=150010#p150010
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: New FWH 13.07 revised build

Postby norberto » Wed Aug 21, 2013 5:58 pm

Antonio, thanks, everything I need, from what I understand, is the revised version more the gettasks, right?
norberto
 
Posts: 566
Joined: Thu Aug 30, 2007 3:40 pm
Location: BR

PreviousNext

Return to WhatsNew / Novedades

Who is online

Users browsing this forum: No registered users and 18 guests