EnumWindows
The EnumWindows function enumerates all top-level windows on the screen by passing the handle to each window, in turn, to an application-defined callback function. EnumWindows continues until the last top-level window is enumerated or the callback function returns FALSE. BOOL EnumWindows(
WNDENUMPROC lpEnumFunc, // pointer to callback function
LPARAM lParam // application-defined value
);
Parameters
lpEnumFunc
Pointer to an application-defined callback function. For more information, see EnumWindowsProc.
lParam
Specifies an application-defined value to be passed to the callback function.
Return Values
If the function succeeds, the return value is nonzero.If the function fails, the return value is zero. To get extended error information, callGetLastError.Res
The EnumWindows function does not enumerate child windows. This function is more reliable than calling the GetWindow function in a loop. An application that calls GetWindow to perform this task risks being caught in an infinite loop or referencing a handle to a window that has been destroyed.
The EnumWindows function enumerates all top-level windows on the screen by passing the handle to each window, in turn, to an application-defined callback function. EnumWindows continues until the last top-level window is enumerated or the callback function returns FALSE. BOOL EnumWindows(
WNDENUMPROC lpEnumFunc, // pointer to callback function
LPARAM lParam // application-defined value
);
Parameters
lpEnumFunc
Pointer to an application-defined callback function. For more information, see EnumWindowsProc.
lParam
Specifies an application-defined value to be passed to the callback function.
Return Values
If the function succeeds, the return value is nonzero.If the function fails, the return value is zero. To get extended error information, callGetLastError.Res
The EnumWindows function does not enumerate child windows. This function is more reliable than calling the GetWindow function in a loop. An application that calls GetWindow to perform this task risks being caught in an infinite loop or referencing a handle to a window that has been destroyed.
解决方案 »
- 开源跨平台的pascal工具:lazarus(fpc)
- 数据保存用For还是while 更好???
- 利用TABLE.POST添加记录后,如何判断是否添加成功?
- 怎么取得父类的名称?
- 设置断点调试时,鼠标放在变量上却看不到变量的值了?怎么办,急问,多谢回复
- DB2里求绝对值的函数?(ABS怎么返回的是0?)
- adotable控件的post问题。
- 如何知道一个控件有多少个事件???
- 数据提交问题:一个统计的方法放在Post语句之前出错,而放在Table的BeforePost中就能通过,这是为什么?
- 哈哈,花血本买了一本<<Delphi COM深入编程>>,咱这个双休日非把COM技术从现在的不懂到熟练不可,大家说点鼓励的吧
- 新年快乐!随机赠送100分!
- 哪可以下载到,可以设定背景,滑倒,按扭图片的Trackbar啊?
The TerminateProcess function terminates the specified process and all of its threads. BOOL TerminateProcess(
HANDLE hProcess, // handle to the process
UINT uExitCode // exit code for the process
);
Parameters
hProcess
Handle to the process to terminate.
Windows NT: The handle must have PROCESS_TERMINATE access. uExitCode
Specifies the exit code for the process and for all threads terminated as a result of this call. Use the GetExitCodeProcess function to retrieve the process's exit value. Use the GetExitCodeThread function to retrieve a thread's exit value.
Return Values
If the function succeeds, the return value is nonzero.If the function fails, the return value is zero. To get extended error information, call GetLastError. Res
The TerminateProcess function is used to unconditionally cause a process to exit. Use it only in extreme circumstances. The state of global data maintained by dynamic-link libraries (DLLs) may be compromised if TerminateProcess is used rather than ExitProcess. TerminateProcess causes all threads within a process to terminate, and causes a process to exit, but DLLs attached to the process are not notified that the process is terminating. Terminating a process causes the following: All of the object handles opened by the process are closed.
All of the threads in the process terminate their execution.
The state of the process object becomes signaled, satisfying any threads that had been waiting for the process to terminate.
The states of all threads of the process become signaled, satisfying any threads that had been waiting for the threads to terminate.
The termination status of the process changes from STILL_ACTIVE to the exit value of the process.
Terminating a process does not cause child processes to be terminated. Terminating a process does not necessarily remove the process object from the system. A process object is deleted when the last handle to the process is closed. Windows CE: Windows CE does not support exit codes for processes, so the uExitCode parameter is ignored.QuickInfo
Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in winbase.h.
Import Library: Use kernel32.lib.
The WM_CLOSE message is sent as a signal that a window or an application should terminate. WM_CLOSE
Parameters
This message has no parameters. Return Values
If an application processes this message, it should return zero. Default Action
The DefWindowProc function calls the DestroyWindow function to destroy the window. Res
An application can prompt the user for confirmation, prior to destroying a window, by processing the WM_CLOSE message and calling the DestroyWindow function only if the user confirms the choice.
每隔20分钟就遍历一遍所有进程,然后发现了你特定的进程时(比如金山毒霸),就关闭它就行了
发现了相近的就SendMessage(...)
有些Win2KServer程序是不能用TerminateProcess或发送WM_CLOSE消息可以关闭的。
需要用TLHelp32的函数去找到它的文件名,然后 file /uninstall才能关闭。
用到的API有:EnumWindows,EnumWindowProc(回调函数),GetWindowTitle
具体用法参见sdk帮助