我用DLL可以做钩子,但是有一个问题,是在一次就聘时遇到的!
就是关于钩子链,如果一个系统上存在多个键盘钩子:
1。我怎么才能知道我的钩子的优先级呢?
2。怎么把我的钩子设为系统的最高优先级,我应该怎么做?
3。如果可以设最高优先级,那么如果我的钩子设为最高优先级了,其它的钩子用同样的方法能否设为比我的优先级还高。
4。怎么防止其它钩子的优先级怎么设置都不能超过我的呢?
MSDN Home > MSDN Library > SDK Documentation > WinINet Reference > WinINet Functions
Platform SDK: Windows Internet
InternetStatusCallback
Prototype for an application-defined status callback function.
The INTERNET_STATUS_CALLBACK type defines a pointer to this callback function. InternetStatusCallback is a placeholder for the application-defined function name.
void CALLBACK InternetStatusCallback(
HINTERNET hInternet,
DWORD_PTR dwContext,
DWORD dwInternetStatus,
LPVOID lpvStatusInformation,
DWORD dwStatusInformationLength
);
Parameters
hInternet
[in] Handle for which the callback function is being called.
dwContext
[in] Pointer to a variable that specifies the application-defined context value associated with hInternet.
dwInternetStatus
[in] Status code that indicates why the callback function is being called. This parameter can be one of the following values. Value Meaning
INTERNET_STATUS_CLOSING_CONNECTION Closing the connection to the server. The lpvStatusInformation parameter is NULL.
INTERNET_STATUS_CONNECTED_TO_SERVER Successfully connected to the socket address (SOCKADDR) pointed to by lpvStatusInformation.
INTERNET_STATUS_CONNECTING_TO_SERVER Connecting to the socket address (SOCKADDR) pointed to by lpvStatusInformation.
INTERNET_STATUS_CONNECTION_CLOSED Successfully closed the connection to the server. The lpvStatusInformation parameter is NULL.
INTERNET_STATUS_CTL_RESPONSE_RECEIVED Not implemented.
INTERNET_STATUS_DETECTING_PROXY Notifies the client application that a proxy has been detected.
INTERNET_STATUS_HANDLE_CLOSING This handle value has been terminated.
INTERNET_STATUS_HANDLE_CREATED Used by InternetConnect to indicate it has created the new handle. This lets the application call InternetCloseHandle from another thread, if the connect is taking too long. The lpvStatusInformation parameter contains the address of an INTERNET_ASYNC_RESULT structure.
INTERNET_STATUS_INTERMEDIATE_RESPONSE Received an intermediate (100 level) status code message from the server.
INTERNET_STATUS_NAME_RESOLVED Successfully found the IP address of the name contained in lpvStatusInformation.
INTERNET_STATUS_PREFETCH Not implemented.
INTERNET_STATUS_RECEIVING_RESPONSE Waiting for the server to respond to a request. The lpvStatusInformation parameter is NULL.
INTERNET_STATUS_REDIRECT An HTTP request is about to automatically redirect the request. The lpvStatusInformation parameter points to the new URL. At this point, the application can read any data returned by the server with the redirect response and can query the response headers. It can also cancel the operation by closing the handle. This callback is not made if the original request specified INTERNET_FLAG_NO_AUTO_REDIRECT.
INTERNET_STATUS_REQUEST_COMPLETE An asynchronous operation has been completed. The lpvStatusInformation parameter contains the address of an INTERNET_ASYNC_RESULT structure.
INTERNET_STATUS_REQUEST_SENT Successfully sent the information request to the server. The lpvStatusInformation parameter points to a DWORD value that contains the number of bytes sent.
INTERNET_STATUS_RESOLVING_NAME Looking up the IP address of the name contained in lpvStatusInformation.
INTERNET_STATUS_RESPONSE_RECEIVED Successfully received a response from the server. The lpvStatusInformation parameter points to a DWORD value that contains the number of bytes received.
INTERNET_STATUS_SENDING_REQUEST Sending the information request to the server. The lpvStatusInformation parameter is NULL.
INTERNET_STATUS_STATE_CHANGE Moved between a secure (HTTPS) and a nonsecure (HTTP) site. The user must be informed of this change; otherwise, the user is at risk of disclosing sensitive information involuntarily. When this flag is set, the lpvStatusInformation parameter points to a status DWORD that contains additonal flags.
lpvStatusInformation
[in] Pointer to additional status information. When the INTERNET_STATUS_STATE_CHANGE flag is set, lpvStatusInformation points to a DWORD that contains one or more of the following flags:Value Meaning
INTERNET_STATE_CONNECTED Connected state (mutually exclusive with disconnected state).
INTERNET_STATE_DISCONNECTED Disconnected state. No network connection could be established.
INTERNET_STATE_DISCONNECTED_BY_USER Disconnected by user request.
INTERNET_STATE_IDLE No network requests are being made by Windows Internet.
INTERNET_STATE_BUSY Network requests are being made by Windows Internet.
INTERNET_STATUS_USER_INPUT_REQUIRED The request requires user input to be completed.
dwStatusInformationLength
[in] Size of the data pointed to by lpvStatusInformation.
Return Values
This callback has no return values.
Remarks
Because callbacks are made during processing of the request, the application should spend as little time as possible in the callback function to avoid degrading data throughput on the network. For example, displaying a dialog box in a callback function can be such a lengthy operation that the server terminates the request.
The callback function can be called in a thread context different from the thread that initiated the request.
Always notify the user when a state change from a secure (HTTPS) site to a nonsecure (HTTP) site occurs, to guard against involuntary information disclosure.
Requirements
Client: Included in Windows XP, Windows 2000 Professional, Windows NT Workstation 4.0, Windows Me, Windows 98, and Windows 95.
Server: Included in Windows Server 2003, Windows 2000 Server, and Windows NT Server 4.0.
Version: Requires Internet Explorer 3.0 or later.
Header: Declared in wininet.h.
Library: Use wininet.lib.
See Also
Asynchronous Operation, Calling WinINet Functions Asynchronously, Creating Status Callback Functions, INTERNET_ASYNC_RESULT, WinINet Functions
Platform SDK Release: February 2003 What did you think of this topic?
Order a Platform SDK CD
Contact Us | E-Mail this Page | MSDN Flash Newsletter | Legal
© 2003 Microsoft Corporation. All rights reserved. Terms of Use Privacy Statement Accessibility