Click here to Skip to main content
15,881,248 members
Home / Discussions / C#
   

C#

 
GeneralRe: Hooking messages of external application Pin
Manas Bhardwaj10-Jun-09 1:44
professionalManas Bhardwaj10-Jun-09 1:44 
GeneralRe: Hooking messages of external application Pin
saurabh sahay10-Jun-09 2:41
saurabh sahay10-Jun-09 2:41 
GeneralRe: Hooking messages of external application Pin
EliottA10-Jun-09 2:45
EliottA10-Jun-09 2:45 
GeneralRe: Hooking messages of external application Pin
Rajesh R Subramanian10-Jun-09 3:16
professionalRajesh R Subramanian10-Jun-09 3:16 
GeneralRe: Hooking messages of external application Pin
saurabh sahay10-Jun-09 4:01
saurabh sahay10-Jun-09 4:01 
GeneralRe: Hooking messages of external application Pin
Rajesh R Subramanian10-Jun-09 3:06
professionalRajesh R Subramanian10-Jun-09 3:06 
GeneralRe: Hooking messages of external application Pin
saurabh sahay10-Jun-09 4:02
saurabh sahay10-Jun-09 4:02 
AnswerRe: Hooking messages of external application Pin
saurabh sahay10-Jun-09 3:13
saurabh sahay10-Jun-09 3:13 
Hi Muneeb

Yes its definitely possible with the help of delegates in C#
I came across the same situation when i needed to code for windows taskbar switching functionality.

Let the call back function you want to hook is

private static IntPtr HookCallback(
int nCode, IntPtr wParam, IntPtr lParam) {}

which would get executed when file button is clicked.

assign:-> private static LowLevelMouseProc _proc = HookCallback;
private delegate IntPtr LowLevelMouseProc(int nCode, IntPtr wParam, IntPtr lParam);

and set the hook with

private static IntPtr SetHook(LowLevelMouseProc proc)
{
using (Process curProcess = Process.GetCurrentProcess())
using (ProcessModule curModule = curProcess.MainModule)
{
return SetWindowsHookEx(WH_MOUSE_LL, proc,
GetModuleHandle(curModule.ModuleName), 0);
}
}

You may need to use documented and undocumented Winapi calls to get the classid and Filebutton name in function HookCallback
You are done!
GeneralRe: Hooking messages of external application Pin
Dave Kreskowiak10-Jun-09 5:19
mveDave Kreskowiak10-Jun-09 5:19 
GeneralRe: Hooking messages of external application Pin
saurabh sahay10-Jun-09 5:47
saurabh sahay10-Jun-09 5:47 
GeneralRe: Hooking messages of external application Pin
Rajesh R Subramanian10-Jun-09 6:17
professionalRajesh R Subramanian10-Jun-09 6:17 
GeneralRe: Hooking messages of external application Pin
saurabh sahay10-Jun-09 6:30
saurabh sahay10-Jun-09 6:30 
GeneralRe: Hooking messages of external application Pin
Rajesh R Subramanian10-Jun-09 7:09
professionalRajesh R Subramanian10-Jun-09 7:09 
GeneralRe: Hooking messages of external application Pin
saurabh sahay10-Jun-09 7:20
saurabh sahay10-Jun-09 7:20 
AnswerRe: Hooking messages of external application Pin
saurabh sahay10-Jun-09 3:31
saurabh sahay10-Jun-09 3:31 
GeneralRe: Hooking messages of external application Pin
tasumisra10-Jun-09 3:40
tasumisra10-Jun-09 3:40 
GeneralRe: Hooking messages of external application Pin
saurabh sahay10-Jun-09 4:03
saurabh sahay10-Jun-09 4:03 
GeneralRe: Hooking messages of external application Pin
Rajesh R Subramanian10-Jun-09 3:59
professionalRajesh R Subramanian10-Jun-09 3:59 
Questionopen Pdf in WebBrowser Control [modified] Pin
Abdul Rahman Hamidy10-Jun-09 1:08
Abdul Rahman Hamidy10-Jun-09 1:08 
AnswerRe: open Pdf in WebBrowser Control Pin
0x3c010-Jun-09 2:11
0x3c010-Jun-09 2:11 
GeneralRe: open Pdf in WebBrowser Control [modified] Pin
Abdul Rahman Hamidy10-Jun-09 19:44
Abdul Rahman Hamidy10-Jun-09 19:44 
AnswerRe: open Pdf in WebBrowser Control Pin
saurabh sahay10-Jun-09 2:27
saurabh sahay10-Jun-09 2:27 
GeneralRe: open Pdf in WebBrowser Control Pin
Abdul Rahman Hamidy10-Jun-09 19:46
Abdul Rahman Hamidy10-Jun-09 19:46 
GeneralFind & Search in text File Pin
Isaac Gordon10-Jun-09 0:26
Isaac Gordon10-Jun-09 0:26 
GeneralRe: Find & Search in text File Pin
0x3c010-Jun-09 0:34
0x3c010-Jun-09 0:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.