如何知道一个COM+应用程序是否在活动?

dahua 2003-09-28 12:11:51
加精
即在组建服务里能看到的,代表COM+应用程序的小球在转的状态
...全文
31 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
Onega 2003-10-02
  • 打赏
  • 举报
回复
http://www.codeguru.com/complus/complus_admin.html
Programming the COM+ Admin Objects in Visual C++
dahua 2003-09-28
  • 打赏
  • 举报
回复
help
Onega 2003-09-28
  • 打赏
  • 举报
回复
http://expert.csdn.net/Expert/topic/2292/2292598.xml?temp=.8840601
dahua 2003-09-28
  • 打赏
  • 举报
回复
to Onega() :
谢谢,还要请教
仔细看了msdn,GetRunningObjectTable还是不明白怎么用。
第二个方法看明白了
但有个问题
如何把知道了ProcessID,如何知道ProcessName,也就是说怎么判断哪个进程是dllHost
warmchang 2003-09-28
  • 打赏
  • 举报
回复
嗯,上面的方法应该可以实现。
xiaohyy 2003-09-28
  • 打赏
  • 举报
回复
try
..
catch
..
Onega 2003-09-28
  • 打赏
  • 举报
回复
or Enumerating All Modules For dllhost.exe, check if the COM DLL is loaded

To determine which processes have loaded a particular DLL, you must enumerate the modules for each process. The following sample code uses the EnumProcessModules function to enumerate the modules of current processes in the system.


#include <windows.h>
#include <stdio.h>
#include "psapi.h"

void PrintModules( DWORD processID )
{
HMODULE hMods[1024];
HANDLE hProcess;
DWORD cbNeeded;
unsigned int i;

// Print the process identifier.

printf( "\nProcess ID: %u\n", processID );

// Get a list of all the modules in this process.

hProcess = OpenProcess( PROCESS_QUERY_INFORMATION |
PROCESS_VM_READ,
FALSE, processID );
if (NULL == hProcess)
return;

if( EnumProcessModules(hProcess, hMods, sizeof(hMods), &cbNeeded))
{
for ( i = 0; i < (cbNeeded / sizeof(HMODULE)); i++ )
{
char szModName[MAX_PATH];

// Get the full path to the module's file.

if ( GetModuleFileNameEx( hProcess, hMods[i], szModName,
sizeof(szModName)))
{
// Print the module name and handle value.

printf("\t%s (0x%08X)\n", szModName, hMods[i] );
}
}
}

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 of the modules for each process.

for ( i = 0; i < cProcesses; i++ )
PrintModules( aProcesses[i] );
}
Onega 2003-09-28
  • 打赏
  • 举报
回复
get running object table( GetRunningObjectTable ), search if target object is existing.

3,248

社区成员

发帖
与我相关
我的任务
社区描述
ATL,Active Template Library活动(动态)模板库,是一种微软程序库,支持利用C++语言编写ASP代码以及其它ActiveX程序。
社区管理员
  • ATL/ActiveX/COM社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧