Click here to Skip to main content
15,915,611 members
Home / Discussions / C#
   

C#

 
GeneralRe: Making the code in a DLL invisible Pin
Dewald2-Dec-09 23:53
Dewald2-Dec-09 23:53 
AnswerRe: Making the code in a DLL invisible Pin
Rob Philpott2-Dec-09 23:12
Rob Philpott2-Dec-09 23:12 
GeneralRe: Making the code in a DLL invisible Pin
Rajesh R Subramanian2-Dec-09 23:40
professionalRajesh R Subramanian2-Dec-09 23:40 
GeneralRe: Making the code in a DLL invisible Pin
Dewald2-Dec-09 23:44
Dewald2-Dec-09 23:44 
AnswerRe: Making the code in a DLL invisible Pin
PIEBALDconsult3-Dec-09 4:45
mvePIEBALDconsult3-Dec-09 4:45 
Questionall in one audio video player ( Flash movies,MP3,MP4,AVI,JPG,WMA etc) Pin
ShaktisinhRathod2-Dec-09 21:26
ShaktisinhRathod2-Dec-09 21:26 
AnswerRe: all in one audio video player ( Flash movies,MP3,MP4,AVI,JPG,WMA etc) Pin
Saksida Bojan2-Dec-09 22:07
Saksida Bojan2-Dec-09 22:07 
QuestionSend keyboard keys in c# [modified] Pin
krinaljariwala2-Dec-09 20:36
krinaljariwala2-Dec-09 20:36 
Hello,
I want to send some text or keys to other applications say "notepad,calc,etc.". I have tried but i failed. New window is opened but key is not displayed on the window.
Here is my code:
[DllImport("User32.DLL")]
public static extern bool SetForegroundWindow(IntPtr hwnd);
[DllImport("User32.DLL")]
public static extern int SetActiveWindow(IntPtr hwnd);

    newprocess.StartInfo.FileName = "calc.exe";
    newprocess.StartInfo.UseShellExecute = false;
    newprocess.StartInfo.RedirectStandardOutput = true;
    newprocess.StartInfo.RedirectStandardInput = true;
    newprocess.Start();
    SetActiveWindow(newprocess.MainWindowHandle);
    //SetForegroundWindow(newprocess.MainWindowHandle);

    //write to calc
    // Press the 1 key
    keybd_event(0x61, 0x45, KEYEVENTF_EXTENDEDKEY, 0);
    //Release the 1 key
    keybd_event(0x61, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);

    //// Press the + key
    keybd_event(0x6B, 0x45, KEYEVENTF_EXTENDEDKEY, 0);
    ////Release the + key
    keybd_event(0x6B, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);

    //// Press the 1 key
    keybd_event(0x61, 0x45, KEYEVENTF_EXTENDEDKEY, 0);
    ////Release the 1 key
    keybd_event(0x61, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);

I have tried with many functions like SetForegroundWindow(), but there is no change. I have tried with notepad and used Sendkeys.Sendwait(), and its working fine. But help me for keybd_event().
Please help me its urgent.
Thank you in advance.

modified on Thursday, December 3, 2009 4:34 AM

AnswerRe: Send keyboard keys in c# Pin
Rob Philpott2-Dec-09 23:20
Rob Philpott2-Dec-09 23:20 
GeneralRe: Send keyboard keys in c# Pin
krinaljariwala2-Dec-09 23:39
krinaljariwala2-Dec-09 23:39 
QuestionDDay.iCal question Pin
Jamie Nordmeyer2-Dec-09 18:13
Jamie Nordmeyer2-Dec-09 18:13 
QuestionAbout charcter code pages Pin
bhaskarsgb2-Dec-09 17:38
bhaskarsgb2-Dec-09 17:38 
AnswerRe: About charcter code pages Pin
Saksida Bojan2-Dec-09 21:36
Saksida Bojan2-Dec-09 21:36 
GeneralRe: About charcter code pages Pin
bhaskarsgb2-Dec-09 22:13
bhaskarsgb2-Dec-09 22:13 
GeneralRe: About charcter code pages Pin
Saksida Bojan2-Dec-09 23:44
Saksida Bojan2-Dec-09 23:44 
GeneralRe: About charcter code pages Pin
bhaskarsgb3-Dec-09 0:49
bhaskarsgb3-Dec-09 0:49 
GeneralRe: About charcter code pages [modified] Pin
Saksida Bojan3-Dec-09 0:53
Saksida Bojan3-Dec-09 0:53 
GeneralRe: About charcter code pages Pin
bhaskarsgb3-Dec-09 7:01
bhaskarsgb3-Dec-09 7:01 
GeneralRe: About charcter code pages Pin
Saksida Bojan3-Dec-09 20:38
Saksida Bojan3-Dec-09 20:38 
GeneralRe: About charcter code pages Pin
bhaskarsgb4-Dec-09 7:01
bhaskarsgb4-Dec-09 7:01 
GeneralRe: About charcter code pages Pin
Saksida Bojan4-Dec-09 8:36
Saksida Bojan4-Dec-09 8:36 
GeneralRe: About charcter code pages Pin
bhaskarsgb4-Dec-09 21:47
bhaskarsgb4-Dec-09 21:47 
GeneralRe: About charcter code pages Pin
Saksida Bojan4-Dec-09 21:58
Saksida Bojan4-Dec-09 21:58 
AnswerRe: About charcter code pages Pin
Luc Pattyn3-Dec-09 1:06
sitebuilderLuc Pattyn3-Dec-09 1:06 
GeneralRe: About charcter code pages Pin
bhaskarsgb4-Dec-09 7:04
bhaskarsgb4-Dec-09 7:04 

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.