Intermec 751G User Manual

Page 77

Advertising
background image

Chapter 3 — Configuring the Computer

751G Color Mobile Computer User’s Manual

63

// Description: Get process table snapshot, look for pname running.
//
// Arguments: pname - pointer to name of program to look for.
// for example, app.exe.
//
// Returns: TRUE - process is running.
// FALSE - process is not running.
// $DOCEND$
//************************************************************************
BOOL IsProcessRunning( TCHAR * pname )
{
HANDLE hProcList;
PROCESSENTRY32 peProcess;
DWORD thDeviceProcessID;
TCHAR lpname[MAX_PATH];

if ( !pname || !*pname ) return FALSE;

_tcscpy( lpname, pname );
_tcslwr( lpname );

hProcList = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );

if ( hProcList == INVALID_HANDLE_VALUE ) {
return FALSE;
} // end if

memset( &peProcess, 0, sizeof(peProcess) );
peProcess.dwSize = sizeof(peProcess);

if ( !Process32First( hProcList, &peProcess ) ) {
CloseToolhelp32Snapshot( hProcList );
return FALSE;
} // end if

thDeviceProcessID = 0;

do {
_tcslwr( peProcess.szExeFile );

if ( _tcsstr( peProcess.szExeFile, lpname ) ) {
thDeviceProcessID = peProcess.th32ProcessID;
break;
} // end if
} while ( Process32Next( hProcList, &peProcess ) );

if ( ( GetLastError() == ERROR_NO_MORE_FILES ) && ( thDeviceProcessID == 0 ) )
{
CloseToolhelp32Snapshot( hProcList );
return FALSE;
} // end if

CloseToolhelp32Snapshot( hProcList );
return TRUE;
} // IsProcessRunning

codeINSTALL_INIT Install_Init(
HWND hwndParent,
BOOL fFirstCall,

Advertising