Click here to Skip to main content
15,905,971 members
Home / Discussions / C#
   

C#

 
GeneralRe: Reflection Pin
Jammer21-Jun-08 23:16
Jammer21-Jun-08 23:16 
AnswerRe: Reflection Pin
Brady Kelly21-Jun-08 23:18
Brady Kelly21-Jun-08 23:18 
GeneralRe: Reflection Pin
Jammer22-Jun-08 0:22
Jammer22-Jun-08 0:22 
GeneralRe: Reflection Pin
Vega0222-Jun-08 0:57
Vega0222-Jun-08 0:57 
GeneralRe: Reflection Pin
Brady Kelly22-Jun-08 1:05
Brady Kelly22-Jun-08 1:05 
Questionlock and Monitor.TryEnter Pin
koleraba21-Jun-08 11:34
koleraba21-Jun-08 11:34 
AnswerRe: lock and Monitor.TryEnter Pin
Scott Dorman21-Jun-08 12:29
professionalScott Dorman21-Jun-08 12:29 
GeneralRe: lock and Monitor.TryEnter Pin
koleraba21-Jun-08 12:59
koleraba21-Jun-08 12:59 
GeneralRe: lock and Monitor.TryEnter Pin
Scott Dorman21-Jun-08 13:52
professionalScott Dorman21-Jun-08 13:52 
GeneralRe: lock and Monitor.TryEnter Pin
koleraba22-Jun-08 14:34
koleraba22-Jun-08 14:34 
QuestionCan't override the mathod OnKeyPress of TextBox control ( attached code ) Pin
Yanshof21-Jun-08 6:14
Yanshof21-Jun-08 6:14 
AnswerRe: Can't override the mathod OnKeyPress of TextBox control ( attached code ) Pin
Luc Pattyn21-Jun-08 7:00
sitebuilderLuc Pattyn21-Jun-08 7:00 
AnswerRe: Can't override the mathod OnKeyPress of TextBox control ( attached code ) Pin
MagProWin21-Jun-08 7:56
MagProWin21-Jun-08 7:56 
GeneralRe: Can't override the mathod OnKeyPress of TextBox control ( attached code ) Pin
Guffa22-Jun-08 2:57
Guffa22-Jun-08 2:57 
QuestionWindow Service problem Pin
Yulianto.21-Jun-08 5:03
Yulianto.21-Jun-08 5:03 
AnswerRe: Window Service problem Pin
Ashfield21-Jun-08 7:32
Ashfield21-Jun-08 7:32 
GeneralRe: Window Service problem Pin
Yulianto.22-Jun-08 15:24
Yulianto.22-Jun-08 15:24 
QuestionSending keys to the active windows - almost there Pin
Dirso21-Jun-08 5:00
Dirso21-Jun-08 5:00 
AnswerRe: Sending keys to the active windows - almost there Pin
mav.northwind22-Jun-08 19:01
mav.northwind22-Jun-08 19:01 
GeneralRe: Sending keys to the active windows - almost there Pin
Dirso23-Jun-08 13:38
Dirso23-Jun-08 13:38 
GeneralRe: Sending keys to the active windows - almost there Pin
mav.northwind25-Jun-08 9:25
mav.northwind25-Jun-08 9:25 
GeneralRe: Sending keys to the active windows - almost there Pin
Dirso25-Jun-08 10:39
Dirso25-Jun-08 10:39 
Hi,

I actually thought that parameter didn't matter, since I zeroed it in Delphi and it worked like a charm. I also tried to use 0x45, since 0 didn't work in C# and I found a few samples sending text with 0x45 (not just NUM_LOCK).
Anyway, I did what you told me to and I still have the same result.
Here is my C# code (I can't see why it's not working)
private const int KEYEVENTF_KEYUP = 0x02;
private const int KEYEVENTF_EXTENDEDKEY = 0x01;
private const uint MAPVK_VK_TO_VSC = 0x00;

public static void SetActiveControlText(string text)
{
    #if(WINDOWS)
    byte[] buffer = Encoding.ASCII.GetBytes(text);
    uint scanCode;
    for (int i = 0; i < buffer.Length; i++)
    {
        scanCode = MapVirtualKey((uint)buffer[i], 0);
        keybd_event(buffer[i], (byte)scanCode, KEYEVENTF_EXTENDEDKEY, 0);
        keybd_event(buffer[i], (byte)scanCode, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
    }
    #else
    throw new NotImplementedException()
    #endif
}

And here is my Delphi (working very nice) code:
procedure TForm1.EnviaChar(c: char);
begin
keybd_event(ord(c),0,0,0);
keybd_event(ord(c),0,KEYEVENTF_KEYUP,0);
end;


Thanks again,
Dirso
GeneralRe: Sending keys to the active windows - almost there Pin
mav.northwind25-Jun-08 19:17
mav.northwind25-Jun-08 19:17 
GeneralRe: Sending keys to the active windows - almost there Pin
Dirso26-Jun-08 0:50
Dirso26-Jun-08 0:50 
QuestionToolStripItem visible problem Pin
Yulianto.21-Jun-08 4:56
Yulianto.21-Jun-08 4:56 

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.