#include <iostream>
#include <windows.h>
#include <Tlhelp32.h>
int main()
{
try
{
HANDLE hSnapshot;
PROCESSENTRY32 pe32;
hSnapshot = ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if(hSnapshot == INVALID_HANDLE_VALUE)
throw "failure in snapshot";
pe32.dwFlags = sizeof(PROCESSENTRY32);
if(!::Process32First(hSnapshot, &pe32))
throw "cannot find any process";
do
{
std::cout << pe32.szExeFile << '\n';
}
while(::Process32Next(hSnapshot, &pe32));
}
catch(const char* szError)
{
std::cout << szError << '\n';
}
system("pause");
return 0;
}
#include <windows.h>
#include <Tlhelp32.h>
int main()
{
try
{
HANDLE hSnapshot;
PROCESSENTRY32 pe32;
hSnapshot = ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if(hSnapshot == INVALID_HANDLE_VALUE)
throw "failure in snapshot";
pe32.dwFlags = sizeof(PROCESSENTRY32);
if(!::Process32First(hSnapshot, &pe32))
throw "cannot find any process";
do
{
std::cout << pe32.szExeFile << '\n';
}
while(::Process32Next(hSnapshot, &pe32));
}
catch(const char* szError)
{
std::cout << szError << '\n';
}
system("pause");
return 0;
}
"Win32 API" 카테고리의 다른 글
- VB로 작성한 DLL을 VC에서 호출하는 방법 (0)2006/12/01
- Safe TerminateProcess() (1)2006/11/29
- 현재 실행중인 프로세서 열거하기 (0)2006/08/17
- The Internet API (0)2006/08/13
- Platform SDK: Windows Internet - HTTP Sessions (0)2006/08/13

수안이의 컴퓨터 연구실



Leave your greetings.