php具体提供了两个函数:1 system() 2.是exec 通过这样调用我们可以实现php很多所不能实现的功能 这里我用c++来测试下 怎样用php调用c++的exe程序获取当前系统的进程情况!。(来源:移动应用商城(cmccapp.com))
1.vc建立w32控制台程序 code:
#include
#include windows.h
#include tlhelp32.h
#include stdio.h
using namespace std;
int main(int argc, char* argv[])
{
? processentry32 pe32;
? pe32.dwsize = sizeof(pe32);
? handle hprocesssnap = ::createtoolhelp32snapshot(th32cs_snapprocess,0);
? if(hprocesssnap==invalid_handle_value)
? {
? ? cout? ? return -1;
? }
? bool bmore = ::process32first(hprocesssnap,&pe32);
? while(bmore)
? {
? ? printf(进程名称: %s\n,pe32.szexefile);
? ? printf(进程id %u\n\n
,pe32.th32processid);
? ? bmore = ::process32next(hprocesssnap,&pe32);
? }
? ::closehandle(hprocesssnap);
? return 0;
}
编译成exe!
接着php写入 code:
将路径换成你的路径 试试效果 来张截图吧!
此文章来自移动应用商城(cmccapp.com)? 转载请著名出处!
