#include <Windows.h>
#include <iostream>
#include <Tlhelp32.h>
using namespace std;int main()
{
    PROCESSENTRY32    pe3    ;
    pe3.dwSize = sizeof( PROCESSENTRY32 );
    HANDLE    Hsnap    = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
    BOOL    Bresult = Process32First(Hsnap,&pe3);
    while (Bresult)
    {
        cout<<"进程名:"<<pe3.szExeFile<<endl;//实际显示为地址,怎么不是字符串?
        cout<<"进程ID:"<<pe3.th32ProcessID<<endl;        Bresult        = Process32Next(Hsnap,&pe3);
    }    Sleep(10000);
    return 0;
}

解决方案 »

  1.   

    wchar_t buf[] = L"你好世界";
    WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE),buf,wcslen(buf),NULL,NULL);
      

  2.   

         wcout<<L"进程名:"<<pe3.szExeFile<<endl;//实际显示为地址,怎么不是字符串?
            wcout<<L"进程ID:"<<pe3.th32ProcessID<<endl;
      

  3.   


    #include <iostream>
    #include <Windows.h>
    #include <Tlhelp32.h>using namespace std;int main()
    {
    PROCESSENTRY32    pe3;
    pe3.dwSize = sizeof( PROCESSENTRY32 ); HANDLE    Hsnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
    BOOL    Bresult = Process32First(Hsnap,&pe3);
    setlocale(LC_ALL, "chs"); while (Bresult)
    {
    wcout<<_T("进程名:")<<pe3.szExeFile<<endl;//实际显示为地址,怎么不是字符串?
    wcout<<_T("进程ID:")<<pe3.th32ProcessID<<endl<<endl; Bresult        = Process32Next(Hsnap,&pe3);
    } system("pause");
    return 0;
    }
      

  4.   

    wcout.imbue(locale("chs")); wcout<<L"进程名:"<<pe3.szExeFile<<endl;//实际显示为地址,怎么不是字符串?
    wcout<<L"进程ID:"<<pe3.th32ProcessID<<endl;