Install Shield可以使用API函数。它内置了一些API函数,如SetWindowLong,可以指定包含文件Winapi.h,如下: #include "Winapi.h" 对于另外一些winapi.h文件不指供的API,就需要通过DLL文件引用,如下例: 强行结束进程 prototype POINTER KERNEL32.GlobalLock(POINTER); prototype BOOL KERNEL32.GlobalUnlock(POINTER); prototype INT KERNEL32.GlobalFree(POINTER); prototype INT KERNEL32.GlobalAlloc(INT, INT); prototype LONG user32.GetWindowThreadProcessId(HWND, POINTER); prototype LONG KERNEL32.TerminateProcess(HWND, INT); prototype LONG KERNEL32.OpenProcess(INT, BOOL, INT); //强行结束进程 prototype KillProcess(HWND);//窗口句柄 function KillProcess(hWnd) POINTER pPid; int result; POINTER hg; HWND ps; begin hg = GlobalAlloc(8192, 32); pPid = GlobalLock(hg); result = GetWindowThreadProcessId(hWnd, pPid); if result then ps = OpenProcess(1, FALSE, *pPid); TerminateProcess(ps, -9); GlobalUnlock(hg); GlobalFree(hg); endif; end;
|