static PHB_ITEM pCodeBlock = NULL, pParam = NULL;
static BOOL CALLBACK EnumChildProc( HWND hWnd, LPARAM lParam )
{
PHB_ITEM pNumber = hb_itemPutNL( NULL, ( LONG ) hWnd );
if( pParam )
hb_evalBlock( pCodeBlock, pNumber, pParam, NULL );
else
hb_evalBlock1( pCodeBlock, pNumber );
hb_itemRelease( pNumber );
return TRUE;
}
HB_FUNC( ENUMCHILDWINDOWS )
{
pCodeBlock = hb_param( 2, HB_IT_BLOCK );
pParam = hb_param( 3, HB_IT_NUMERIC );
hb_retl( EnumChildWindows( ( HWND ) hb_parnl( 1 ), EnumChildProc, hb_parnl( 2 ) ) );
pCodeBlock = NULL;
pParam = NULL;
}
EnumChildWindows( GetDesktopWindow(), { | hWnd | AddTask( hWnd ) } )
#pragma BEGINDUMP
#include <windows.h>
#include "hbapi.h"
static PHB_ITEM pCodeBlock = NULL, pParam = NULL;
BOOL CALLBACK EnumChildProc( HWND hWnd, LPARAM lParam )
{
PHB_ITEM pNumber = hb_itemPutNL( NULL, ( LONG ) hWnd );
if( pParam )
hb_evalBlock( pCodeBlock, pNumber, pParam, NULL );
else
hb_evalBlock1( pCodeBlock, pNumber );
hb_itemRelease( pNumber );
return TRUE;
}
HB_FUNC( ENUMCHILDWINDOWS )
{
pCodeBlock = hb_param( 2, HB_IT_BLOCK );
pParam = hb_param( 3, HB_IT_NUMERIC );
hb_retl( EnumChildWindows( ( HWND ) hb_parnl( 1 ), EnumChildProc, hb_parnl( 2 ) ) );
pCodeBlock = NULL;
pParam = NULL;
}
#pragma ENDDUMP
Warning W8065 TASKN.prg 10: Call to function 'hb_itemPutNL' with no prototype in function EnumChildProc
Warning W8069 TASKN.prg 10: Nonportable pointer conversion in function EnumChildProc
Warning W8065 TASKN.prg 13: Call to function 'hb_evalBlock' with no prototype in function EnumChildProc
Warning W8065 TASKN.prg 15: Call to function 'hb_evalBlock1' with no prototype in function EnumChildProc
Warning W8065 TASKN.prg 17: Call to function 'hb_itemRelease' with no prototype in function EnumChildProc
Warning W8057 TASKN.prg 20: Parameter 'lParam' is never used in function EnumChildProc
#include "FiveWin.ch"
#define GWL_HINSTANCE -6
static aTasks := {}
function Main()
EnumChildWindows( GetDesktopWindow(), { | hWnd | AddTask( hWnd ) } )
MsgList( ASort( aTasks ) )
return nil
function AddTask( hWnd )
local cTaskName := GetWindowModuleFileName( hWnd )
if AScan( aTasks, cTaskName ) == 0
AAdd( aTasks, cTaskName )
endif
return nil
#pragma BEGINDUMP
#include <windows.h>
#include <psapi.h>
#include <hbapi.h>
HB_FUNC( GETWINDOWMODULEFILENAME )
{
HWND hWnd = ( HWND ) hb_parnl( 1 );
UINT processId = 0;
DWORD dwLength = 1024;
char buffer[ 1024 ];
HMODULE hProcess;
GetWindowThreadProcessId( hWnd, &processId );
hProcess = OpenProcess( 1040, 0, processId );
dwLength = GetModuleFileNameEx( hProcess, 0, buffer, dwLength );
CloseHandle( hProcess );
hb_retclen( buffer, dwLength );
}
#pragma ENDDUMP
Cgallegoa wrote:Esteban,
Tienes que agregar el siguiente archivo de Borland:
\bcc582\lib\psdk\psapi.lib
Saludos,
Carlos Gallego
{"YouTube - YouTube de jreduojeda - Mozilla Firefox","C:\Archivos de programa\Mozilla Firefox\firefox.exe" }
{"Yahoo! Argentina - Windows Internet Explorer" ,"C:\Archivos de programa\Internet Explorer\iexplore.exe" }
{"Visor de eventos - Messenger Plus!" ,"C:\Archivos de programa\Windows Live\Messenger\msnmsgr.exe" }
{"Google - Mozilla Firefox" ,"C:\Archivos de programa\Mozilla Firefox\firefox.exe" }
{"Windows Live Messenger" ,"C:\Archivos de programa\Windows Live\Messenger\msnmsgr.exe" }
#include "FiveWin.ch"
#define GWL_HINSTANCE -6
static aTasks := {}
function Main()
local aTask
EnumChildWindows( GetDesktopWindow(), { | hWnd | AddTask( hWnd ) } )
for each aTask in aTasks
aTask = aTask[ 1 ] + ", " + aTask[ 2 ]
next
MsgList( ASort( aTasks ), "Applications in use" )
return nil
function AddTask( hWnd )
local cTaskName := GetWindowModuleFileName( hWnd )
if AScan( aTasks, { | aTask | aTask[ 2 ] == cTaskName } ) == 0
AAdd( aTasks, { GetWindowText( hWnd ), cTaskName } )
endif
return nil
#pragma BEGINDUMP
#include <windows.h>
#include <psapi.h>
#include <hbapi.h>
HB_FUNC( GETWINDOWMODULEFILENAME )
{
HWND hWnd = ( HWND ) hb_parnl( 1 );
UINT processId = 0;
DWORD dwLength = 1024;
char buffer[ 1024 ];
HMODULE hProcess;
GetWindowThreadProcessId( hWnd, &processId );
hProcess = OpenProcess( 1040, 0, processId );
dwLength = GetModuleFileNameEx( hProcess, 0, buffer, dwLength );
CloseHandle( hProcess );
hb_retclen( buffer, dwLength );
}
#pragma ENDDUMP
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: Google [Bot] and 33 guests