Click here to Skip to main content
15,903,201 members
Home / Discussions / C#
   

C#

 
GeneralRe: Issue with Environment.SpecialFolder.MyDocuments Pin
False Chicken4-Jun-10 2:22
False Chicken4-Jun-10 2:22 
GeneralRe: Issue with Environment.SpecialFolder.MyDocuments Pin
Johnny J.4-Jun-10 2:23
professionalJohnny J.4-Jun-10 2:23 
Questioncolor get changed in another pc Pin
eraser9504-Jun-10 2:03
eraser9504-Jun-10 2:03 
AnswerRe: color get changed in another pc Pin
OriginalGriff4-Jun-10 2:26
mveOriginalGriff4-Jun-10 2:26 
AnswerRe: color get changed in another pc Pin
Hristo-Bojilov4-Jun-10 2:27
Hristo-Bojilov4-Jun-10 2:27 
QuestionConvert System.Drawing.Image to System.Web.UI.WebControls.Image Pin
Add44-Jun-10 0:55
Add44-Jun-10 0:55 
AnswerRe: Convert System.Drawing.Image to System.Web.UI.WebControls.Image Pin
Hristo-Bojilov4-Jun-10 1:55
Hristo-Bojilov4-Jun-10 1:55 
QuestionHow to control a outer application? [modified] Pin
imbiz3-Jun-10 23:46
imbiz3-Jun-10 23:46 
I want to register a hotkey(for example:Ctrl+Shift+A) to do such a thing:

When I press the hotkey, I hope it will input a sentence "Hello!" at the position of current cursor in a outer active window, such as Microsoft Word,NotePad,etc.

Now I have completed the registration of the hotkey with:
          [System.Runtime.InteropServices.DllImport("user32.dll")]
            public static extern bool RegisterHotKey(
            IntPtr hWnd, // handle to window          
            int id, // hot key identifier          
            uint fsModifiers, // key-modifier options         
            Keys vk // virtual-key code            
            );
.....
RegisterHotKey(Handle, 150, 2|4, Keys.A);//Ctrl+Shift+A
.....

        private void ProcessHotkey(Message m)  
        {
            IntPtr id = m.WParam; //                    
            string sid = id.ToString();
            switch (sid)
            {
                case "150": SayHello(); break;// Press Ctrl+Shift+A,call function:SayHello(); 
                .....      
            }        
        }
.......


        private void SayHello()
        {
            MessageBox.Show("Hello!"); 
        }


It works well! When I press Ctrl+Shift+A ,a messagebox will say "Hello!". But how to get the current active window, and input the text to current cursor, no matter where the cursor is and which application it is in?
AnswerRe: How to control a outer application? Pin
Luc Pattyn4-Jun-10 0:38
sitebuilderLuc Pattyn4-Jun-10 0:38 
GeneralRe: How to control a outer application? Pin
imbiz4-Jun-10 2:20
imbiz4-Jun-10 2:20 
GeneralRe: How to control a outer application? Pin
Luc Pattyn4-Jun-10 7:18
sitebuilderLuc Pattyn4-Jun-10 7:18 
GeneralRe: How to control a outer application? [modified] Pin
imbiz4-Jun-10 21:39
imbiz4-Jun-10 21:39 
Questionlistbox Pin
kennyhibs3-Jun-10 22:30
kennyhibs3-Jun-10 22:30 
AnswerRe: listbox Pin
Peace ON3-Jun-10 23:34
Peace ON3-Jun-10 23:34 
GeneralRe: listbox Pin
kennyhibs4-Jun-10 21:39
kennyhibs4-Jun-10 21:39 
Questionwant to change theme of controls..... Pin
jainiraj3-Jun-10 19:54
jainiraj3-Jun-10 19:54 
AnswerRe: want to change theme of controls..... Pin
Johnny J.3-Jun-10 21:16
professionalJohnny J.3-Jun-10 21:16 
AnswerRe: want to change theme of controls..... Pin
Abhinav S3-Jun-10 21:31
Abhinav S3-Jun-10 21:31 
GeneralRe: want to change theme of controls..... Pin
Johnny J.3-Jun-10 22:11
professionalJohnny J.3-Jun-10 22:11 
AnswerRe: want to change theme of controls..... Pin
Dave Kreskowiak4-Jun-10 1:45
mveDave Kreskowiak4-Jun-10 1:45 
GeneralRe: want to change theme of controls..... Pin
Johnny J.4-Jun-10 2:25
professionalJohnny J.4-Jun-10 2:25 
GeneralRe: want to change theme of controls..... Pin
Dave Kreskowiak4-Jun-10 4:36
mveDave Kreskowiak4-Jun-10 4:36 
QuestionHow to Create DB in SQL server Pin
Joe Rozario3-Jun-10 18:05
Joe Rozario3-Jun-10 18:05 
AnswerRe: How to Create DB in SQL server Pin
dan!sh 3-Jun-10 18:26
professional dan!sh 3-Jun-10 18:26 
GeneralRe: How to Create DB in SQL server Pin
Joe Rozario4-Jun-10 0:14
Joe Rozario4-Jun-10 0:14 

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.