View GDI handles/resources list and detect GDI leaks
Posted: Tue Jul 30, 2013 4:14 pm
www.FiveTechSoft.com
https://forums.fivetechsoft.com/
Code: Select all
#include "FiveWin.ch"
//----------------------------------------------------------------------------//
function Main()
local oWnd
DEFINE WINDOW oWnd TITLE "Right click me"
ACTIVATE WINDOW oWnd ;
ON RIGHT CLICK XBrowse( GetProcesses(), "Processes" )
return nil
//----------------------------------------------------------------------------//
#pragma BEGINDUMP
#include <windows.h>
#include <tlhelp32.h>
#include <hbapi.h>
#include <hbapiitm.h>
HB_FUNC( GETPROCESSES )
{
HANDLE hSnapshot = CreateToolhelp32Snapshot( TH32CS_SNAPALL, 0 );
HANDLE hProcess;
PROCESSENTRY32 pe;
PHB_ITEM pProcesses = hb_itemArrayNew( 0 );
PHB_ITEM pProcess = hb_itemNew( NULL );
pe.dwSize = sizeof( pe );
Process32First( hSnapshot, &pe );
do
{
hProcess = OpenProcess( PROCESS_ALL_ACCESS, FALSE, pe.th32ProcessID );
hb_arrayNew( pProcess, 2 );
hb_arraySetNLL( pProcess, 1, pe.th32ProcessID );
hb_arraySetC( pProcess, 2, pe.szExeFile );
hb_arrayAddForward( pProcesses, pProcess );
} while( Process32Next( hSnapshot, &pe ) );
hb_itemRelease( pProcess );
hb_itemReturnRelease( pProcesses );
CloseHandle( hProcess );
CloseHandle( hSnapshot );
}
#pragma ENDDUMP