amigos...
como saber quais aplicativos estão aberto na barra do windows (harbour123)?
como saber quais aplicativos estão aberto na barra do window
Moderador: Moderadores
- juniorcamilo
- Usuário Nível 3

- Mensagens: 343
- Registrado em: 10 Nov 2006 09:12
- Localização: Pará
- sygecom
- Administrador

- Mensagens: 7131
- Registrado em: 21 Jul 2006 10:12
- Localização: Alvorada-RS
- Contato:
como saber quais aplicativos estão aberto na barra do window
Veja se essa abaixo do colega Vailton, lhe atende:
Código: Selecionar todos
/*
* WIN_GETPROCESSLIST( aArray [, <cProcessToFind> ] ) -> nResult
* Get current process list on Windows OS. by Vailton Renato <vailtom@gmail.com>
*
* Returns:
*
* 0 - Success
* 1 - Argument error
* 2 - Unable to obtain current process list.
* 3 - Error retrieving information about processes.
*
* 15/12/2009 - 18:58:58
*/
HB_FUNC( WIN_GETPROCESSLIST )
{
HANDLE hProcessSnap;
PROCESSENTRY32 pe32;
PHB_ITEM pArray = hb_param( 1, HB_IT_ARRAY );
const char * szAppName = hb_parcx(2);
BOOL bCanAdd = TRUE;
if( !pArray )
{
hb_retni( 1 );
return;
}
// Take a snapshot of all processes in the system.
hProcessSnap = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
if( hProcessSnap == INVALID_HANDLE_VALUE )
{
// CreateToolhelp32Snapshot (of processes)
hb_retni( 2 );
return;
}
// Set the size of the structure before using it.
pe32.dwSize = sizeof( PROCESSENTRY32 );
// Retrieve information about the first process,
// and exit if unsuccessful
if( !Process32First( hProcessSnap, &pe32 ) )
{
hb_retni( 3 );
CloseHandle( hProcessSnap ); // clean the snapshot object
return;
}
// Ignores a empty string on seconds argument
if ( hb_parclen(2) < 1 )
szAppName = NULL;
// Now walk the snapshot of processes, and
// display information about each process in turn
do
{
PHB_ITEM pSubarray;
if (szAppName)
bCanAdd = ( hb_stricmp( szAppName, pe32.szExeFile ) == 0 );
if (bCanAdd)
{
pSubarray = hb_itemNew( NULL );
hb_arrayNew( pSubarray, 5 );
hb_arraySetC ( pSubarray, 1, pe32.szExeFile ); // Process Name
hb_arraySetNInt ( pSubarray, 2, pe32.th32ProcessID ); // Process ID
hb_arraySetNInt ( pSubarray, 3, pe32.th32ParentProcessID ); // Parent process ID
GetUserAndDomainFromPID( pe32.th32ProcessID,
hb_arrayGetItemPtr( pSubarray, 4 ), // User
hb_arrayGetItemPtr( pSubarray, 5 ) ); // Domain
hb_arrayAddForward( pArray, pSubarray );
}
} while( Process32Next( hProcessSnap, &pe32 ) );
CloseHandle( hProcessSnap );
hb_retni( 0 );
return;
}
Leonardo Machado
xHarbour.org + Hwgui + PostgreSql
xHarbour.org + Hwgui + PostgreSql
- clodoaldomonteiro
- Usuário Nível 4

- Mensagens: 821
- Registrado em: 30 Dez 2006 13:17
- Localização: Teresina-PI
- Contato:
como saber quais aplicativos estão aberto na barra do window
Olá Leonardo, tudo em paz?
Me interessei pela rotina que vc passou, e pergunto quais serias os "Includes" C que devemos anexar à rotina acima?
Me interessei pela rotina que vc passou, e pergunto quais serias os "Includes" C que devemos anexar à rotina acima?
At. Clodoaldo Monteiro
Linguagens: Clipper / Harbour
Área de Atuação: Sistemas de gestão para Prefeituras Municipais
Fones: (86)3223-0653, 98859-0236
www.simplesinformatica.com.br
Linguagens: Clipper / Harbour
Área de Atuação: Sistemas de gestão para Prefeituras Municipais
Fones: (86)3223-0653, 98859-0236
www.simplesinformatica.com.br