FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index WhatsNew / Novedades New FWH 13.07 revised build
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: New FWH 13.07 revised build
Posted: 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
Posts: 1303
Joined: Tue Jul 21, 2009 08:12 AM
Re: New FWH 13.07 revised build
Posted: 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.
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: New FWH 13.07 revised build
Posted: Mon Aug 19, 2013 01: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
Posts: 694
Joined: Fri Oct 07, 2005 06:58 AM
Re: New FWH 13.07 revised build
Posted: Mon Aug 19, 2013 04: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
Posts: 694
Joined: Fri Oct 07, 2005 06:58 AM
Re: New FWH 13.07 revised build
Posted: Mon Aug 19, 2013 04: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 (fw): Select all Collapse
 聽// 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.
Un saludo

Fernando Gonz谩lez Diez

ALSIS Sistemas Inform谩ticos
Posts: 1303
Joined: Tue Jul 21, 2009 08:12 AM
Re: New FWH 13.07 revised build
Posted: Mon Aug 19, 2013 04: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.
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: New FWH 13.07 revised build
Posted: Tue Aug 20, 2013 07: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
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: New FWH 13.07 revised build
Posted: Tue Aug 20, 2013 08: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 (fw): Select all Collapse
#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
Posts: 694
Joined: Fri Oct 07, 2005 06:58 AM
Re: New FWH 13.07 revised build
Posted: Tue Aug 20, 2013 09: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
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: New FWH 13.07 revised build
Posted: Tue Aug 20, 2013 10:36 AM
Fernando,

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

Code (fw): Select all Collapse
#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
Posts: 694
Joined: Fri Oct 07, 2005 06:58 AM
Re: New FWH 13.07 revised build
Posted: Tue Aug 20, 2013 02: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
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: New FWH 13.07 revised build
Posted: Tue Aug 20, 2013 05:37 PM

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

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 566
Joined: Thu Aug 30, 2007 03:40 PM
Re: New FWH 13.07 revised build
Posted: 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

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: New FWH 13.07 revised build
Posted: Wed Aug 21, 2013 05:37 PM

Norberto,

This is the most recent GetTasks() code:

viewtopic.php?p=150010#p150010

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 566
Joined: Thu Aug 30, 2007 03:40 PM
Re: New FWH 13.07 revised build
Posted: Wed Aug 21, 2013 05:58 PM

Antonio, thanks, everything I need, from what I understand, is the revised version more the gettasks, right?