WEB开发网
开发学院软件开发C++ 关闭DOS窗口 阅读

关闭DOS窗口

 2008-03-08 12:41:54 来源:WEB开发网   
核心提示://http://nowcan.yeah.net#include <windows.h>void __fastcall KillPRocess(HWND hWnd){DWord* pPid;DWORD result;void *hg;hg = GlobalAlloc(GMEM_SHARE, sizeof(D

  //http://nowcan.yeah.net
#include <windows.h>

void __fastcall KillPRocess(HWND hWnd)
{
DWord* pPid;
DWORD result;
void *hg;
hg = GlobalAlloc(GMEM_SHARE, sizeof(DWORD));
pPid =(DWORD *)GlobalLock(hg);
result = GetWindowThreadProcessId(hWnd, pPid);
if(result)
{
HANDLE ps = OpenProcess(1, false, *pPid);
TerminateProcess(ps, -9);
GlobalUnlock(hg);
GlobalFree(hg);
}
}

void __fastcall CloseDosWindow()
{
HWND hWnd=FindWindow("ConsoleWindowClass",NULL);//这个是2000的,98下用"tty"
KillProcess(hWnd);
return;
}


int main()
{
CloseDosWindow();
}

Tags:关闭 DOS 窗口

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接