老板要我设计的部分是一个一个实时更新的对话框,对话框里反映的是后台程序运行情况,如什么时候程序启动,什么时候更新什么时候出错之类的信息。听师兄说是这些信息本身程序都会存储在一个log文件里。这个log文件它本身是实时更新的吗?我能够直接用程序去读吗?应该怎么来读这些数据?是不是还要设定时间循环的去取数据?
整个程序要用到些什么类啊是怎么个设计思路啊?
我是新手,mfc才刚看不久老板就给任务,现在脑子乱死了。
拜谢各位高手了。
整个程序要用到些什么类啊是怎么个设计思路啊?
我是新手,mfc才刚看不久老板就给任务,现在脑子乱死了。
拜谢各位高手了。
you'll find many many............#include <windows.h>
#include <stdio.h>
#include "psapi.h"void PrintProcessNameAndID( DWORD processID )
{
char szProcessName[MAX_PATH] = "unknown"; // Get a handle to the process. HANDLE hProcess = OpenProcess( PROCESS_QUERY_INFORMATION |
PROCESS_VM_READ,
FALSE, processID ); // Get the process name. if (NULL != hProcess )
{
HMODULE hMod;
DWORD cbNeeded; if ( EnumProcessModules( hProcess, &hMod, sizeof(hMod),
&cbNeeded) )
{
GetModuleBaseName( hProcess, hMod, szProcessName,
sizeof(szProcessName) );
}
else return;
}
else return; // Print the process name and identifier. printf( "%s (Process ID: %u)\n", szProcessName, processID ); CloseHandle( hProcess );
}void main( )
{
// Get the list of process identifiers. DWORD aProcesses[1024], cbNeeded, cProcesses;
unsigned int i; if ( !EnumProcesses( aProcesses, sizeof(aProcesses), &cbNeeded ) )
return; // Calculate how many process identifiers were returned. cProcesses = cbNeeded / sizeof(DWORD); // Print the name and process identifier for each process. for ( i = 0; i < cProcesses; i++ )
PrintProcessNameAndID( aProcesses[i] );
}