Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
OSVERSIONINFO OSVersion;
OSVersion.dwOSVersionInfoSize=sizeof(OSVERSIONINFO);
if(!GetVersionEx(&OSVersion)) return;
HANDLE hProcess;
if(OSVersion.dwPlatformId==VER_PLATFORM_WIN32_NT)// NT based OS
{
HINSTANCE hiPSAPI = LoadLibrary("PSAPI.DLL");
if( hiPSAPI == NULL ) return;
// PSAPI Function Pointers.
typedef BOOL (WINAPI *LPENUMPROCESSES)(DWORD *,DWORD,DWORD *);
typedef BOOL (WINAPI *LPENUMPROCESSMODULES)( HANDLE,HMODULE *,DWORD,LPDWORD);
typedef DWORD (WINAPI *LPGETMODULEBASENAME)( HANDLE,HMODULE,LPTSTR,DWORD);
LPENUMPROCESSES lpfEnumProcesses = (LPENUMPROCESSES)GetProcAddress(hiPSAPI,"EnumProcesses");
LPENUMPROCESSMODULES lpfEnumProcessModules = (LPENUMPROCESSMODULES)GetProcAddress(hiPSAPI,"EnumProcessModules");
LPGETMODULEBASENAME lpfGetModuleBaseName = (LPGETMODULEBASENAME)GetProcAddress(hiPSAPI,"GetModuleBaseNameA");
if(!lpfEnumProcesses||!lpfEnumProcessModules||!lpfGetModuleBaseName)
{
FreeLibrary(hiPSAPI);
return;
}
DWORD ProcessIDList[100],dwCb=100,dwCbNeeded,cbRet;
if(!lpfEnumProcesses(ProcessIDList,dwCb,&dwCbNeeded))
{
FreeLibrary(hiPSAPI);
return;
}
HMODULE hModule[50];
char ModuleName[50];
unsigned char i=0;
while(i<dwCbNeeded/sizeof(DWORD))
{
hProcess = OpenProcess(PROCESS_QUERY_INFORMATION|PROCESS_VM_READ|PROCESS_TERMINATE,0,ProcessIDList[i++]);
if(hProcess)
{
cbRet=0;
if(lpfEnumProcessModules(hProcess,hModule,50,&cbRet))
if(lpfGetModuleBaseName(hProcess,hModule[0],ModuleName,50))
if(!strcmp(ModuleName,"ProcessToKill.EXE"))
{
TerminateProcess(hProcess,0);
CloseHandle(hProcess);
break;
}
cbRet=GetLastError();
CloseHandle(hProcess);
}
}
FreeLibrary(hiPSAPI);
}
else if(OSVersion.dwPlatformId==VER_PLATFORM_WIN32_WINDOWS)// Win 9x
{
HINSTANCE hiKernel32 = LoadLibrary("Kernel32.DLL");
if(hiKernel32 == NULL) return;
// ToolHelp32 Function Pointers.
typedef HANDLE (WINAPI *LPCREATETOOLHELP32SNAPSHOT)(DWORD,DWORD);
typedef BOOL (WINAPI *LPPROCESS32FIRST)(HANDLE,LPPROCESSENTRY32);
typedef BOOL (WINAPI *LPPROCESS32NEXT)(HANDLE,LPPROCESSENTRY32);
LPCREATETOOLHELP32SNAPSHOT lpfCreateToolhelp32Snapshot = (LPCREATETOOLHELP32SNAPSHOT)GetProcAddress(hiKernel32,"CreateToolhelp32Snapshot");
LPPROCESS32FIRST lpfProcess32First = (LPPROCESS32FIRST)GetProcAddress(hiKernel32,"Process32First");
LPPROCESS32NEXT lpfProcess32Next = (LPPROCESS32NEXT)GetProcAddress(hiKernel32,"Process32Next");
if(!lpfCreateToolhelp32Snapshot||!lpfProcess32First||!lpfProcess32Next)
{
FreeLibrary(hiKernel32);
return;
}
HANDLE hProcessList = lpfCreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
if(!hProcessList)
{
FreeLibrary(hiKernel32);
return; // cannot take the snapshot
}
PROCESSENTRY32 Process;
Process.dwSize = sizeof(PROCESSENTRY32);
if(!lpfProcess32First(hProcessList,&Process))
{
CloseHandle(hProcessList);
FreeLibrary(hiKernel32);
return;
}
do
{
if(!strcmp(Process.szExeFile,"ProcessToKill.EXE"))
{
hProcess = OpenProcess(PROCESS_TERMINATE,0,Process.th32ProcessID);
if(!hProcess) break;// cannot open the process
TerminateProcess(hProcess,0);
CloseHandle(hProcess);
break;
}
}while (lpfProcess32Next(hProcessList,&Process));
CloseHandle(hProcessList);
FreeLibrary(hiKernel32);
}