作者purpose (purpose)
看板Programming
标题Re: [问题] jmp ffff:0 不能用了
时间Sun Oct 9 00:36:00 2011
※ 引述《whitefox (八十万定存宅男)》之铭言:
: 以前旧的windows系统可以用这方式关掉dos 视窗
: 现在的win7会跳出ntvdm.exe错误的讯息
: 而不会直接关掉cmd.exe的视窗
: 有可以取代的方法吗
#include <windows.h>
#pragma comment(lib, "user32")
int main() {
HWND hp = GetForegroundWindow();
DWORD pid;
char str[256];
GetWindowThreadProcessId(hp, &pid);
printf("hp = %x, pid = %d\n", hp, pid);
sprintf(str, "hp = %x, pid = %d\n", hp, pid);
MessageBoxA(NULL, str, "", MB_OK);
sprintf(str, "taskkill /pid %d", pid);
system(str);
return 0;
}
在 Windows XP 可以用 taskkill 透过这个碗糕 PID 关掉 cmd.exe。
Windows 7 的话,那要等我买新电脑才能测。
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 124.8.136.77