如题,我在资源管理器中查不到哪个进程使用了这个文件啊
解决方案 »
- 新手小妹求助~~为什么每输入或删除一个字符界面都会闪一下,是用VC实现的文本编辑器,用了双缓冲了的~~
- 在使用UNICODE字符集,把宽字符串处理到Access中怎么是乱码?
- ::UuidHash是什么意思??
- 一个初学VC的疑问
- 基于CFormView类的对话框工具栏变灰问题
- dll导出类和对象有什么不同?
- 知不知道CDialog::OnCancel()是什么意思?
- 两个进程文件读取冲突的问题
- 以下代码设置的原点到底再什么地方 就是程序中用SetPixel(0,0,RGB(255,0,0))到底在什么地方出现 给出一般解 不要特定的解
- 难题: 怎么知道一个文件正在被其它进程写入数据?
- 从SQL server或者Access导出数据到Mysql有没有比较好的方法.
- 想实现一个高实时性的通信协议,VC中有没有利器可用?
http://www.codeguru.com/Cpp/W-P/files/fileio/article.php/c1287/The following code closes a handle in a remote process. The handle must be remote process specific.
/*
Note: 1. SE_DEBUG privilege must be enabled.
2. The function works with every kind of HANDLE
3. It will bother the remote process :)
4. The handles will be invalid after you closed
them remotely
*///Close a handle in a remote process
DWORD CloseRemoteHandle( DWORD processID, HANDLE handle )
{
HANDLE ht = 0;
DWORD rc = 0; _tprintf( _T("Closing handle in process #%d ... "),
processID ); // open the process
HANDLE hProcess = OpenProcess( PROCESS_CREATE_THREAD
| PROCESS_VM_OPERATION
| PROCESS_VM_WRITE
| PROCESS_VM_READ,
FALSE, processID ); if ( hProcess == NULL )
{
rc = GetLastError();
_tprintf( _T("OpenProcess() failed\n") );
return rc;
} // load kernel32.dll
HMODULE hKernel32 = LoadLibrary( _T("kernel32.dll") ); // CreateRemoteThread()
ht = CreateRemoteThread(
hProcess,
0,
0,
(DWORD(__stdcall *)(void*))GetProcAddress(hKernel32,"CloseHandle"),
handle,
0,
&rc ); if ( ht == NULL )
{
//Something is wrong with the privileges,
//or the process doesn't like us
rc = GetLastError();
_tprintf( _T("CreateRemoteThread() failed\n") );
goto cleanup;
} switch ( WaitForSingleObject( ht, 2000 ) )
{
case WAIT_OBJECT_0:
//Well done
rc = 0;
_tprintf( _T("Ok\n"), rc );
break; default:
//Oooops, shouldn't be here
rc = GetLastError();
_tprintf( _T("WaitForSingleObject() failed\n") );
goto cleanup;
break;
} cleanup:
//Closes the remote thread handle
CloseHandle( ht ); //Free up the kernel32.dll
if ( hKernel32 != NULL)
FreeLibrary( hKernel32 ); //Close the process handle
CloseHandle( hProcess ); return rc;
}