Click here to Skip to main content
15,886,578 members
Home / Discussions / C#
   

C#

 
GeneralRe: RGB and HSV Pin
Tomas Petricek21-Sep-02 6:19
Tomas Petricek21-Sep-02 6:19 
GeneralScrolling Metrics Pin
leppie21-Sep-02 3:53
leppie21-Sep-02 3:53 
GeneralMulticolored Text Pin
Stickman21-Sep-02 1:38
Stickman21-Sep-02 1:38 
GeneralRe: Multicolored Text Pin
leppie21-Sep-02 1:51
leppie21-Sep-02 1:51 
GeneralRe: Multicolored Text Pin
Philip Fitzsimons23-Sep-02 7:14
Philip Fitzsimons23-Sep-02 7:14 
Questionhelp ( form message releted )? Pin
imran_rafique20-Sep-02 15:59
imran_rafique20-Sep-02 15:59 
AnswerRe: help ( form message releted )? Pin
James T. Johnson20-Sep-02 16:37
James T. Johnson20-Sep-02 16:37 
Questioncan any body help (releated to hook )? Pin
imran_rafique20-Sep-02 15:03
imran_rafique20-Sep-02 15:03 
please read that code and solve my problem.
Given after that code.
//////////////////////////////////////////////////////////
public class Win32Hook <br />
 <br />
{ <br />
 <br />
     [DllImport("kernel32")] <br />
 <br />
     public static extern int GetCurrentThreadId(); <br />
 <br />
<br />
 <br />
     [DllImport( "user32", CharSet=CharSet.Auto,CallingConvention=CallingConvention.StdCall)] <br />
 <br />
     public static extern int SetWindowsHookEx( HookType idHook, <br />
 <br />
                    HOOKPROC lpfn, <br />
 <br />
                    int hmod, <br />
 <br />
                    int dwThreadId <br />
 <br />
                    ); <br />
 <br />
<br />
 <br />
     public enum HookType <br />
 <br />
     { <br />
 <br />
          WH_KEYBOARD = 2 <br />
 <br />
     } <br />
 <br />
     public delegate int HOOKPROC(int nCode, int wParam, int lParam); <br />
 <br />
<br />
 <br />
     private HOOKPROC hookProc; //private field with class scope <br />
 <br />
<br />
 <br />
     public void SetHook() <br />
 <br />
     { <br />
 <br />
           // set the keyboard hook <br />
 <br />
          hookProc = new HOOKPROC(this.MyKeyboardProc); <br />
 <br />
<br />
 <br />
          SetWindowsHookEx(HookType.WH_KEYBOARD, hookProc, 0,<br />
                    GetCurrentThreadId()); <br />
 <br />
<br />
 <br />
     } <br />
 <br />
<br />
 <br />
     public int MyKeyboardProc(int nCode, int wParam, int lParam) <br />
 <br />
     { <br />
 <br />
	  //line of code <br />
<br />
          return 0; <br />
 <br />
     } <br />
 <br />
}<br />
 <br />
<br />
To install the hook procedure <br />
 <br />
Win32Hook hook = new Win32Hook(); <br />
 <br />
hook.SetHook(); 

//////////////////////////////////////////////////////////

Above code is 100% correct but my problem here is that I want to execute it for each thread for that purpose I modify a line of code and that is
SetWindowsHookEx (HookType.WH_KEYBOARD, hookProc, IntPtr.Zero,0 );

But after changing that line of code it does not solve my problem because MyKeyboardProc function does not execute its code.
I don’t know why? Can any body give its solution?

r00d0034@yahoo.com
Generalsocket timeout Pin
Rüpel20-Sep-02 3:27
Rüpel20-Sep-02 3:27 
GeneralRe: socket timeout Pin
Luis Alonso Ramos20-Sep-02 4:37
Luis Alonso Ramos20-Sep-02 4:37 
GeneralRe: socket timeout Pin
Rüpel22-Sep-02 22:23
Rüpel22-Sep-02 22:23 
Generalthis is not solved yet Pin
Rüpel23-Sep-02 4:00
Rüpel23-Sep-02 4:00 
GeneralRe: socket timeout Pin
Daniel Turini23-Sep-02 9:16
Daniel Turini23-Sep-02 9:16 
GeneralRe: socket timeout Pin
Rüpel23-Sep-02 10:09
Rüpel23-Sep-02 10:09 
Generalstill doesn't work Pin
Rüpel23-Sep-02 20:52
Rüpel23-Sep-02 20:52 
Generalfinally Pin
Rüpel23-Sep-02 21:53
Rüpel23-Sep-02 21:53 
GeneralEiffel .NET for Visual Studio .NET Plug-in Pin
Kevin McFarlane20-Sep-02 1:50
Kevin McFarlane20-Sep-02 1:50 
GeneralBackground and foreground color for disabled state Pin
valos20-Sep-02 1:18
valos20-Sep-02 1:18 
QuestionShut down one program from another? Pin
Matt Philmon19-Sep-02 18:11
Matt Philmon19-Sep-02 18:11 
AnswerRe: Shut down one program from another? Pin
Stephane Rodriguez.19-Sep-02 19:08
Stephane Rodriguez.19-Sep-02 19:08 
GeneralRe: Shut down one program from another? Pin
Matt Philmon19-Sep-02 20:50
Matt Philmon19-Sep-02 20:50 
GeneralRe: Shut down one program from another? Pin
Stephane Rodriguez.19-Sep-02 21:23
Stephane Rodriguez.19-Sep-02 21:23 
GeneralRe: Shut down one program from another? Pin
Matt Philmon20-Sep-02 4:47
Matt Philmon20-Sep-02 4:47 
GeneralRe: Shut down one program from another? Pin
leppie20-Sep-02 5:22
leppie20-Sep-02 5:22 
GeneralRe: Shut down one program from another? Pin
Matt Philmon20-Sep-02 21:33
Matt Philmon20-Sep-02 21:33 

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.