|
// CallWndProcRetHook.cs
// Copyright 2002, Rama Krishna
//
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace Balloon.NET.Hooks
{
public class CallWndProcRetHookEventArgs : EventArgs
{
Message message;
bool sentFromCurrentProcess;
[StructLayout(LayoutKind.Sequential)]
internal class CWPRETSTRUCT
{
public IntPtr result;
public IntPtr lparam;
public IntPtr wparam;
public int message;
public IntPtr hwnd;
};
internal CallWndProcRetHookEventArgs(IntPtr wparam, IntPtr lparam)
{
sentFromCurrentProcess = wparam != IntPtr.Zero;
CWPRETSTRUCT cwpr = (CWPRETSTRUCT)Marshal.PtrToStructure(lparam, typeof(CWPRETSTRUCT));
message = Message.Create(cwpr.hwnd, cwpr.message, cwpr.wparam, cwpr.lparam);
message.Result = cwpr.result;
}
public System.Windows.Forms.Message Message
{
get
{
return message;
}
}
public bool SentFromCurrentProcess
{
get
{
return this.sentFromCurrentProcess;
}
}
};
public delegate void CallWndProcRetHookEventHandler(object sender, CallWndProcRetHookEventArgs e);
/// <summary>
/// Summary description for CallWndRetProcHook.
/// </summary>
class CallWndProcRetHook : BaseHook
{
internal CallWndProcRetHook()
{
}
internal override Hooks.HookType Type
{
get
{
return HookType.CallWndProcRet;
}
}
protected override void InvokeHookEvent(int code, System.IntPtr wparam, System.IntPtr lparam)
{
CallWndProcRetHookEventArgs e = new CallWndProcRetHookEventArgs(wparam, lparam);
Parent.OnCallWndRetProcHook(this, e);
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.